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

Method test_pop

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

Source from the content-addressed store, hash-verified

1196 bx["_box_config"]
1197
1198 def test_pop(self):
1199 bx = Box(a=4, c={"d": 3}, sub_box=Box(test=1))
1200 assert bx.pop("a") == 4
1201 with pytest.raises(BoxKeyError):
1202 bx.pop("b")
1203 assert bx.pop("a", None) is None
1204 assert bx.pop("a", True) is True
1205 with pytest.raises(BoxError):
1206 bx.pop(1, 2, 3)
1207 bx.pop("sub_box").pop("test")
1208 assert bx == {"c": {"d": 3}}
1209 assert bx.pop("c", True) is not True
1210
1211 def test_pop_items(self):
1212 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