Ejemplo n.º 1
0
    def testcase_simple_tree(self, name_handle, children_handle, render_style,
                             root_item):
        """Tree with children references: (Tree() object, tree representation string, render style used)"""

        representation = {
            'strict':
            '''
                f
                └── e
                    ├── a
                    ├── b
                    │   └── c
                    └── d
                ''',
            'smooth':
            '''
                f
                ╰── e
                    ├── a
                    ├── b
                    │   ╰── c
                    ╰── d
                ''',
            'indent':
            '''
                f
                    e
                        a
                        b
                            c
                        d
                ''',
        }

        tree = Tree.convert(root_item, name_handle, children_handle)
        return tree, self.strip_indents(representation[render_style],
                                        4), render_style
Ejemplo n.º 2
0
 def test_invalid_children_handle(self, name_handle, children_handle,
                                  root_item):
     err_msg = r"children handle returned invalid result: expected List\[Item\], got 0"
     with raises(RuntimeError, match=err_msg):
         Tree.convert(root_item, name_handle, children_handle)
Ejemplo n.º 3
0
 def testcase_single_item_tree(self, name_handle, children_handle):
     """Tree of with 1 single node: (Tree() object, rendered tree string)"""
     item = self.Item('item', None)
     return Tree.convert(item, name_handle, children_handle), 'item'