def test_empty():
    """ test 2 empty lists passed in"""
    L1 = LinkedList()
    L2 = LinkedList()
    actual = zip_lists(L1, L2)
    expected = 'cannot zip two empty lists'
    assert actual == expected
Esempio n. 2
0
def long_list():
    lists = LinkedList()
    lists.insert('i')
    lists.insert('g')
    lists.insert('e')
    lists.insert('c')
    lists.insert('a')
    return lists
Esempio n. 3
0
def list_two():
    lists = LinkedList()
    lists.insert('h')
    lists.insert('f')
    lists.insert('d')
    lists.insert('b')
    return lists
Esempio n. 4
0
def list_one():
    lists = LinkedList()
    lists.insert('g')
    lists.insert('e')
    lists.insert('c')
    lists.insert('a')
    return lists
def test_first_empty():
    """ test list 1 is empty """
    L1 = LinkedList()
    L2 = LinkedList()
    L2.insert(4)
    L2.insert(5)
    L2.insert(6)

    actual = str(zip_lists(L1, L2))
    expected = 'cannot zip into empty list'
    assert actual == expected
def test_second_empty():
    """ test list 2 is empty """
    L1 = LinkedList()
    L2 = LinkedList()
    L1.insert(1)
    L1.insert(2)
    L1.insert(3)

    actual = str(zip_lists(L1, L2))
    expected = 'list 2 empty; list 1 unchanged'
    assert actual == expected
def test_happy():
    """ test 2 lists of equal length """
    L1 = LinkedList()
    L2 = LinkedList()
    L1.insert(1)
    L2.insert(1)
    L1.insert(2)
    L2.insert(2)
    L1.insert(3)
    L2.insert(3)

    actual = str(zip_lists(L1, L2))
    expected = '{ 3 } -> { 3 } -> { 2 } -> { 2 } -> { 1 } -> { 1 } -> NULL'
    assert actual == expected