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

Method test_pop

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

Source from the content-addressed store, hash-verified

1131 bx["_box_config"]
1132
1133 def test_pop(self):
1134 bx = Box(a=4, c={"d": 3}, sub_box=Box(test=1))
1135 assert bx.pop("a") == 4
1136 with pytest.raises(BoxKeyError):
1137 bx.pop("b")
1138 assert bx.pop("a", None) is None
1139 assert bx.pop("a", True) is True
1140 with pytest.raises(BoxError):
1141 bx.pop(1, 2, 3)
1142 bx.pop("sub_box").pop("test")
1143 assert bx == {"c": {"d": 3}}
1144 assert bx.pop("c", True) is not True
1145
1146 def test_pop_items(self):
1147 bx = Box(a=4, b=5)

Callers

nothing calls this directly

Calls 2

popMethod · 0.95
BoxClass · 0.90

Tested by

no test coverage detected