MCPcopy
hub / github.com/django/django / test_same_manager_queries

Method test_same_manager_queries

tests/proxy_models/tests.py:40–53  ·  view source on GitHub ↗

The MyPerson model should be generating the same database queries as the Person model (when the same manager is used in each case).

(self)

Source from the content-addressed store, hash-verified

38
39class ProxyModelTests(TestCase):
40 def test_same_manager_queries(self):
41 """
42 The MyPerson model should be generating the same database queries as
43 the Person model (when the same manager is used in each case).
44 """
45 my_person_sql = (
46 MyPerson.other.all().query.get_compiler(DEFAULT_DB_ALIAS).as_sql()
47 )
48 person_sql = (
49 Person.objects.order_by("name")
50 .query.get_compiler(DEFAULT_DB_ALIAS)
51 .as_sql()
52 )
53 self.assertEqual(my_person_sql, person_sql)
54
55 def test_inheritance_new_table(self):
56 """

Callers

nothing calls this directly

Calls 4

get_compilerMethod · 0.80
order_byMethod · 0.80
as_sqlMethod · 0.45
allMethod · 0.45

Tested by

no test coverage detected