Skip to content

Commit

Permalink
Update tests to accommodate new formula regexp
Browse files Browse the repository at this point in the history
  • Loading branch information
ml-evs committed Oct 25, 2021
1 parent 9c1039e commit d8470c9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
10 changes: 5 additions & 5 deletions tests/models/test_structures.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ def test_bad_structures(bad_structures, mapper):
),
(
{"chemical_formula_anonymous": "A1B1"},
"'chemical_formula_anonymous' A1B1 must omit proportion '1'",
"string does not match regex",
),
(
{"chemical_formula_anonymous": "BC1"},
"'chemical_formula_anonymous' BC1 must omit proportion '1'",
"string does not match regex",
),
(
{"chemical_formula_anonymous": "A9C"},
Expand Down Expand Up @@ -136,11 +136,11 @@ def test_bad_structures(bad_structures, mapper):
),
(
{"chemical_formula_reduced": "Ge1Si"},
"Must omit proportion '1' from formula Ge1Si in 'chemical_formula_reduced'",
"string does not match regex",
),
(
{"chemical_formula_reduced": "GeSi1"},
"Must omit proportion '1' from formula GeSi1 in 'chemical_formula_reduced'",
"string does not match regex",
),
(
{"chemical_formula_reduced": "SiGe2"},
Expand Down Expand Up @@ -180,7 +180,7 @@ def test_bad_structures(bad_structures, mapper):
),
(
{"chemical_formula_anonymous": "A44B15C9D4E3F2GHI0J0K0L0"},
"chemical_formula_anonymous 'A44B15C9D4E3F2GHI0J0K0L0' cannot contain chemical proportion of 0.",
"string does not match regex",
),
)

Expand Down
4 changes: 3 additions & 1 deletion tests/models/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ class DummyModel(BaseModel):
"LiP5",
"Jn7Qb4", # Regexp does not care about the actual existence of elements
"A5B213CeD3E65F12G",
"A1Be2",
)

bad_formulae = (
Expand All @@ -102,6 +101,9 @@ class DummyModel(BaseModel):
"Ag Cl",
"abcd",
"6F7G",
"A0Be2",
"A1Be2",
"",
)

for formula in good_formulae:
Expand Down

0 comments on commit d8470c9

Please sign in to comment.