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

Method test_inheritance

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

Source from the content-addressed store, hash-verified

1139 assert isinstance(g, ConfigBox)
1140
1141 def test_inheritance(self):
1142 data = {
1143 "users": [
1144 {"users": [{"name": "B"}]},
1145 ],
1146 }
1147
1148 class UsersBoxList(BoxList):
1149 def find_by_name(self, name):
1150 return next((i for i in self if i.name == name), None)
1151
1152 db = Box(data, box_recast={"users": UsersBoxList}, box_intact_types=[UsersBoxList])
1153
1154 assert isinstance(db.users, UsersBoxList)
1155 assert isinstance(db.users[0].users, UsersBoxList)
1156
1157 def test_underscore_removal(self):
1158 from box import Box

Callers

nothing calls this directly

Calls 1

BoxClass · 0.90

Tested by

no test coverage detected