diff --git a/tests/expressions/tests.py b/tests/expressions/tests.py
index b17a286d5d..6bcb4bcbc6 100644
a
|
b
|
class BasicExpressionsTests(TestCase):
|
511 | 511 | Employee.objects.exclude(company_point_of_contact_set=None).values('pk') |
512 | 512 | ) |
513 | 513 | |
| 514 | def test_subquery_eq(self): |
| 515 | qs = Employee.objects.annotate( |
| 516 | is_ceo=Exists(Company.objects.filter(ceo=OuterRef('pk'))), |
| 517 | is_point_of_contact=Exists( |
| 518 | Company.objects.filter(point_of_contact=OuterRef('pk')), |
| 519 | ), |
| 520 | is_ceo_2=Exists(Company.objects.filter(ceo=OuterRef('pk'))), |
| 521 | ).filter(is_ceo=True, is_point_of_contact=False, firstname='Joe') |
| 522 | self.assertEqual( |
| 523 | qs.query.annotations['is_ceo'], |
| 524 | qs.query.annotations['is_ceo_2'], |
| 525 | ) |
| 526 | self.assertNotEqual( |
| 527 | qs.query.annotations['is_ceo'], |
| 528 | qs.query.annotations['is_point_of_contact'], |
| 529 | ) |
| 530 | |
514 | 531 | def test_in_subquery(self): |
515 | 532 | # This is a contrived test (and you really wouldn't write this query), |
516 | 533 | # but it is a succinct way to test the __in=Subquery() construct. |