MCPcopy
hub / github.com/django/django / test_q_annotation

Method test_q_annotation

tests/queries/test_query.py:183–191  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

181
182 @skipUnlessDBFeature("supports_boolean_expr_in_select_clause")
183 def test_q_annotation(self):
184 query = Query(None)
185 check = ExpressionWrapper(
186 Q(RawSQL("%s = 1", (1,), BooleanField())) | Q(Exists(Item.objects.all())),
187 BooleanField(),
188 )
189 query.add_annotation(check, "_check")
190 result = query.get_compiler(using=DEFAULT_DB_ALIAS).execute_sql(SINGLE)
191 self.assertEqual(result[0], 1)
192
193 def test_names_to_path_field(self):
194 query = Query(None)

Callers

nothing calls this directly

Calls 10

add_annotationMethod · 0.95
get_compilerMethod · 0.95
QueryClass · 0.90
ExpressionWrapperClass · 0.90
QClass · 0.90
RawSQLClass · 0.90
BooleanFieldClass · 0.90
ExistsClass · 0.90
allMethod · 0.45
execute_sqlMethod · 0.45

Tested by

no test coverage detected