Symmetric Binary Tree - Writing stubs and tests

Let's start by creating some unit test for the first function.

First, Let's write assert the takes level-based representation, build the tree and then assert that the binary tree is or is not symmetric as expected.

test_symmetric
 def assertSymetric(self, data: List[Union[int, None]], expected: bool ):
     root = tree.load(data)
     assert ( tree.symmetric(root) == expected )

Now, let's add some tests

test_symmetric
 def test_symetric(self):
     self.assertSymetric([], True)
     self.assertSymetric([0], True)
     self.assertSymetric([0, 1], False)
     self.assertSymetric([0, 1, None], False)
     self.assertSymetric([0, None, 1], False)
     self.assertSymetric([0, 1, 2], False)
     self.assertSymetric([0, 1, 1], True)

     self.assertSymetric([0, 1, 1, 3, 4, 4, 3], True)
     self.assertSymetric([0, 1, 1, 3, 4, 1, 3], False)
     self.assertSymetric([0, 1, 1, 3, 4, 4, 3, 1, 2, 3, 4, 4, 3, 2, 1], True)
     self.assertSymetric([0, 1, 1, 3, 4, 4, 3, 1, 2, 3, 4, 5, 3, 2, 1], False)
     self.assertSymetric([0, 1, 1, 3, 4, 4, 3, 1, 2, 3, 4, None, 3, 2, 1], False)
     self.assertSymetric([0, 1, 1, 3, 4, 4, 3, 1, 2, 3, None, None, 3, 2, 1], True)
     self.assertSymetric([0, 1, 1, 5, 2, 2, 5, None, None, 3, 3, 2], True)

Verify that the level-based representation is valid by drawing the binary tree

In the next part, we write the tree.symmetric