File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ def tree(self):
36
36
connect_branch = (
37
37
lines
38
38
+ self .ansi_for_tree ["CHILD_OBJECT_ANSI" ]
39
+ + f"{ position } . "
39
40
+ i
40
41
+ "\n "
41
42
+ self .ansi_for_tree ["RESET" ]
@@ -44,7 +45,11 @@ def tree(self):
44
45
connector_display = connector_root if position == 0 else connect_branch
45
46
46
47
sys .stdout .write (connector_display )
47
- sys .stdout .write (str (" " + self .ansi_for_tree ["VERTICAL_LINE" ] + "\n " ))
48
+
49
+ if position == (len (self .functions_flow ) - 1 ):
50
+ return
51
+
52
+ sys .stdout .write (str (" " + self .ansi_for_tree ["VERTICAL_LINE" ]))
48
53
sys .stdout .flush ()
49
54
position += 1
50
55
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ def setUp(self):
28
28
29
29
@patch ("sys.stdout" , new_callable = StringIO )
30
30
def test_display_tree_positive_input (self , stdout ):
31
- expected_result = " \x1b [38;5;208mtest2\x1b [0m\n │\n \n │──\x1b [36m__init__ \n \x1b [0m │\n \n │──\x1b [36mfunc1 \n \x1b [0m │\n \n │──\x1b [36mfunc2 \n \x1b [0m │ \n "
31
+ expected_result = " \x1b [38;5;208mtest2\x1b [0m\n │\n │──\x1b [36m1. __init__ \n \x1b [0m │\n │──\x1b [36m2. func1 \n \x1b [0m │\n │──\x1b [36m3. func2 \n \x1b [0m"
32
32
self .parser .tree ()
33
33
self .assertEqual (stdout .getvalue (), expected_result )
34
34
You can’t perform that action at this time.
0 commit comments