Fix: materials, plots, and tallies cannot be passed as lists (#3513)

Co-authored-by: Paul Romano <paul.k.romano@gmail.com>
This commit is contained in:
Rémi Delaporte-Mathurin 2025-07-29 05:34:03 -04:00 committed by GitHub
parent 6b672f772f
commit 836bc487cf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 25 additions and 6 deletions

View file

@ -892,3 +892,16 @@ def test_id_map_aligned_model():
assert tr_cell == 20, f"Expected cell ID 20 at top-right corner, got {tr_cell}"
assert tr_instance == 3, f"Expected cell instance 3 at top-right corner, got {tr_instance}"
assert tr_material == 5, f"Expected material ID 5 at top-right corner, got {tr_material}"
def test_setter_from_list():
mat = openmc.Material()
model = openmc.Model(materials=[mat])
assert isinstance(model.materials, openmc.Materials)
tally = openmc.Tally()
model = openmc.Model(tallies=[tally])
assert isinstance(model.tallies, openmc.Tallies)
plot = openmc.Plot()
model = openmc.Model(plots=[plot])
assert isinstance(model.plots, openmc.Plots)