Skip to content

Commit

Permalink
Fix multi-table inheritance test
Browse files Browse the repository at this point in the history
  • Loading branch information
Suor committed May 20, 2023
1 parent 801b0fa commit bdea2d0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
8 changes: 7 additions & 1 deletion tests/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,13 @@ class NoProfileChild(AbsNoProfile):
pass


class Mess(Post, Category):
class ParentId(models.Model):
pass

class ParentStr(models.Model):
name = models.CharField(max_length=128, primary_key=True)

class Mess(ParentId, ParentStr):
pass

class MessChild(Mess):
Expand Down
5 changes: 3 additions & 2 deletions tests/test_extras.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,8 @@ def test_db_agnostic_disabled(self):
def test_model_family():
from cacheops.utils import model_family
from .models import Abs, Concrete1, AbsChild, Concrete2
from .models import NoProfile, NoProfileProxy, AbsNoProfile, NoProfileChild, Mess, MessChild
from .models import NoProfile, NoProfileProxy, AbsNoProfile, NoProfileChild
from .models import ParentId, ParentStr, Mess, MessChild

# Abstract models do not have family, children of an abstract model are not a family
assert model_family(Abs) == set()
Expand All @@ -203,4 +204,4 @@ def test_model_family():
assert model_family(NoProfileChild) == {NoProfile, NoProfileProxy, NoProfileChild}

# The worst of multiple inheritance
assert model_family(Mess) == {Mess, MessChild, Post, Category}
assert model_family(Mess) == {Mess, MessChild, ParentId, ParentStr}

0 comments on commit bdea2d0

Please sign in to comment.