Ticket #20535: #20535-tests_master.diff

File #20535-tests_master.diff, 572 bytes (added by Kronuz, 2 years ago)

Tests for master

  • django/tests/m2m_through/tests.py

    class M2mThroughTests(TestCase): 
    343343            ],
    344344            attrgetter("name")
    345345        )
     346
     347    def test_ticket_20535_join_trimming(self):
     348        qs = Friendship.objects.filter(first__rel_to_set__first__id=1)
     349        self.assertEqual(str(qs.query).count('JOIN'), 1)
     350
     351    def test_ticket_20535_no_join_trimming(self):
     352        qs = Friendship.objects.filter(first__rel_to_set__first__id=1, first__name='Jane')
     353        self.assertEqual(str(qs.query).count('JOIN'), 2)
Back to Top