from django.test import TestCase class BaseTestCase(TestCase): def assertQuerysetEqual(self, qs1, qs2): pk = lambda o: o.pk return self.assertEqual( list(sorted(qs1, key=pk)), list(sorted(qs2, key=pk)) )