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

Method test_box

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

Source from the content-addressed store, hash-verified

102 assert out[1][0] == {"second": "b"}
103
104 def test_box(self):
105 bx = Box(**test_dict)
106 assert bx.key1 == test_dict["key1"]
107 assert dict(getattr(bx, "Key 2")) == test_dict["Key 2"]
108 setattr(bx, "TEST_KEY", "VALUE")
109 assert bx.TEST_KEY == "VALUE"
110 delattr(bx, "TEST_KEY")
111 assert "TEST_KEY" not in bx.to_dict(), bx.to_dict()
112 assert isinstance(bx["Key 2"].Key4, Box)
113 assert "'key1': 'value1'" in str(bx)
114 assert repr(bx).startswith("Box(")
115 bx2 = Box([((3, 4), "A"), ("_box_config", "test")])
116 assert bx2[(3, 4)] == "A"
117 assert bx2["_box_config"] == "test"
118 bx3 = Box(a=4, conversion_box=False)
119 setattr(bx3, "key", 2)
120 assert bx3.key == 2
121 bx3.__setattr__("Test", 3)
122 assert bx3.Test == 3
123
124 def test_box_modify_at_depth(self):
125 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