Fix TestCase.assertQuerysetEqual on python 3, this is needed for a large number of tests
This commit is contained in:
parent
4c97101b1f
commit
7515f6576b
|
@ -796,9 +796,10 @@ class TransactionTestCase(SimpleTestCase):
|
||||||
" the response" % template_name)
|
" the response" % template_name)
|
||||||
|
|
||||||
def assertQuerysetEqual(self, qs, values, transform=repr, ordered=True):
|
def assertQuerysetEqual(self, qs, values, transform=repr, ordered=True):
|
||||||
|
items = six.moves.map(transform, qs)
|
||||||
if not ordered:
|
if not ordered:
|
||||||
return self.assertEqual(set(map(transform, qs)), set(values))
|
return self.assertEqual(set(items), set(values))
|
||||||
return self.assertEqual(map(transform, qs), values)
|
return self.assertEqual(list(items), values)
|
||||||
|
|
||||||
def assertNumQueries(self, num, func=None, *args, **kwargs):
|
def assertNumQueries(self, num, func=None, *args, **kwargs):
|
||||||
using = kwargs.pop("using", DEFAULT_DB_ALIAS)
|
using = kwargs.pop("using", DEFAULT_DB_ALIAS)
|
||||||
|
|
Loading…
Reference in New Issue