"""Basic test file for the {module} module. DO NOT EDIT

This test file ensures that {module}.{class_name} is instanciable and
a subclass of half_orm.relation.Relation

Fixtures are provided by tests/conftest.py
"""

from half_orm.relation import Relation
from {module} import {class_name}


async def test_instanciate_relation():
    """It should instanciate {class_name}."""
    {class_name}()


async def test_is_relation(relation_class):
    """
    {class_name} should be a subclass of half_orm.Relation.

    Uses relation_class fixture from tests/conftest.py
    """
    assert issubclass({class_name}, relation_class)


async def test_fkeys():
    """Each FK alias defined in Fkeys should point to a valid constraint and return a Relation."""
    rel = {class_name}()
    fkeys = getattr({class_name}, 'Fkeys', {{}})
    ho_fkeys = rel._ho_fkeys
    for alias, constraint in fkeys.items():
        assert constraint in ho_fkeys, (
            f"{{constraint!r}} (alias {{alias!r}}) is not a valid FK of {class_name}"
        )
        assert isinstance(rel.__dict__[alias](), Relation), (
            f"{{alias!r}} is not a Relation (got {{type(rel.__dict__[alias]())}})"
        )