from frametree.common import Clinical


def test_is_parent():
    assert not Clinical.session.is_parent(Clinical.session)
    assert not Clinical.session.is_parent(Clinical.subject)
    assert not Clinical.session.is_parent(Clinical.member)
    assert not Clinical.session.is_parent(Clinical.group)
    assert not Clinical.session.is_parent(Clinical.visit)
    assert not Clinical.session.is_parent(Clinical.groupedvisit)
    assert not Clinical.session.is_parent(Clinical.matchedvisit)
    assert not Clinical.session.is_parent(Clinical.constant)

    assert Clinical.member.is_parent(Clinical.session)
    assert Clinical.member.is_parent(Clinical.subject)
    assert not Clinical.member.is_parent(Clinical.member)
    assert not Clinical.member.is_parent(Clinical.group)
    assert not Clinical.member.is_parent(Clinical.visit)
    assert not Clinical.member.is_parent(Clinical.groupedvisit)
    assert Clinical.member.is_parent(Clinical.matchedvisit)
    assert not Clinical.member.is_parent(Clinical.constant)

    assert Clinical.group.is_parent(Clinical.session)
    assert Clinical.group.is_parent(Clinical.subject)
    assert not Clinical.group.is_parent(Clinical.member)
    assert not Clinical.group.is_parent(Clinical.group)
    assert not Clinical.group.is_parent(Clinical.visit)
    assert Clinical.group.is_parent(Clinical.groupedvisit)
    assert not Clinical.group.is_parent(Clinical.matchedvisit)
    assert not Clinical.group.is_parent(Clinical.constant)

    assert Clinical.visit.is_parent(Clinical.session)
    assert not Clinical.visit.is_parent(Clinical.subject)
    assert not Clinical.visit.is_parent(Clinical.member)
    assert not Clinical.visit.is_parent(Clinical.group)
    assert not Clinical.visit.is_parent(Clinical.visit)
    assert Clinical.visit.is_parent(Clinical.groupedvisit)
    assert Clinical.visit.is_parent(Clinical.matchedvisit)
    assert not Clinical.visit.is_parent(Clinical.constant)

    assert Clinical.subject.is_parent(Clinical.session)
    assert not Clinical.subject.is_parent(Clinical.subject)
    assert not Clinical.subject.is_parent(Clinical.member)
    assert not Clinical.subject.is_parent(Clinical.group)
    assert not Clinical.subject.is_parent(Clinical.visit)
    assert not Clinical.subject.is_parent(Clinical.groupedvisit)
    assert not Clinical.subject.is_parent(Clinical.matchedvisit)
    assert not Clinical.subject.is_parent(Clinical.constant)

    assert Clinical.groupedvisit.is_parent(Clinical.session)
    assert not Clinical.groupedvisit.is_parent(Clinical.subject)
    assert not Clinical.groupedvisit.is_parent(Clinical.member)
    assert not Clinical.groupedvisit.is_parent(Clinical.group)
    assert not Clinical.groupedvisit.is_parent(Clinical.visit)
    assert not Clinical.groupedvisit.is_parent(Clinical.groupedvisit)
    assert not Clinical.groupedvisit.is_parent(Clinical.matchedvisit)
    assert not Clinical.groupedvisit.is_parent(Clinical.constant)

    assert Clinical.matchedvisit.is_parent(Clinical.session)
    assert not Clinical.matchedvisit.is_parent(Clinical.subject)
    assert not Clinical.matchedvisit.is_parent(Clinical.member)
    assert not Clinical.matchedvisit.is_parent(Clinical.group)
    assert not Clinical.matchedvisit.is_parent(Clinical.visit)
    assert not Clinical.matchedvisit.is_parent(Clinical.groupedvisit)
    assert not Clinical.matchedvisit.is_parent(Clinical.matchedvisit)
    assert not Clinical.matchedvisit.is_parent(Clinical.constant)

    assert Clinical.constant.is_parent(Clinical.session)
    assert Clinical.constant.is_parent(Clinical.subject)
    assert Clinical.constant.is_parent(Clinical.member)
    assert Clinical.constant.is_parent(Clinical.group)
    assert Clinical.constant.is_parent(Clinical.visit)
    assert Clinical.constant.is_parent(Clinical.groupedvisit)
    assert Clinical.constant.is_parent(Clinical.matchedvisit)
    assert not Clinical.constant.is_parent(Clinical.constant)
