Skip to content

Commit

Permalink
add test_symbol_oxi_state_str()
Browse files Browse the repository at this point in the history
  • Loading branch information
janosh committed May 18, 2023
1 parent fc564c5 commit 3d4d160
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions pymatgen/core/tests/test_periodic_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -543,5 +543,25 @@ def test_get_el_sp(self):
assert get_el_sp("Mn3+") == Species("Mn", 3)


@pytest.mark.parametrize(
("symbol_oxi", "expected_element", "expected_oxi_state"),
[
("Fe", "Fe", None),
("Fe2+", "Fe", 2),
("O2-", "O", -2),
("N-", "N", -1),
("Ca+", "Ca", 1),
("Te3+", "Te", 3),
("P5+", "P", 5),
("Na0+", "Na", 0),
("Na0-", "Na", 0),
],
)
def test_symbol_oxi_state_str(symbol_oxi, expected_element, expected_oxi_state):
species = Species(symbol_oxi)
assert species._el.symbol == expected_element
assert species._oxi_state == expected_oxi_state


if __name__ == "__main__":
unittest.main()

0 comments on commit 3d4d160

Please sign in to comment.