From b26b2993911f2c487f6f355a27c68fa2074d8373 Mon Sep 17 00:00:00 2001 From: "Haoyu (Daniel)" Date: Tue, 26 Nov 2024 20:43:44 +0800 Subject: [PATCH] add test for non-numerical warning --- tests/core/test_structure.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/core/test_structure.py b/tests/core/test_structure.py index 67eee7fd04e..c0f618f2baf 100644 --- a/tests/core/test_structure.py +++ b/tests/core/test_structure.py @@ -1685,6 +1685,11 @@ def test_merge_sites(self): assert len(struct_navs2) == 12 assert any(math.isclose(site.properties["prop1"], 51.5) for site in struct_navs2) + # Test non-numerical property warning + struct_navs2.insert(0, "Na", coords[0], properties={"prop1": "hi"}) + with pytest.warns(UserWarning, match="But property is set to None"): + struct_navs2.merge_sites(mode="average") + # Test property handling for np.array (selective dynamics) poscar_str_0 = """Test POSCAR 1.0