def test_example_5(self): expected_tree = Node('root', Node('left'), Node('right')) expected_string = '(root(left()())(right()()))' actual_string = serialize(expected_tree) actual_tree = deserialize(expected_string) self.assertEqual(expected_string, actual_string) self.assertEqual(repr(expected_tree), repr(actual_tree))
def test_example_1(self): expected_tree = None expected_string = '()' actual_string = serialize(expected_tree) actual_tree = deserialize(expected_string) self.assertEqual(expected_string, actual_string) self.assertEqual(repr(expected_tree), repr(actual_tree))
def test_example_2(self): expected_tree = Node('root') expected_string = '(root()())' actual_string = serialize(expected_tree) actual_tree = deserialize(expected_string) self.assertEqual(expected_string, actual_string) self.assertEqual(repr(expected_tree), repr(actual_tree))