Skip to content

Commit 9891326

Browse files
committed
Add test.
1 parent df4468b commit 9891326

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

tests/model_fields_/test_embedded_model.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,11 @@ def test_nested(self):
104104
)
105105
self.assertCountEqual(Book.objects.filter(author__address__city="NYC"), [obj])
106106

107+
def test_field_not_exists(self):
108+
msg = "Author has no field named 'first_name'"
109+
with self.assertRaisesMessage(FieldDoesNotExist, msg):
110+
Book.objects.filter(author__first_name="Bob")
111+
107112
def test_nested_not_exists(self):
108113
msg = "Unsupported lookup 'president' for CharField 'city'"
109114
with self.assertRaisesMessage(FieldDoesNotExist, msg):

0 commit comments

Comments
 (0)