MCPcopy
hub / github.com/django/django / test_non_alias_cols_query

Method test_non_alias_cols_query

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

Source from the content-addressed store, hash-verified

33 self.assertEqual(lookup.lhs.target, Author._meta.get_field("num"))
34
35 def test_non_alias_cols_query(self):
36 query = Query(Author, alias_cols=False)
37 where = query.build_where(Q(num__gt=2, name__isnull=False) | Q(num__lt=F("id")))
38
39 name_isnull_lookup, num_gt_lookup = where.children[0].children
40 self.assertIsInstance(num_gt_lookup, GreaterThan)
41 self.assertIsInstance(num_gt_lookup.lhs, Col)
42 self.assertIsNone(num_gt_lookup.lhs.alias)
43 self.assertIsInstance(name_isnull_lookup, IsNull)
44 self.assertIsInstance(name_isnull_lookup.lhs, Col)
45 self.assertIsNone(name_isnull_lookup.lhs.alias)
46
47 num_lt_lookup = where.children[1]
48 self.assertIsInstance(num_lt_lookup, LessThan)
49 self.assertIsInstance(num_lt_lookup.rhs, Col)
50 self.assertIsNone(num_lt_lookup.rhs.alias)
51 self.assertIsInstance(num_lt_lookup.lhs, Col)
52 self.assertIsNone(num_lt_lookup.lhs.alias)
53
54 def test_complex_query(self):
55 query = Query(Author)

Callers

nothing calls this directly

Calls 4

build_whereMethod · 0.95
QueryClass · 0.90
QClass · 0.90
FClass · 0.90

Tested by

no test coverage detected