MCPcopy
hub / github.com/django/django / test_coalesce_idempotent

Method test_coalesce_idempotent

tests/db_functions/text/test_concat.py:82–89  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

80 "SQLite and PostgreSQL specific implementation detail.",
81 )
82 def test_coalesce_idempotent(self):
83 pair = ConcatPair(V("a"), V("b"))
84 # Check nodes counts
85 self.assertEqual(len(list(pair.flatten())), 3)
86 self.assertEqual(
87 len(list(pair.coalesce().flatten())), 7
88 ) # + 2 Coalesce + 2 Value()
89 self.assertEqual(len(list(pair.flatten())), 3)
90
91 def test_sql_generation_idempotency(self):
92 qs = Article.objects.annotate(description=Concat("title", V(": "), "summary"))

Callers

nothing calls this directly

Calls 3

coalesceMethod · 0.95
ConcatPairClass · 0.90
flattenMethod · 0.45

Tested by

no test coverage detected