def test_subtract_given_addition_given_addition_to_string(): """. Tree node class str.""" tree = Sub(Sub(Leaf(5), Leaf(6)), Sub(Leaf(5), Leaf(6))) assert tree.__str__() == "(5 - 6) - (5 - 6)"
def test_subtraction_with_leaves_to_class_string(): """.""" print(Sub(Leaf(5), Leaf(6)).class_str()) assert eval(Sub(Leaf(5), Leaf(6)).class_str()).apply() == -1
def test_subtraction_with_leaves_to_string(): """.""" tree = Sub(Leaf(5), Leaf(6)) assert tree.apply() == -1 assert tree.__str__() == "5 - 6"
def test_subtract_subtracts_when_given_leaves_with_numbers(): """.""" assert Sub(Leaf(5), Leaf(6)).apply() == -1