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. Fuzzy testing with assertNumQueries by spookylukey 1 year ago
  2. Decorator and context manager to override settings by jezdez 8 months, 4 weeks ago
  3. "Zoom in" on rendered HTML that the test client returns by peterbe 2 years, 9 months ago
  4. Multiple querysets by t_rybik 1 year, 11 months ago
  5. FieldLevelPermissionsAdmin by buriy 4 years, 5 months ago

Comments

(Forgotten your password?)