(self)
| 1062 | assert company.parents == [root] |
| 1063 | |
| 1064 | def test_dict_in_dbref_instance(self): |
| 1065 | class Person(Document): |
| 1066 | name = StringField(max_length=250, required=True) |
| 1067 | |
| 1068 | class Room(Document): |
| 1069 | number = StringField(max_length=250, required=True) |
| 1070 | staffs_with_position = ListField(DictField()) |
| 1071 | |
| 1072 | Person.drop_collection() |
| 1073 | Room.drop_collection() |
| 1074 | |
| 1075 | bob = Person.objects.create(name="Bob") |
| 1076 | bob.save() |
| 1077 | sarah = Person.objects.create(name="Sarah") |
| 1078 | sarah.save() |
| 1079 | |
| 1080 | room_101 = Room.objects.create(number="101") |
| 1081 | room_101.staffs_with_position = [ |
| 1082 | {"position_key": "window", "staff": sarah}, |
| 1083 | {"position_key": "door", "staff": bob.to_dbref()}, |
| 1084 | ] |
| 1085 | room_101.save() |
| 1086 | |
| 1087 | room = Room.objects.first().select_related() |
| 1088 | assert room.staffs_with_position[0]["staff"] == sarah |
| 1089 | assert room.staffs_with_position[1]["staff"] == bob |
| 1090 | |
| 1091 | def test_document_reload_no_inheritance(self): |
| 1092 | class Foo(Document): |
nothing calls this directly
no test coverage detected