diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/filtered_relation/tests.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/filtered_relation/tests.py b/tests/filtered_relation/tests.py index 48154413a5..05869a2a95 100644 --- a/tests/filtered_relation/tests.py +++ b/tests/filtered_relation/tests.py @@ -52,6 +52,18 @@ class FilteredRelationTests(TestCase): (self.author2, self.book3, self.editor_b, self.author2), ], lambda x: (x, x.book_join, x.book_join.editor, x.book_join.author)) + def test_select_related_multiple(self): + qs = Book.objects.annotate( + author_join=FilteredRelation('author'), + editor_join=FilteredRelation('editor'), + ).select_related('author_join', 'editor_join').order_by('pk') + self.assertQuerysetEqual(qs, [ + (self.book1, self.author1, self.editor_a), + (self.book2, self.author2, self.editor_b), + (self.book3, self.author2, self.editor_b), + (self.book4, self.author1, self.editor_a), + ], lambda x: (x, x.author_join, x.editor_join)) + def test_select_related_with_empty_relation(self): qs = Author.objects.annotate( book_join=FilteredRelation('book', condition=Q(pk=-1)), |
