def test_balancer_left_right_rotation1(self):
     set = UnbalancedSet(11, iterator='preorder').insert(8).insert(
         13).insert(9).insert(4).insert(1).insert(2)
     set = set.insert(3).insert(12).insert(14)
     balancedSet = set.balancer()
     self.assertEqual(set, [11, 8, 4, 1, 2, 3, 9, 13, 12, 14])
     self.assertEqual(balancedSet, [8, 2, 1, 3, 4, 13, 11, 9, 12, 14])
 def test_balancer(self):
     set1 = UnbalancedSet(5, iterator='preorder').insert(6).insert(
         7).insert(4).insert(2).insert(1)
     set1 = set1.insert(57).insert(36).insert(67).insert(24).insert(
         72).insert(4)
     set2 = set1.balancer()
     self.assertEqual(set1, [5, 4, 2, 1, 6, 7, 57, 36, 24, 67, 72])
     self.assertEqual(set2, [6, 2, 1, 4, 5, 57, 24, 7, 36, 67, 72])
 def test_balancer_left_right_rotation3(self):
     set = UnbalancedSet(55, iterator='preorder').insert(54).insert(
         53).insert(56).insert(57).insert(58)
     balancedSet = set.balancer()
     self.assertEqual(set, [55, 54, 53, 56, 57, 58])
     self.assertEqual(balancedSet, [55, 54, 53, 57, 56, 58])
 def test_balancer_left_right_rotation(self):
     unbalancedSet = UnbalancedSet(5, iterator='preorder').insert(4).insert(
         3).insert(3.5).insert(3.6).insert(6)
     balancedSet = unbalancedSet.balancer()
     self.assertEqual(unbalancedSet, [5, 4, 3, 3.5, 3.6, 6])
     self.assertEqual(balancedSet, [3.6, 3.5, 3, 5, 4, 6])
 def test_balancer_left_rotation(self):
     set = UnbalancedSet(5, iterator='preorder').insert(6).insert(7)
     balancedSet = set.balancer()
     self.assertEqual(set, [5, 6, 7])
     self.assertEqual(balancedSet, [6, 5, 7])
 def test_balancer_right_rotation(self):
     unbalancedSet = UnbalancedSet(5,
                                   iterator='preorder').insert(4).insert(3)
     balancedSet = unbalancedSet.balancer()
     self.assertEqual(unbalancedSet, [5, 4, 3])
     self.assertEqual(balancedSet, [4, 3, 5])