diff options
author | Guido van Rossum <guido@python.org> | 1998-07-17 20:05:02 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1998-07-17 20:05:02 (GMT) |
commit | c364cf82283332522ebc139e2edb5c8247f61307 (patch) | |
tree | 936d4d9d5239dbe6c6edcdb814ecf863c4c81bde /Lib/test/test_re.py | |
parent | dfba2fbfd0ea9715dd909577af7b069a9907154a (diff) | |
download | cpython-c364cf82283332522ebc139e2edb5c8247f61307.zip cpython-c364cf82283332522ebc139e2edb5c8247f61307.tar.gz cpython-c364cf82283332522ebc139e2edb5c8247f61307.tar.bz2 |
Added tests for findall().
Added test for m.groups() with default.
Added a few prints announcing various tests in verbose mode.
Diffstat (limited to 'Lib/test/test_re.py')
-rw-r--r-- | Lib/test/test_re.py | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/Lib/test/test_re.py b/Lib/test/test_re.py index 86a9db6..77defc7 100644 --- a/Lib/test/test_re.py +++ b/Lib/test/test_re.py @@ -165,6 +165,22 @@ try: except AssertionError: raise TestFailed, "qualified re.split" +if verbose: + print "Running tests on re.findall" + +try: + assert re.findall(":+", "abc") == [] + assert re.findall(":+", "a:b::c:::d") == [":", "::", ":::"] + assert re.findall("(:+)", "a:b::c:::d") == [":", "::", ":::"] + assert re.findall("(:)(:*)", "a:b::c:::d") == [(":", ""), + (":", ":"), + (":", "::")] +except AssertionError: + raise TestFailed, "re.findall" + +if verbose: + print "Running tests on re.match" + try: # No groups at all m = re.match('a', 'a') ; assert m.groups() == () @@ -176,6 +192,7 @@ try: assert pat.match('b').groups() == ('b', None, 'b', None) assert pat.match('ac').groups() == ('a', 'a', None, 'c') assert pat.match('bc').groups() == ('b', None, 'b', 'c') + assert pat.match('bc').groups("") == ('b', "", 'b', 'c') except AssertionError: raise TestFailed, "match .groups() method" @@ -192,6 +209,9 @@ try: except AssertionError: raise TestFailed, "match .group() method" +if verbose: + print "Running tests on re.escape" + try: p="" for i in range(0, 256): @@ -204,7 +224,7 @@ try: assert pat.match(p).span() == (0,256) except AssertionError: raise TestFailed, "re.escape" - + if verbose: print 'Pickling a RegexObject instance' |