Skip to content

Commit

Permalink
Added simple test for adding elements by name
Browse files Browse the repository at this point in the history
  • Loading branch information
ChasingNeutrons committed Feb 25, 2020
1 parent 01fc85e commit dce773d
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/unit_tests/test_material.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,22 @@ def test_elements():
with pytest.raises(ValueError):
m.add_element('Pu', 1.0, enrichment=3.0)

def test_elements_by_name():
"""Test adding elements by name"""
m = openmc.Material()
m.add_element('woLfrAm',1.0)
with pytest.raises(ValueError):
m.add_element('uranum',1.0)
m.add_element('uRaNiUm',1.0)
m.add_element('Aluminium',1.0)
a = openmc.Material()
b = openmc.Material()
c = openmc.Material()
a.add_element('sulfur',1.0)
b.add_element('SulPhUR',1.0)
c.add_element('S',1.0)
assert a._nuclides == b._nuclides
assert b._nuclides == c._nuclides

def test_density():
m = openmc.Material()
Expand Down

0 comments on commit dce773d

Please sign in to comment.