-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_proper_parenthetics.py
49 lines (25 loc) · 1014 Bytes
/
test_proper_parenthetics.py
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
38
39
40
41
42
43
44
45
46
47
48
49
from proper_parenthetics import check_parens
def test_check_parens_open1():
assert check_parens(u'(((text))') == 1
def test_check_parens_open2():
assert check_parens(u'((((((text') == 1
def test_check_parens_open3():
assert check_parens(u'(') == 1
def test_check_parens_balanced1():
assert check_parens(u'') == 0
def test_check_parens_balanced2():
assert check_parens(u'(text)') == 0
def test_check_parens_balanced3():
assert check_parens(u'(text(text(text())))') == 0
def test_check_parens_balanced4():
assert check_parens(u'()') == 0
def test_check_parens_broken1():
assert check_parens(u')') == -1
def test_check_parens_broken2():
assert check_parens(u'(text))') == -1
def test_check_parens_broken3():
assert check_parens(u'(text(text(text(text)text)text)text)text)') == -1
def test_check_parens_invalid1():
assert check_parens(u')(') == -1
def test_check_parens_invalid2():
assert check_parens(u'(dog(cat)),(foo(bar(baz)bar)foo))') == -1