Skip to content

Commit

Permalink
test_tree.py: Test better the node representation.
Browse files Browse the repository at this point in the history
  • Loading branch information
jordibc committed Nov 20, 2023
1 parent 1fff062 commit e5de02d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tests/test_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,13 @@ def test_tree_read_and_write(self):
self.assertEqual(expected_nw, t.write(props=None))

def test_repr(self):
# Node instance repr
self.assertTrue(Tree().__repr__().startswith('<Tree'))
self.assertTrue(('%r' % Tree()).startswith('<Tree'))
"""Test that the Tree representation looks like we expect."""
t = Tree()
r1, r2, r3 = t.__repr__(), repr(t), '%r' % t
self.assertTrue(r1 == r2 == r3)
self.assertTrue(r1.startswith('<Tree '))
self.assertTrue(r1.endswith('>'))
self.assertTrue(' at 0x' in r1)

def test_to_str(self):
"""Test that the ascii representation (to use when printing) works."""
Expand Down

0 comments on commit e5de02d

Please sign in to comment.