From eda12ceef16aa1a98567e25be619b05a5b3c5757 Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Sat, 16 May 2015 09:15:54 -0400 Subject: [PATCH] Removed redundant list() calls. --- django/db/models/query_utils.py | 2 +- tests/httpwrappers/tests.py | 8 ++++---- tests/utils_tests/test_datastructures.py | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/django/db/models/query_utils.py b/django/db/models/query_utils.py index b1eac58bd9..b6caec386c 100644 --- a/django/db/models/query_utils.py +++ b/django/db/models/query_utils.py @@ -229,7 +229,7 @@ def deferred_class_factory(model, attrs): # class won't be created (we get an exception). Therefore, we generate # the name using the passed in attrs. It's OK to reuse an existing class # object if the attrs are identical. - name = "%s_Deferred_%s" % (model.__name__, '_'.join(sorted(list(attrs)))) + name = "%s_Deferred_%s" % (model.__name__, '_'.join(sorted(attrs))) name = utils.truncate_name(name, 80, 32) try: diff --git a/tests/httpwrappers/tests.py b/tests/httpwrappers/tests.py index 25da7b622c..a51609097f 100644 --- a/tests/httpwrappers/tests.py +++ b/tests/httpwrappers/tests.py @@ -140,13 +140,13 @@ class QueryDictTests(unittest.TestCase): self.assertTrue(q.has_key('foo')) self.assertIn('foo', q) - self.assertListEqual(sorted(list(six.iteritems(q))), + self.assertListEqual(sorted(six.iteritems(q)), [('foo', 'another'), ('name', 'john')]) - self.assertListEqual(sorted(list(six.iterlists(q))), + self.assertListEqual(sorted(six.iterlists(q)), [('foo', ['bar', 'baz', 'another']), ('name', ['john'])]) - self.assertListEqual(sorted(list(six.iterkeys(q))), + self.assertListEqual(sorted(six.iterkeys(q)), ['foo', 'name']) - self.assertListEqual(sorted(list(six.itervalues(q))), + self.assertListEqual(sorted(six.itervalues(q)), ['another', 'john']) q.update({'foo': 'hello'}) diff --git a/tests/utils_tests/test_datastructures.py b/tests/utils_tests/test_datastructures.py index 8562cd0d42..c0ed3435eb 100644 --- a/tests/utils_tests/test_datastructures.py +++ b/tests/utils_tests/test_datastructures.py @@ -32,12 +32,12 @@ class MultiValueDictTests(SimpleTestCase): self.assertEqual(d.get('name'), 'Simon') self.assertEqual(d.getlist('name'), ['Adrian', 'Simon']) self.assertEqual( - sorted(list(six.iteritems(d))), + sorted(six.iteritems(d)), [('name', 'Simon'), ('position', 'Developer')] ) self.assertEqual( - sorted(list(six.iterlists(d))), + sorted(six.iterlists(d)), [('name', ['Adrian', 'Simon']), ('position', ['Developer'])] ) @@ -52,7 +52,7 @@ class MultiValueDictTests(SimpleTestCase): d.setlist('lastname', ['Holovaty', 'Willison']) self.assertEqual(d.getlist('lastname'), ['Holovaty', 'Willison']) - self.assertEqual(sorted(list(six.itervalues(d))), + self.assertEqual(sorted(six.itervalues(d)), ['Developer', 'Simon', 'Willison']) def test_appendlist(self):