def test_dict_to_node(self): dict_node = { 'text': 'node text', 'label': ['205', 'A'], 'node_type': 'appendix'} node = compiler.dict_to_node(dict_node) self.assertEqual( node, Node('node text', [], ['205', 'A'], None, 'appendix')) dict_node['tagged_text'] = '<E> Tagged </E> text.' node = compiler.dict_to_node(dict_node) actual_node = Node('node text', [], ['205', 'A'], None, 'appendix') actual_node.tagged_text = '<E> Tagged </E> text.' created_node = compiler.dict_to_node(dict_node) self.assertEqual(actual_node, created_node) self.assertEqual(actual_node.tagged_text, created_node.tagged_text) dict_node = { 'text': 'node text' } node = compiler.dict_to_node(dict_node) self.assertEqual(node, dict_node)
def test_dict_to_node(self): dict_node = {"text": "node text", "label": ["205", "A"], "node_type": "appendix"} node = compiler.dict_to_node(dict_node) self.assertEqual(node, Node("node text", [], ["205", "A"], None, "appendix")) dict_node["tagged_text"] = "<E> Tagged </E> text." node = compiler.dict_to_node(dict_node) actual_node = Node("node text", [], ["205", "A"], None, "appendix") actual_node.tagged_text = "<E> Tagged </E> text." created_node = compiler.dict_to_node(dict_node) self.assertEqual(actual_node, created_node) self.assertEqual(actual_node.tagged_text, created_node.tagged_text) dict_node = {"text": "node text"} node = compiler.dict_to_node(dict_node) self.assertEqual(node, dict_node)