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
introduced
by
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
|
|||
18 | |||
19 | primflux = PrimaryFlux(channel="W", mDM=1 * u.TeV) |
||
0 ignored issues
–
show
|
|||
20 | actual = primflux.table_model(500 * u.GeV) |
||
0 ignored issues
–
show
|
|||
21 | desired = 9.328234e-05 / u.GeV |
||
0 ignored issues
–
show
|
|||
22 | assert_quantity_allclose(actual, desired) |
||
23 |