MCPcopy
hub / github.com/django/django / test_hash

Method test_hash

tests/queries/test_q.py:231–248  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

229 )
230
231 def test_hash(self):
232 self.assertEqual(hash(Q()), hash(Q()))
233 self.assertEqual(
234 hash(Q(("pk__in", (1, 2)))),
235 hash(Q(("pk__in", [1, 2]))),
236 )
237 self.assertEqual(
238 hash(Q(("pk__in", (1, 2)))),
239 hash(Q(pk__in=[1, 2])),
240 )
241 self.assertEqual(
242 hash(Q(("pk__in", (1, 2)))),
243 hash(Q(("pk__in", {1: "first", 2: "second"}.keys()))),
244 )
245 self.assertNotEqual(
246 hash(Q(name__iexact=F("other_name"))),
247 hash(Q(name=Lower(F("other_name")))),
248 )
249
250 def test_flatten(self):
251 q = Q()

Callers

nothing calls this directly

Calls 4

QClass · 0.90
FClass · 0.90
LowerClass · 0.90
keysMethod · 0.45

Tested by

no test coverage detected