def test_zipwith_node_leaf(): bt1 = Node(1, Leaf(2), Leaf(3)) bt2 = Leaf(2) with pytest.raises(AssertionError): bt1.map2(fun.add, bt2)
def test_zipwith_node(): bt1 = Node(1, Leaf(2), Leaf(3)) bt2 = Node(4, Leaf(5), Leaf(6)) exp = Node(5, Leaf(7), Leaf(9)) res = bt1.map2(fun.add, bt2) assert exp == res