# Path: tests/models.py
# class Animal(Model, poly=True):
#     endangered = props.Bool(default=False)
#     birthday = props.DateTime(indexed=True, auto_now_add=True)
# 
# class Mammal(Animal):
#     hair_color = props.String(default="black")
#     name = props.String()
# 
# class Bird(Animal):
#     flightless = props.Bool(default=False)


from .models import Animal, Mammal, Bird


def test_polymorphic_entitites_share_the_same_root_kind(cat, human, eagle):
    assert [e.key.kind for e in (cat, human, eagle)] == ["Animal"] * 3


def test_polymorphic_models_can_be_queried_via_their_root_model(cat, human, eagle):

# Path: tests/models.py
# class Animal(Model, poly=True):
#     endangered = props.Bool(default=False)
#     birthday = props.DateTime(indexed=True, auto_now_add=True)
# 
# class Mammal(Animal):
#     hair_color = props.String(default="black")
#     name = props.String()
# 
# class Bird(Animal):
#     flightless = props.Bool(default=False)


# Path: tests/test_models_polymporphism.py
from .models import Animal, Mammal, Bird



def test_polymorphic_entitites_share_the_same_root_kind(cat, human, eagle):
    assert [e.key.kind for e in (cat, human, eagle)] == ["Animal"] * 3


def test_polymorphic_models_can_be_queried_via_their_root_model(cat, human, eagle):

    animals = Animal.query().order_by(+Animal.birthday).run()