Exemplo n.º 1
0
def test_merge_with_one_shorter_valid(one_four_ll, a_b_cap_ll):
    """
    test merge list function where second list is shorter
    """
    merge_lists(one_four_ll, a_b_cap_ll)
    # assert one_four_ll.head.val == 1
    assert one_four_ll.head._next._next._next._next.val == 3
Exemplo n.º 2
0
def test_merge_with_one_empty_list_switched(one_four_ll, empty_ll):
    """
    test merge list function with one empty linked list and one full linked list
    """
    merge_lists(empty_ll, one_four_ll)
    assert one_four_ll.head.val == 1
    assert one_four_ll.head._next.val == 2
Exemplo n.º 3
0
def test_merge_list_valid_switched(one_four_ll, a_d_ll):
    """
    test merge list function to ensure two lists when passed in are 'zipped' together
    """
    merge_lists(a_d_ll, one_four_ll)
    assert a_d_ll.head._next.val == 'a'
    assert a_d_ll.head.val.val == 1
Exemplo n.º 4
0
def test_merge_list_valid_switched_extended(one_four_ll, a_d_ll):
    """
    test merge list function to ensure two lists when passed in are 'zipped' together. traverse further along to check alternation
    """
    merge_lists(a_d_ll, one_four_ll)
    assert a_d_ll.head._next._next._next.val == 'b'
Exemplo n.º 5
0
def test_merge_list_valid(one_four_ll, a_d_ll):
    """
    test merge list function to ensure two lists when passed in are 'zipped' together
    """
    merge_lists(one_four_ll, a_d_ll)
    assert str(one_four_ll.head.val) == 'a'