Passed
Pull Request — master (#1918)
by Christoph
05:37
created

gammapy/astro/darkmatter/tests/test_spectra.py (5 issues)

1
# Licensed under a 3-clause BSD style license - see LICENSE.rst
2
from __future__ import absolute_import, division, print_function, unicode_literals
3
import pytest
0 ignored issues
show
Unable to import 'pytest'
Loading history...
4
import astropy.units as u
5
from ....utils.testing import (
6
    assert_quantity_allclose,
7
    requires_data,
8
    requires_dependency,
9
)
10
from .. import PrimaryFlux
11
12
13
@requires_dependency("scipy")
14
@requires_data("gammapy-extra")
15
def test_primary_flux():
16
    with pytest.raises(ValueError):
17
        PrimaryFlux(channel="Spam", mDM=1 * u.TeV)
0 ignored issues
show
The Module astropy.units does not seem to have a member named TeV.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
18
19
    primflux = PrimaryFlux(channel="W", mDM=1 * u.TeV)
0 ignored issues
show
The Module astropy.units does not seem to have a member named TeV.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
20
    actual = primflux.table_model(500 * u.GeV)
0 ignored issues
show
The Module astropy.units does not seem to have a member named GeV.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
21
    desired = 9.328234e-05 / u.GeV
0 ignored issues
show
The Module astropy.units does not seem to have a member named GeV.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
22
    assert_quantity_allclose(actual, desired)
23