def test_invalid_amount_of_operands(self):
        with pytest.raises(TypeError) as e:
            node = CombinationNode()
            node.append(PrimitiveNode(add))
            node.eval()

        assert "combination needs to have at least two operands" in str(e.value)
    def test_invalid_operator(self):
        with pytest.raises(TypeError) as e:
            node = CombinationNode()
            for i in range(3):
                node.append(PrimitiveNode(1))
            node.eval()

        assert "operator not found" in str(e.value)
 def test_eval_with_node(self):
     node = RootNode()
     combination = CombinationNode()
     combination.append(PrimitiveNode(add))
     combination.append(PrimitiveNode(1))
     combination.append(PrimitiveNode(2))
     node.append(combination)
     assert 3 == node.eval()
 def test_eval_two_operands(self):
     node = CombinationNode()
     node.append(PrimitiveNode(add))
     node.append(PrimitiveNode(1))
     node.append(PrimitiveNode(2))
     assert 3 == node.eval()