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

Method test_box

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

Source from the content-addressed store, hash-verified

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