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. Decorator and context manager to override settings by jezdez 2 years, 1 month ago
  2. Google Geocode Lookup by tonyskyday 5 years, 12 months ago
  3. Dynamically insert or append a value to an admin option, e.g. list_display or list_filter by frankban 1 year, 10 months ago
  4. Dynamic query builder with AND/OR by bobwaycott 3 years, 9 months ago
  5. "Zoom in" on rendered HTML that the test client returns by peterbe 4 years, 1 month ago

Comments

(Forgotten your password?)