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

Method test_box

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

Source from the content-addressed store, hash-verified

140 assert out[1][0] == {"second": "b"}
141
142 def test_box(self):
143 bx = Box(**test_dict)
144 assert bx.key1 == test_dict["key1"]
145 assert dict(getattr(bx, "Key 2")) == test_dict["Key 2"]
146 setattr(bx, "TEST_KEY", "VALUE")
147 assert bx.TEST_KEY == "VALUE"
148 delattr(bx, "TEST_KEY")
149 assert "TEST_KEY" not in bx.to_dict(), bx.to_dict()
150 assert isinstance(bx["Key 2"].Key4, Box)
151 assert "'key1': 'value1'" in str(bx)
152 assert repr(bx).startswith("Box(")
153 bx2 = Box([((3, 4), "A"), ("_box_config", "test")])
154 assert bx2[(3, 4)] == "A"
155 assert bx2["_box_config"] == "test"
156 bx3 = Box(a=4, conversion_box=False)
157 setattr(bx3, "key", 2)
158 assert bx3.key == 2
159 bx3.__setattr__("Test", 3)
160 assert bx3.Test == 3
161
162 def test_box_modify_at_depth(self):
163 bx = Box(**test_dict)

Callers

nothing calls this directly

Calls 3

to_dictMethod · 0.95
__setattr__Method · 0.95
BoxClass · 0.90

Tested by

no test coverage detected