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

Method test_duplicate_errors

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

Source from the content-addressed store, hash-verified

866 assert a[1].b == 3
867
868 def test_duplicate_errors(self):
869 with pytest.raises(BoxError):
870 Box({"?a": 1, "!a": 3}, box_duplicates="error")
871
872 Box({"?a": 1, "!a": 3}, box_duplicates="ignore")
873
874 with pytest.warns(UserWarning) as warning:
875 Box({"?a": 1, "!a": 3}, box_duplicates="warn")
876 assert warning[0].message.args[0].startswith("Duplicate")
877
878 my_box = Box({"?a": 1}, box_duplicates="error")
879 with pytest.raises(BoxError):
880 my_box["^a"] = 3
881
882 @pytest.mark.parametrize("policy", ["error", "warn"])
883 @pytest.mark.parametrize("use_attribute", [False, True])

Callers

nothing calls this directly

Calls 1

BoxClass · 0.90

Tested by

no test coverage detected