Skip to content

Commit

Permalink
[skip ci] Apply formatting changes
Browse files Browse the repository at this point in the history
  • Loading branch information
shimwell authored and github-actions[bot] committed Jan 29, 2024
1 parent 0b62224 commit dd83e70
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,34 +11,35 @@ 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()

# 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()

# 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
Expand All @@ -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


Expand Down

0 comments on commit dd83e70

Please sign in to comment.