def test_render_inner_text(self): """ Test the ``render_inner_text`` function """ root_tree_node = RootTreeNode() tree_node_l1 = root_tree_node.new_child('level1', get_test_node('level1-1')) root_tree_node.new_child('level1', get_test_node('level1-2')) tree_node_l2 = tree_node_l1.new_child('level2', get_test_node('level2-1')) tree_node_l1.new_child('level2', get_test_node('level2-2')) root_tree_node.new_child('level1', get_test_node('level1-3')) tree_node_l2.new_child('level3', get_test_node('level3-1')) tree_node_l2.new_child('level3', get_test_node('level3-2')) tree_node_l1.new_child('level2', get_test_node('level2-3')) output = render_inner_text(tree_node_l2, some_custom_kwarg='foobar') expected_output = '[TEXT+level3-1][/TEXT]' \ '[TEXT+level3-2][/TEXT]' self.assertEqual(expected_output, output)
def test_render_inner_text_with_error(self): """ Test the ``render_inner_text`` function with erroneous node """ root_tree_node = RootTreeNode() tree_node_l1 = root_tree_node.new_child('level1', get_test_node('level1-1')) root_tree_node.new_child('level1', get_test_node('level1-2')) tree_node_l2 = tree_node_l1.new_child('level2', get_test_node('level2-1')) tree_node_l1.new_child('level2', get_test_node('level2-2')) root_tree_node.new_child('level1', get_test_node('level1-3')) tree_node_l2.new_child('level3', get_test_node('level3-1'), source_open_tag='[test]', source_close_tag='[/test]', error_message='foo') tree_node_l2.new_child('level3', get_test_node('level3-2')) tree_node_l1.new_child('level2', get_test_node('level2-3')) output = render_inner_text(tree_node_l2, some_custom_kwarg='foobar') expected_output = '[test][/test]' \ '[TEXT+level3-2][/TEXT]' self.assertEqual(expected_output, output)