-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbracket_push_test.py
More file actions
37 lines (23 loc) · 960 Bytes
/
bracket_push_test.py
File metadata and controls
37 lines (23 loc) · 960 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import unittest
from bracket_push import check_brackets
class BracketPushTests(unittest.TestCase):
def test_input_empty(self):
self.assertEqual(check_brackets(""), True)
def test_single(self):
self.assertEqual(check_brackets("{}"), True)
def test_unclosed(self):
self.assertEqual(check_brackets("{{"), False)
def test_wrong_order(self):
self.assertEqual(check_brackets("}{"), False)
def test_mixed_not_nested(self):
self.assertEqual(check_brackets("{}[]"), True)
def test_mixed_nested(self):
self.assertEqual(check_brackets("{[]}"), True)
def test_improperly_nested(self):
self.assertEqual(check_brackets("{[}]"), False)
def test_not_opened_nested(self):
self.assertEqual(check_brackets("{[)][]}"), False)
def test_nested_ensemble(self):
self.assertEqual(check_brackets("{[]([()])}"), True)
if __name__ == '__main__':
unittest.main()