Beispiel #1
0
 def testCase1(self):
     root = deserialize("2,1,3")
     invert = self.s.invertTree(root)
     expect = serialize(invert)
     self.assertEqual(expect, "2,3,1")
Beispiel #2
0
 def testCase3(self):
     root = deserialize("4,2,7,1,3,6,9")
     invert = self.s.invertTree(root)
     expect = serialize(invert)
     self.assertEqual(expect, "4,7,2,9,6,3,1")
Beispiel #3
0
 def test_case5(self):
     head = createListFromArray([1, 3])
     root = self.s.sortedListToBST(head)
     serialized_tree = serialize(root)
     self.assertEqual(serialized_tree, '3,1')
Beispiel #4
0
 def testCase2(self):
     root = deserialize("")
     invert = self.s.invertTree(root)
     expect = serialize(invert)
     self.assertEqual(expect, "")
Beispiel #5
0
 def test_case1(self):
     head = createListFromArray([-10, -3, 0, 5, 9])
     root = self.s.sortedListToBST(head)
     serialized_tree = serialize(root)
     self.assertEqual(serialized_tree, '0,-3,9,-10,null,5')