Esempio n. 1
0
    def test_analyze_children_contains_zero(self):
        term_node_1 = Node(NodeType.CONSTANT, value=0.0)
        term_node_2 = Node(NodeType.CONSTANT, value=1.0)
        func_node = Node(NodeType.FUNCTION,
                         name="ADD",
                         arity=2,
                         branches=[term_node_1, term_node_2])

        result = editor.analyze_children(func_node)
        self.assertEquals(result, (True, False, False, True))
Esempio n. 2
0
    def test_analyze_children_inputs_only(self):
        term_node_1 = Node(NodeType.INPUT, name="x")
        term_node_2 = Node(NodeType.INPUT, name="y")
        func_node = Node(NodeType.FUNCTION,
                         name="ADD",
                         arity=2,
                         branches=[term_node_1, term_node_2])

        result = editor.analyze_children(func_node)
        self.assertEquals(result, (False, False, True, False))
Esempio n. 3
0
    def test_analyze_children_contains_zero(self):
        term_node_1 = Node(NodeType.CONSTANT, value=0.0)
        term_node_2 = Node(NodeType.CONSTANT, value=1.0)
        func_node = Node(
            NodeType.FUNCTION,
            name="ADD",
            arity=2,
            branches=[term_node_1, term_node_2]
        )

        result = editor.analyze_children(func_node)
        self.assertEquals(result, (True, False, False, True))
Esempio n. 4
0
    def test_analyze_children_inputs_only(self):
        term_node_1 = Node(NodeType.INPUT, name="x")
        term_node_2 = Node(NodeType.INPUT, name="y")
        func_node = Node(
            NodeType.FUNCTION,
            name="ADD",
            arity=2,
            branches=[term_node_1, term_node_2]
        )

        result = editor.analyze_children(func_node)
        self.assertEquals(result, (False, False, True, False))