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

Method test_inheritance

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

Source from the content-addressed store, hash-verified

1074 assert isinstance(g, ConfigBox)
1075
1076 def test_inheritance(self):
1077 data = {
1078 "users": [
1079 {"users": [{"name": "B"}]},
1080 ],
1081 }
1082
1083 class UsersBoxList(BoxList):
1084 def find_by_name(self, name):
1085 return next((i for i in self if i.name == name), None)
1086
1087 db = Box(data, box_recast={"users": UsersBoxList}, box_intact_types=[UsersBoxList])
1088
1089 assert isinstance(db.users, UsersBoxList)
1090 assert isinstance(db.users[0].users, UsersBoxList)
1091
1092 def test_underscore_removal(self):
1093 from box import Box

Callers

nothing calls this directly

Calls 1

BoxClass · 0.90

Tested by

no test coverage detected