Ejemplo n.º 1
0
def test_two_sons(data):
    father = data.draw(name_strategy)
    first_son = data.draw(name_strategy)
    second_son = data.draw(name_strategy)

    assume(father != first_son)
    assume(father != second_son)
    assume(first_son != second_son)

    tree = [[father, first_son], [father, second_son]]

    assert is_family(tree), "Two sons of one father"
Ejemplo n.º 2
0
def test_father_and_son():
    assert is_family([["Alex", "Jake"]]), "Father and son"
Ejemplo n.º 3
0
def test_incorrect_args(tree):
    with pytest.raises(TypeError):
        is_family(tree)
Ejemplo n.º 4
0
def test_no_arguments():
    with pytest.raises(TypeError):
        is_family()
Ejemplo n.º 5
0
def test_empty_lists(tree):
    with pytest.raises(ValueError):
        is_family(tree)
Ejemplo n.º 6
0
def test_strangers_in_family():
    tree = [["Alex", "Jake"], ["Jake", "Ron"], ["Mario", "Luigi"]]
    assert not is_family(tree)
Ejemplo n.º 7
0
def test_father_to_brother():
    tree = [["Alex", "Jake"], ["Alex", "Ron"], ["Ron", "Jake"]]

    assert not is_family(tree), "Second brother is father of first brother"
Ejemplo n.º 8
0
def test_equal_names(name):
    father = son = name
    tree = [[father, son]]

    assert not is_family(tree), "Equal names"
Ejemplo n.º 9
0
def test_grandfather():
    tree = [["Alex", "Jake"], ["Alex", "William"], ["William", "Ron"]]
    assert is_family(tree), "Grandfather and grandson"