11import pytest
22
3- from .factories import InheritanceFactory
3+ from .factories import InheritanceFactory , KlassFactory
44
55
66@pytest .mark .django_db
@@ -18,10 +18,11 @@ def test_linear(self) -> None:
1818
1919 C.__mro__ would be [C, B, A].
2020 """
21- b_child_of_a = InheritanceFactory .create (child__name = "b" , parent__name = "a" )
22- a = b_child_of_a .parent
23- b = b_child_of_a .child
24- c = InheritanceFactory .create (parent = b , child__name = "c" ).child
21+ a = KlassFactory .create (name = "a" )
22+ b = KlassFactory .create (name = "b" )
23+ c = KlassFactory .create (name = "c" )
24+ InheritanceFactory .create (parent = a , child = b )
25+ InheritanceFactory .create (parent = b , child = c )
2526
2627 mro = c .get_all_ancestors ()
2728
@@ -40,11 +41,13 @@ def test_diamond(self) -> None:
4041
4142 D.__mro__ would be [D, B, C, A].
4243 """
43- b_child_of_a = InheritanceFactory .create (child__name = "b" , parent__name = "a" )
44- a = b_child_of_a .parent
45- b = b_child_of_a .child
46- c = InheritanceFactory .create (parent = a , child__name = "c" ).child
47- d = InheritanceFactory .create (parent = b , child__name = "d" ).child
44+ a = KlassFactory .create (name = "a" )
45+ b = KlassFactory .create (name = "b" )
46+ c = KlassFactory .create (name = "c" )
47+ d = KlassFactory .create (name = "d" )
48+ InheritanceFactory .create (parent = a , child = b )
49+ InheritanceFactory .create (parent = a , child = c )
50+ InheritanceFactory .create (parent = b , child = d )
4851 InheritanceFactory .create (parent = c , child = d , order = 2 )
4952
5053 mro = d .get_all_ancestors ()
0 commit comments