From 74e83f3eefa427f23e2f73b870a1dd63cde227b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ingvar=20Dahlgren?= Date: Tue, 23 Apr 2024 11:21:21 +0200 Subject: [PATCH] Add example in docs showing how fractional occupation is parsed --- chempy/util/parsing.py | 2 ++ chempy/util/tests/test_parsing.py | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/chempy/util/parsing.py b/chempy/util/parsing.py index efffccc4..9a532527 100644 --- a/chempy/util/parsing.py +++ b/chempy/util/parsing.py @@ -379,6 +379,8 @@ def formula_to_composition( True >>> formula_to_composition('Na2CO3..7H2O') == {11: 2, 6: 1, 8: 10, 1: 14} True + >>> formula_to_composition('UO2.3') == {92: 1, 8: 2.3} + True """ if prefixes is None: diff --git a/chempy/util/tests/test_parsing.py b/chempy/util/tests/test_parsing.py index 7819edcc..580e8079 100644 --- a/chempy/util/tests/test_parsing.py +++ b/chempy/util/tests/test_parsing.py @@ -752,7 +752,6 @@ def test_formula_to_html_caged(species, html): assert formula_to_html(species) == html - def test_composition_dot_as_crystal_water_chempy08x(): ref = {30: 1, 7: 2, 8: 12, 1: 12} assert formula_to_composition('Zn(NO3)2{}6H2O'.format('\u00B7')) == ref