Skip to content

Commit 6b694be

Browse files
committed
_show method to facilitate p2/p3 testing
1 parent 783a3fc commit 6b694be

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

lighttree/interactive.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ def __getitem__(self, item):
192192
r._expand_attrs(depth=1)
193193
return r
194194

195-
def __str__(self):
195+
def _show(self):
196196
tree_repr = self._tree.show()
197197
if self._root_path is None:
198198
return "<%s>\n%s" % (
@@ -205,3 +205,6 @@ def __str__(self):
205205
text(current_path),
206206
text(tree_repr),
207207
)
208+
209+
def __str__(self):
210+
return self._show()

tests/test_interactive.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ class InteractiveTree(TreeBasedObj):
192192

193193
# test representations
194194
self.assertEqual(
195-
obj.__str__(),
195+
obj._show(),
196196
"""<SomeCoolTree>
197197
root
198198
├── a
@@ -205,7 +205,7 @@ class InteractiveTree(TreeBasedObj):
205205
""",
206206
)
207207
self.assertEqual(
208-
a.__str__(),
208+
a._show(),
209209
"""<SomeCoolTree subpart: a>
210210
a
211211
├── a1
@@ -215,7 +215,7 @@ class InteractiveTree(TreeBasedObj):
215215
""",
216216
)
217217
self.assertEqual(
218-
a.a1.__str__(),
218+
a.a1._show(),
219219
"""<SomeCoolTree subpart: a.a1>
220220
a1
221221
├── a11

0 commit comments

Comments
 (0)