diff --git a/src/iact_estimator/tests/__init__.py b/src/iact_estimator/tests/__init__.py new file mode 100644 index 0000000..5a68c2b --- /dev/null +++ b/src/iact_estimator/tests/__init__.py @@ -0,0 +1 @@ +"""Testing suite for iact-estimator.""" diff --git a/src/iact_estimator/tests/test_io.py b/src/iact_estimator/tests/test_io.py new file mode 100644 index 0000000..789affa --- /dev/null +++ b/src/iact_estimator/tests/test_io.py @@ -0,0 +1,18 @@ +def test_read_yaml(tmp_path): + from ..io import read_yaml + + test_file = tmp_path / "test_file.yml" + test_file.write_text( + """ + a: 1 + b: + c: 3 + d: 4 + """ + ) + + data = read_yaml(test_file) + + assert data["a"] == 1 + assert data["b"]["c"] == 3 + assert data["b"]["d"] == 4 diff --git a/src/iact_estimator/tests/test_spectral.py b/src/iact_estimator/tests/test_spectral.py new file mode 100644 index 0000000..0905ad2 --- /dev/null +++ b/src/iact_estimator/tests/test_spectral.py @@ -0,0 +1,24 @@ +# Test cases automatically generated by Pynguin (https://www.pynguin.eu). +# Please check them before you use them. + +import astropy.units as u +import numpy as np + + +def test_crab_nebula_spectrum(): + from ..spectral import crab_nebula_spectrum + + spectrum = crab_nebula_spectrum() + + assert spectrum.amplitude.unit == u.Unit("TeV^-1 s^-1 cm^-2") + assert spectrum.reference.unit == u.TeV + + assert np.allclose( + [ + spectrum.alpha.value, + spectrum.beta.value, + spectrum.amplitude.value, + spectrum.reference.value, + ], + [2.51, 0.21 / np.log(10), 3.39e-11, 1.0], + )