style: apply black formatting to test files

This commit is contained in:
2026-10-02 14:32:04 +03:00
parent 7e31ac4b4e
commit 7f47a876ae
3 changed files with 42 additions and 42 deletions
+27 -27
View File
@@ -20,12 +20,12 @@ class TestNeutrinoMassPhaseSpaceEffects:
result = ps(W_test)
# Should not produce NaN values
assert not np.any(
np.isnan(result)
), "Phase space with m_nu=0 should not produce NaN values"
assert np.all(
result > 0
), "Phase space with m_nu=0 should be positive in physical range"
assert not np.any(np.isnan(result)), (
"Phase space with m_nu=0 should not produce NaN values"
)
assert np.all(result > 0), (
"Phase space with m_nu=0 should be positive in physical range"
)
def test_phase_space_with_nonzero_neutrino_mass(self):
"""Test that phase space calculation works with non-zero neutrino mass."""
@@ -34,12 +34,12 @@ class TestNeutrinoMassPhaseSpaceEffects:
result = ps(W_test)
# Should not produce NaN values for energies above threshold
assert not np.any(
np.isnan(result)
), "Phase space with m_nu>0 should not produce NaN values above threshold"
assert np.all(
result > 0
), "Phase space with m_nu>0 should be positive above threshold"
assert not np.any(np.isnan(result)), (
"Phase space with m_nu>0 should not produce NaN values above threshold"
)
assert np.all(result > 0), (
"Phase space with m_nu>0 should be positive above threshold"
)
def test_phase_space_with_neutrino_mass_near_endpoint(self):
"""Test that phase space calculation handles energies near endpoint with neutrino mass."""
@@ -48,18 +48,18 @@ class TestNeutrinoMassPhaseSpaceEffects:
# Test energies where W0-W > m_nu (should be finite)
W_above_threshold = np.array([4.8]) # W0-W = 0.2 > m_nu=0.1
result_above = ps(W_above_threshold)
assert not np.any(
np.isnan(result_above)
), "Should produce finite value above threshold"
assert not np.any(np.isnan(result_above)), (
"Should produce finite value above threshold"
)
# Test energies where W0-W < m_nu (should be handled properly)
# With our fix, this should return 0 instead of NaN
W_below_threshold = np.array([4.95]) # W0-W = 0.05 < m_nu=0.1
result_below = ps(W_below_threshold)
# After our fix, NaN values should be replaced with 0
assert np.all(result_below == 0.0) or np.all(
np.isnan(result_below)
), "Should handle below-threshold energies properly (either 0 or NaN)"
assert np.all(result_below == 0.0) or np.all(np.isnan(result_below)), (
"Should handle below-threshold energies properly (either 0 or NaN)"
)
def test_spectrum_config_with_neutrino_mass(self):
"""Test that SpectrumConfig accepts and stores neutrino mass parameter."""
@@ -72,9 +72,9 @@ class TestNeutrinoMassPhaseSpaceEffects:
e_step_MeV=0.001,
neutrino_mass_MeV=0.01,
)
assert (
config.neutrino_mass_MeV == 0.01
), "SpectrumConfig should store neutrino mass parameter"
assert config.neutrino_mass_MeV == 0.01, (
"SpectrumConfig should store neutrino mass parameter"
)
def test_beta_spectrum_with_neutrino_mass(self):
"""Test that BetaSpectrum works with neutrino mass in configuration."""
@@ -96,12 +96,12 @@ class TestNeutrinoMassPhaseSpaceEffects:
result = spectrum(W)
# Should not produce NaN values
assert not np.any(
np.isnan(result)
), "BetaSpectrum with neutrino mass should not produce NaN values"
assert np.all(
result >= 0
), "BetaSpectrum with neutrino mass should be non-negative"
assert not np.any(np.isnan(result)), (
"BetaSpectrum with neutrino mass should not produce NaN values"
)
assert np.all(result >= 0), (
"BetaSpectrum with neutrino mass should be non-negative"
)
class TestNeutrinoMassCLIIntegration: