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