Repository: Materials-Consortia/optimade-python-tools (python)

Issue:
`chemical_formula_anonymous` validator accepts incorrect proportion order if started with 1
As reported by @JPBergsma in https://github.com/Materials-Consortia/optimade-python-tools/pull/1001#issue-1059491669, the `chemical_formula_anonymous` validator has an edge case that allows the wrong order of elements for certain compositions (those with only two different proportions, e.g. 1 and 4), if the first element has proportion 1, e.g. `"AB4"` does not raise an error as it should.

Pull request description:
Fixed bug in check_anonymous_formula which caused `chemical_formula_anonymous = AB2` to pass validation.
I noticed that in OQMD structure [4061139](http://oqmd.org/optimade/v1/structures?id=4061139) has an invalid chemical_formula_anonymous. i.e. "ABCD4" for "CsHoS4Si" instead of "A4BCD"
On the Optimade providers list, there was however no error for this wrong behaviour. 
So here I have tried to fix the validator so this wrong formatting no longer passes. 

Closes #1002.

Patch:
diff --git a/optimade/models/structures.py b/optimade/models/structures.py
index 62a39f46..1ef9ae57 100644
--- a/optimade/models/structures.py
+++ b/optimade/models/structures.py
@@ -872,7 +872,8 @@ The properties of the species are found in the property `species`.
             return v
 
         elements = tuple(re.findall(r"[A-Z][a-z]*", v))
-        numbers = [int(n.strip()) for n in re.split(r"[A-Z][a-z]*", v) if n.strip()]
+        numbers = re.split(r"[A-Z][a-z]*", v)[1:]
+        numbers = [int(i) if i else 1 for i in numbers]
 
         expected_labels = ANONYMOUS_ELEMENTS[: len(elements)]
         expected_numbers = sorted(numbers, reverse=True)


Test patch:
diff --git a/tests/models/test_structures.py b/tests/models/test_structures.py
index 09e9a626..e1401e55 100644
--- a/tests/models/test_structures.py
+++ b/tests/models/test_structures.py
@@ -103,8 +103,8 @@ deformities = (
         "'chemical_formula_anonymous' A2B90 has wrong order: elements with highest proportion should appear first: [2, 90] vs expected [90, 2]",
     ),
     (
-        {"chemical_formula_anonymous": "A2B10"},
-        "'chemical_formula_anonymous' A2B10 has wrong order: elements with highest proportion should appear first: [2, 10] vs expected [10, 2]",
+        {"chemical_formula_anonymous": "AB10"},
+        "'chemical_formula_anonymous' AB10 has wrong order: elements with highest proportion should appear first: [1, 10] vs expected [10, 1]",
     ),
     (
         {"chemical_formula_hill": "SiGe"},