From d8470c9e0a364c9e26f83aad88217d810b8311df Mon Sep 17 00:00:00 2001 From: Matthew Evans Date: Mon, 25 Oct 2021 14:07:21 +0100 Subject: [PATCH] Update tests to accommodate new formula regexp --- tests/models/test_structures.py | 10 +++++----- tests/models/test_utils.py | 4 +++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/tests/models/test_structures.py b/tests/models/test_structures.py index 4fa9111889..09e9a626bd 100644 --- a/tests/models/test_structures.py +++ b/tests/models/test_structures.py @@ -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"}, @@ -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"}, @@ -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", ), ) diff --git a/tests/models/test_utils.py b/tests/models/test_utils.py index 61d10d4715..adf3221671 100644 --- a/tests/models/test_utils.py +++ b/tests/models/test_utils.py @@ -93,7 +93,6 @@ class DummyModel(BaseModel): "LiP5", "Jn7Qb4", # Regexp does not care about the actual existence of elements "A5B213CeD3E65F12G", - "A1Be2", ) bad_formulae = ( @@ -102,6 +101,9 @@ class DummyModel(BaseModel): "Ag Cl", "abcd", "6F7G", + "A0Be2", + "A1Be2", + "", ) for formula in good_formulae: