| 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 |