assertQuerysetEqual

1
2
3
4
5
6
7
8
9
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))
        )

More like this

  1. Chain multiple querysets into one by mattdw 5 years, 6 months ago
  2. Case-insensitive lookup by default by sciyoshi 6 years, 9 months ago
  3. Lightweight querysets by sardarnl 10 months ago
  4. Improved Pickled Object Field by taavi223 4 years, 8 months ago
  5. Yet another query string template tag by atms 3 years ago

Comments

(Forgotten your password?)