diff options
author | Nick Pope <nick.pope@flightdataservices.com> | 2019-02-05 11:22:08 +0000 |
---|---|---|
committer | Tim Graham <timograham@gmail.com> | 2019-02-06 13:48:39 -0500 |
commit | 24b82cd201e21060fbc02117dc16d1702877a1f3 (patch) | |
tree | 7d36db9251700d0abf8fbf69399c8abc7fd9026a /tests/extra_regress | |
parent | 21bb71ef0dcb86798edb0d8b21138bcc4b947590 (diff) | |
download | django-24b82cd201e21060fbc02117dc16d1702877a1f3.tar.gz |
Fixed #30159 -- Removed unneeded use of OrderedDict.
Dicts preserve order since Python 3.6.
Diffstat (limited to 'tests/extra_regress')
-rw-r--r-- | tests/extra_regress/tests.py | 40 |
1 files changed, 18 insertions, 22 deletions
diff --git a/tests/extra_regress/tests.py b/tests/extra_regress/tests.py index 67625235f4..01bedcbbeb 100644 --- a/tests/extra_regress/tests.py +++ b/tests/extra_regress/tests.py @@ -1,5 +1,4 @@ import datetime -from collections import OrderedDict from django.contrib.auth.models import User from django.test import TestCase @@ -73,10 +72,7 @@ class ExtraRegressTests(TestCase): # Extra select parameters should stay tied to their corresponding # select portions. Applies when portions are updated or otherwise # moved around. - qs = User.objects.extra( - select=OrderedDict((("alpha", "%s"), ("beta", "2"), ("gamma", "%s"))), - select_params=(1, 3) - ) + qs = User.objects.extra(select={'alpha': '%s', 'beta': "2", 'gamma': '%s'}, select_params=(1, 3)) qs = qs.extra(select={"beta": 4}) qs = qs.extra(select={"alpha": "%s"}, select_params=[5]) self.assertEqual( @@ -184,7 +180,7 @@ class ExtraRegressTests(TestCase): self.assertEqual( list( TestObject.objects - .extra(select=OrderedDict((('foo', 'first'), ('bar', 'second'), ('whiz', 'third')))) + .extra(select={'foo': 'first', 'bar': 'second', 'whiz': 'third'}) .values() ), [{ @@ -198,7 +194,7 @@ class ExtraRegressTests(TestCase): list( TestObject.objects .values() - .extra(select=OrderedDict((('foo', 'first'), ('bar', 'second'), ('whiz', 'third')))) + .extra(select={'foo': 'first', 'bar': 'second', 'whiz': 'third'}) ), [{ 'bar': 'second', 'third': 'third', 'second': 'second', 'whiz': 'third', 'foo': 'first', @@ -210,7 +206,7 @@ class ExtraRegressTests(TestCase): self.assertEqual( list( TestObject.objects - .extra(select=OrderedDict((('foo', 'first'), ('bar', 'second'), ('whiz', 'third')))) + .extra(select={'foo': 'first', 'bar': 'second', 'whiz': 'third'}) .values('first', 'second') ), [{'second': 'second', 'first': 'first'}] @@ -221,7 +217,7 @@ class ExtraRegressTests(TestCase): list( TestObject.objects .values('first', 'second') - .extra(select=OrderedDict((('foo', 'first'), ('bar', 'second'), ('whiz', 'third')))) + .extra(select={'foo': 'first', 'bar': 'second', 'whiz': 'third'}) ), [{'second': 'second', 'first': 'first'}] ) @@ -230,7 +226,7 @@ class ExtraRegressTests(TestCase): self.assertEqual( list( TestObject.objects - .extra(select=OrderedDict((('foo', 'first'), ('bar', 'second'), ('whiz', 'third')))) + .extra(select={'foo': 'first', 'bar': 'second', 'whiz': 'third'}) .values('first', 'second', 'foo') ), [{'second': 'second', 'foo': 'first', 'first': 'first'}] @@ -240,7 +236,7 @@ class ExtraRegressTests(TestCase): self.assertEqual( list( TestObject.objects - .extra(select=OrderedDict((('foo', 'first'), ('bar', 'second'), ('whiz', 'third')))) + .extra(select={'foo': 'first', 'bar': 'second', 'whiz': 'third'}) .values('foo', 'whiz') ), [{'foo': 'first', 'whiz': 'third'}] @@ -251,7 +247,7 @@ class ExtraRegressTests(TestCase): self.assertEqual( list( TestObject.objects - .extra(select=OrderedDict((('foo', 'first'), ('bar', 'second'), ('whiz', 'third')))) + .extra(select={'foo': 'first', 'bar': 'second', 'whiz': 'third'}) .values_list() ), [('first', 'second', 'third', obj.pk, 'first', 'second', 'third')] @@ -262,7 +258,7 @@ class ExtraRegressTests(TestCase): list( TestObject.objects .values_list() - .extra(select=OrderedDict((('foo', 'first'), ('bar', 'second'), ('whiz', 'third')))) + .extra(select={'foo': 'first', 'bar': 'second', 'whiz': 'third'}) ), [('first', 'second', 'third', obj.pk, 'first', 'second', 'third')] ) @@ -271,7 +267,7 @@ class ExtraRegressTests(TestCase): self.assertEqual( list( TestObject.objects - .extra(select=OrderedDict((('foo', 'first'), ('bar', 'second'), ('whiz', 'third')))) + .extra(select={'foo': 'first', 'bar': 'second', 'whiz': 'third'}) .values_list('first', 'second') ), [('first', 'second')] @@ -282,7 +278,7 @@ class ExtraRegressTests(TestCase): list( TestObject.objects .values_list('first', 'second') - .extra(select=OrderedDict((('foo', 'first'), ('bar', 'second'), ('whiz', 'third')))) + .extra(select={'foo': 'first', 'bar': 'second', 'whiz': 'third'}) ), [('first', 'second')] ) @@ -290,7 +286,7 @@ class ExtraRegressTests(TestCase): self.assertEqual( list( TestObject.objects - .extra(select=OrderedDict((('foo', 'first'), ('bar', 'second'), ('whiz', 'third')))) + .extra(select={'foo': 'first', 'bar': 'second', 'whiz': 'third'}) .values_list('second', flat=True) ), ['second'] @@ -300,7 +296,7 @@ class ExtraRegressTests(TestCase): self.assertEqual( list( TestObject.objects - .extra(select=OrderedDict((('foo', 'first'), ('bar', 'second'), ('whiz', 'third')))) + .extra(select={'foo': 'first', 'bar': 'second', 'whiz': 'third'}) .values_list('first', 'second', 'whiz') ), [('first', 'second', 'third')] @@ -310,7 +306,7 @@ class ExtraRegressTests(TestCase): self.assertEqual( list( TestObject.objects - .extra(select=OrderedDict((('foo', 'first'), ('bar', 'second'), ('whiz', 'third')))) + .extra(select={'foo': 'first', 'bar': 'second', 'whiz': 'third'}) .values_list('foo', 'whiz') ), [('first', 'third')] @@ -319,7 +315,7 @@ class ExtraRegressTests(TestCase): self.assertEqual( list( TestObject.objects - .extra(select=OrderedDict((('foo', 'first'), ('bar', 'second'), ('whiz', 'third')))) + .extra(select={'foo': 'first', 'bar': 'second', 'whiz': 'third'}) .values_list('whiz', flat=True) ), ['third'] @@ -329,7 +325,7 @@ class ExtraRegressTests(TestCase): self.assertEqual( list( TestObject.objects - .extra(select=OrderedDict((('foo', 'first'), ('bar', 'second'), ('whiz', 'third')))) + .extra(select={'foo': 'first', 'bar': 'second', 'whiz': 'third'}) .values_list('whiz', 'foo') ), [('third', 'first')] @@ -338,7 +334,7 @@ class ExtraRegressTests(TestCase): self.assertEqual( list( TestObject.objects - .extra(select=OrderedDict((('foo', 'first'), ('bar', 'second'), ('whiz', 'third')))) + .extra(select={'foo': 'first', 'bar': 'second', 'whiz': 'third'}) .values_list('first', 'id') ), [('first', obj.pk)] @@ -347,7 +343,7 @@ class ExtraRegressTests(TestCase): self.assertEqual( list( TestObject.objects - .extra(select=OrderedDict((('foo', 'first'), ('bar', 'second'), ('whiz', 'third')))) + .extra(select={'foo': 'first', 'bar': 'second', 'whiz': 'third'}) .values_list('whiz', 'first', 'bar', 'id') ), [('third', 'first', 'second', obj.pk)] |