summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAdam Johnson <me@adamj.eu>2024-02-23 22:50:09 +0000
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2024-02-26 05:38:31 +0100
commit73d5eb808435bcf27ebc935847196ac9e97b6ddc (patch)
tree5a51e44efa2d3dc92c29c6fa4f1001a11344a9df /tests
parent6e1ece7ed522c904a674966fa985159b7bbf1545 (diff)
Fixed #35241 -- Cached model's full parent list.
co-authored-by: Keryn Knight <keryn@kerynknight.com> co-authored-by: Natalia <124304+nessita@users.noreply.github.com> co-authored-by: David Smith <smithdc@gmail.com> co-authored-by: Paolo Melchiorre <paolo@melchiorre.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/model_meta/tests.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/tests/model_meta/tests.py b/tests/model_meta/tests.py
index fef82661cd..0aa04d760d 100644
--- a/tests/model_meta/tests.py
+++ b/tests/model_meta/tests.py
@@ -325,15 +325,19 @@ class RelationTreeTests(SimpleTestCase):
)
-class ParentListTests(SimpleTestCase):
- def test_get_parent_list(self):
- self.assertEqual(CommonAncestor._meta.get_parent_list(), [])
- self.assertEqual(FirstParent._meta.get_parent_list(), [CommonAncestor])
- self.assertEqual(SecondParent._meta.get_parent_list(), [CommonAncestor])
+class AllParentsTests(SimpleTestCase):
+ def test_all_parents(self):
+ self.assertEqual(CommonAncestor._meta.all_parents, ())
+ self.assertEqual(FirstParent._meta.all_parents, (CommonAncestor,))
+ self.assertEqual(SecondParent._meta.all_parents, (CommonAncestor,))
self.assertEqual(
- Child._meta.get_parent_list(), [FirstParent, SecondParent, CommonAncestor]
+ Child._meta.all_parents,
+ (FirstParent, SecondParent, CommonAncestor),
)
+ def test_get_parent_list(self):
+ self.assertEqual(Child._meta.get_parent_list(), list(Child._meta.all_parents))
+
class PropertyNamesTests(SimpleTestCase):
def test_person(self):