-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_regex.py
39 lines (30 loc) · 886 Bytes
/
test_regex.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
#!/usr/bin/env python
import sys
from regex import Regex
def main():
###### testing code snippets (leftover from development) ######
re = Regex.compile('(.)\\1')
re.display()
assert re.match('AA')
assert not re.match('AB')
print "===================================="
re = Regex.compile('AA')
re.display()
assert not re.match('A')
assert re.match('AA')
assert not re.match('AAAA')
print "===================================="
re = Regex.compile('(O|RHH|MM)*')
re.display()
assert re.match('')
assert re.match('OOOO')
assert re.match('MMORHHO')
assert not re.match('MMORHHH')
assert re.match('ORHH')
print "===================================="
re = Regex.compile('((A)\\2)\\1')
re.display()
assert re.match('AAAA')
return 0
if __name__ == "__main__":
sys.exit(main())