From dd83e70d316e6fbe2b1bcc214c2cefcd64e6840a Mon Sep 17 00:00:00 2001 From: shimwell Date: Mon, 29 Jan 2024 17:41:06 +0000 Subject: [PATCH] [skip ci] Apply formatting changes --- tests/test_core.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/tests/test_core.py b/tests/test_core.py index 7a148df..e598e1f 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -11,7 +11,7 @@ def test_source(): my_source = openmc.Source() # sets the location of the source to x=0 y=0 z=0 - my_source.space = openmc.stats.Point((4.,5.,6.)) + my_source.space = openmc.stats.Point((4.0, 5.0, 6.0)) # sets the direction to isotropic my_source.angle = openmc.stats.Isotropic() @@ -19,18 +19,19 @@ def test_source(): # sets the energy distribution to 100% 14MeV neutrons my_source.energy = openmc.stats.Discrete([14e6], [1]) - my_source.particle = 'neutron' + my_source.particle = "neutron" my_source = my_source return my_source + @pytest.fixture def test_model(): # initialises a new source object my_source = openmc.Source() # sets the location of the source to x=0 y=0 z=0 - my_source.space = openmc.stats.Point((1.,2.,3.)) + my_source.space = openmc.stats.Point((1.0, 2.0, 3.0)) # sets the direction to isotropic my_source.angle = openmc.stats.Isotropic() @@ -38,7 +39,7 @@ def test_model(): # sets the energy distribution to 100% 14MeV neutrons my_source.energy = openmc.stats.Discrete([15e6], [1]) - my_source.particle = 'photon' + my_source.particle = "photon" settings = openmc.Settings() settings.particles = 1 @@ -60,16 +61,17 @@ def test_source_sample_initial_particles(test_source): particles = test_source.sample_initial_particles(n_samples=42) for particle in particles: assert particle.E == 14e6 - assert str(particle.particle) == 'neutron' - assert particle.r == (4.,5.,6.) + assert str(particle.particle) == "neutron" + assert particle.r == (4.0, 5.0, 6.0) assert len(particles) == 42 + def test_model_sample_initial_particles(test_model): particles = test_model.sample_initial_particles(n_samples=43) for particle in particles: assert particle.E == 15e6 - assert str(particle.particle) == 'photon' - assert particle.r == (1.,2.,3.) + assert str(particle.particle) == "photon" + assert particle.r == (1.0, 2.0, 3.0) assert len(particles) == 43