mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 22:26:08 -04:00
moved test out of python API into C++ API. modeled after test that adds a new tally. TODO add a test that tries to delete an invalid ID
This commit is contained in:
parent
30b1ae92cb
commit
4faaa4062b
2 changed files with 15 additions and 4 deletions
|
|
@ -339,6 +339,20 @@ def test_new_tally(lib_init):
|
|||
new_tally_with_id.scores = ['flux']
|
||||
assert len(openmc.lib.tallies) == 5
|
||||
|
||||
def test_add_and_delete_tally(lib_init):
|
||||
with pytest.raises(exc.AllocationError):
|
||||
openmc.lib.Material(1)
|
||||
new_tally = openmc.lib.Tally()
|
||||
new_tally.scores = ['flux']
|
||||
new_tally_with_id = openmc.lib.Tally(10)
|
||||
new_tally_with_id.scores = ['flux']
|
||||
assert len(openmc.lib.tallies) == 5
|
||||
# delete tally and check length is one less than before
|
||||
openmc_remove_tally(10)
|
||||
assert len(openmc.lib.tallies) == 4
|
||||
|
||||
# def test_delete_wrong_id():
|
||||
|
||||
|
||||
def test_tally_activate(lib_simulation_init):
|
||||
t = openmc.lib.tallies[1]
|
||||
|
|
|
|||
|
|
@ -38,7 +38,4 @@ def test_xml_roundtrip(run_in_tmpdir):
|
|||
assert len(new_tally.triggers) == 1
|
||||
assert new_tally.triggers[0].trigger_type == tally.triggers[0].trigger_type
|
||||
assert new_tally.triggers[0].threshold == tally.triggers[0].threshold
|
||||
assert new_tally.triggers[0].scores == tally.triggers[0].scores
|
||||
# delete tally and check that new_tallies now has length zero
|
||||
new_tally.openmc_remove_tally_from_tallies(tally.id)
|
||||
assert len(new_tallies) == 0
|
||||
assert new_tally.triggers[0].scores == tally.triggers[0].scores
|
||||
Loading…
Add table
Add a link
Reference in a new issue