def test_edge_cases(): ll_one = LinkedList(["a", "b", "c", "d", "q"]) ll_two = LinkedList(["1", "2", "3"]) zipped = zip_lists(ll_one, ll_two) expected = ["a", "1", "b", "2", "c", "3", "d", "q"] while zipped: assert zipped.value == expected.pop(0) zipped = zipped.next
def test_can_return_an_error_(): newList = LinkedList() newList2 = LinkedList() answer = zip_lists(newList, newList2) expected = "Lists are empty" actual = answer assert expected == actual
def test_can_successfully_zip_two_linked_lists(): newList = LinkedList() newList.insert(5) newList.insert(3) newList.insert(1) newList2 = LinkedList() newList2.insert(6) newList2.insert(4) newList2.insert(2) answer = zip_lists(newList, newList2) expected = ['1', '2', '3', '4', '5', '6'] actual = [ answer.headVal.nodeVal, answer.headVal.nextVal.nodeVal, answer.headVal.nextVal.nextVal.nodeVal, answer.headVal.nextVal.nextVal.nextVal.nodeVal, answer.headVal.nextVal.nextVal.nextVal.nextVal.nodeVal, answer.headVal.nextVal.nextVal.nextVal.nextVal.nextVal.nodeVal ] assert expected == actual
def test_happy_zipped_list(): ll_one = LinkedList(["a", "b", "c"]) ll_two = LinkedList(["1", "2", "3"]) zipped = zip_lists(ll_one, ll_two) assert zipped.value == "a"
def test_no_value_ll_zip(): ll_one = LinkedList([]) ll_two = LinkedList([]) actual = zip_lists(ll_one, ll_two) expected = None assert actual == expected
def test_expect_epic_fail(): with pytest.raises(TypeError): zip_lists("1", 1)
def test_zip_lists_import(): assert zip_lists(ll1, ll2) == 'babies'