Пример #1
0
 def test_identifies_valid_sequence(self):
     self.assertTrue(is_balanced('()'))
     self.assertTrue(is_balanced('()(())'))
     self.assertTrue(is_balanced('{{([][])}()}'))
Пример #2
0
 def test_identifies_right_imbalance(self):
     self.assertFalse(is_balanced('())'))
Пример #3
0
 def test_identifies_mismatch(self):
     self.assertFalse(is_balanced('{[])'))
Пример #4
0
 def test_identifies_left_imbalance(self):
     self.assertFalse(is_balanced('(()'))