Check for undefined variables.
1 | # Licensed under a 3-clause BSD style license - see LICENSE.rst |
||
2 | import pytest |
||
3 | from numpy.testing import assert_allclose |
||
4 | from gammapy.astro.population.velocity import ( |
||
5 | FaucherKaspi2006VelocityBimodal, |
||
6 | FaucherKaspi2006VelocityMaxwellian, |
||
7 | Paczynski1990Velocity, |
||
8 | ) |
||
9 | |||
10 | test_cases = [ |
||
11 | { |
||
12 | "class": FaucherKaspi2006VelocityMaxwellian, |
||
13 | "x": [1, 10], |
||
14 | "y": [4.28745276e-08, 4.28443169e-06], |
||
15 | }, |
||
16 | { |
||
17 | "class": FaucherKaspi2006VelocityBimodal, |
||
18 | "x": [1, 10], |
||
19 | "y": [1.754811e-07, 1.751425e-05], |
||
20 | }, |
||
21 | {"class": Paczynski1990Velocity, "x": [1, 10], "y": [0.00227363, 0.00227219]}, |
||
22 | ] |
||
23 | |||
24 | |||
25 | @pytest.mark.parametrize("case", test_cases, ids=lambda _: _["class"].__name__) |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
Loading history...
|
|||
26 | def test_velocity_model(case): |
||
27 | model = case["class"]() |
||
28 | y = model(case["x"]) |
||
29 | assert_allclose(y, case["y"], rtol=1e-5) |
||
30 |