diff options
| author | Anssi Kääriäinen <akaariai@gmail.com> | 2014-11-17 10:26:10 +0200 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2014-11-28 07:30:26 -0500 |
| commit | ab89414f40db1598364a7fe4cfac1766cacd2668 (patch) | |
| tree | b32932e121a8f3643d120cc8083adab2d74a223e /tests | |
| parent | c7175fcdfe94be60c04f3b1ceb6d0b2def2b6f09 (diff) | |
Fixed #23853 -- Added Join class to replace JoinInfo
Also removed Query.join_map. This structure was used to speed up join
reuse calculation. Initial benchmarking shows that this isn't actually
needed. If there are use cases where the removal has real-world
performance implications, it should be relatively straightforward to
reintroduce it as map {alias: [Join-like objects]}.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/queries/tests.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/tests/queries/tests.py b/tests/queries/tests.py index 6aa3770897..1c2906e7a3 100644 --- a/tests/queries/tests.py +++ b/tests/queries/tests.py @@ -11,6 +11,7 @@ from django.core.exceptions import FieldError from django.db import connection, DEFAULT_DB_ALIAS from django.db.models import Count, F, Q from django.db.models.sql.where import WhereNode, EverythingNode, NothingNode +from django.db.models.sql.constants import LOUTER from django.db.models.sql.datastructures import EmptyResultSet from django.test import TestCase, skipUnlessDBFeature from django.test.utils import CaptureQueriesContext @@ -128,7 +129,7 @@ class Queries1Tests(BaseQuerysetTest): def test_ticket2306(self): # Checking that no join types are "left outer" joins. query = Item.objects.filter(tags=self.t2).query - self.assertNotIn(query.LOUTER, [x[2] for x in query.alias_map.values()]) + self.assertNotIn(LOUTER, [x.join_type for x in query.alias_map.values()]) self.assertQuerysetEqual( Item.objects.filter(Q(tags=self.t1)).order_by('name'), @@ -336,7 +337,7 @@ class Queries1Tests(BaseQuerysetTest): # Excluding from a relation that cannot be NULL should not use outer joins. query = Item.objects.exclude(creator__in=[self.a1, self.a2]).query - self.assertNotIn(query.LOUTER, [x[2] for x in query.alias_map.values()]) + self.assertNotIn(LOUTER, [x.join_type for x in query.alias_map.values()]) # Similarly, when one of the joins cannot possibly, ever, involve NULL # values (Author -> ExtraInfo, in the following), it should never be @@ -344,7 +345,7 @@ class Queries1Tests(BaseQuerysetTest): # involve one "left outer" join (Author -> Item is 0-to-many). qs = Author.objects.filter(id=self.a1.id).filter(Q(extra__note=self.n1) | Q(item__note=self.n3)) self.assertEqual( - len([x[2] for x in qs.query.alias_map.values() if x[2] == query.LOUTER and qs.query.alias_refcount[x[1]]]), + len([x for x in qs.query.alias_map.values() if x.join_type == LOUTER and qs.query.alias_refcount[x.table_alias]]), 1 ) @@ -855,7 +856,7 @@ class Queries1Tests(BaseQuerysetTest): ) q = Note.objects.filter(Q(extrainfo__author=self.a1) | Q(extrainfo=xx)).query self.assertEqual( - len([x[2] for x in q.alias_map.values() if x[2] == q.LOUTER and q.alias_refcount[x[1]]]), + len([x for x in q.alias_map.values() if x.join_type == LOUTER and q.alias_refcount[x.table_alias]]), 1 ) |
