MCPcopy Create free account
hub / github.com/cdgriffith/Box / test_duplicate_errors

Method test_duplicate_errors

test/test_box.py:819–831  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

817 assert a[1].b == 3
818
819 def test_duplicate_errors(self):
820 with pytest.raises(BoxError):
821 Box({"?a": 1, "!a": 3}, box_duplicates="error")
822
823 Box({"?a": 1, "!a": 3}, box_duplicates="ignore")
824
825 with pytest.warns(UserWarning) as warning:
826 Box({"?a": 1, "!a": 3}, box_duplicates="warn")
827 assert warning[0].message.args[0].startswith("Duplicate")
828
829 my_box = Box({"?a": 1}, box_duplicates="error")
830 with pytest.raises(BoxError):
831 my_box["^a"] = 3
832
833 @pytest.mark.parametrize("policy", ["error", "warn"])
834 @pytest.mark.parametrize("use_attribute", [False, True])

Callers

nothing calls this directly

Calls 1

BoxClass · 0.90

Tested by

no test coverage detected