From 7515f6576b593c5f7a1ff2b2f934d5442b52b884 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Wed, 8 Aug 2012 07:37:10 -0700 Subject: [PATCH] Fix TestCase.assertQuerysetEqual on python 3, this is needed for a large number of tests --- django/test/testcases.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/django/test/testcases.py b/django/test/testcases.py index 3a0dc760c69..56ba56caf12 100644 --- a/django/test/testcases.py +++ b/django/test/testcases.py @@ -796,9 +796,10 @@ class TransactionTestCase(SimpleTestCase): " the response" % template_name) def assertQuerysetEqual(self, qs, values, transform=repr, ordered=True): + items = six.moves.map(transform, qs) if not ordered: - return self.assertEqual(set(map(transform, qs)), set(values)) - return self.assertEqual(map(transform, qs), values) + return self.assertEqual(set(items), set(values)) + return self.assertEqual(list(items), values) def assertNumQueries(self, num, func=None, *args, **kwargs): using = kwargs.pop("using", DEFAULT_DB_ALIAS)