cpython: cc48eef234dd (original) (raw)
Mercurial > cpython
changeset 75563:cc48eef234dd 2.7
#14179: add tests for re.compile. Patch by Florian Mladitsch. [#14179]
Ezio Melotti ezio.melotti@gmail.com | |
---|---|
date | Tue, 13 Mar 2012 01:25:40 +0200 |
parents | f0a5f39615c8 |
children | 755a5f18ccf3 |
files | Lib/test/test_re.py Misc/ACKS |
diffstat | 2 files changed, 11 insertions(+), 0 deletions(-)[+] [-] Lib/test/test_re.py 10 Misc/ACKS 1 |
line wrap: on
line diff
--- a/Lib/test/test_re.py +++ b/Lib/test/test_re.py @@ -783,6 +783,16 @@ class ReTests(unittest.TestCase): self.assertRaises(TypeError, re.finditer, "a", {}) self.assertRaises(OverflowError, _sre.compile, "abc", 0, [long_overflow])
- def test_compile(self):
# Test return value when given string and pattern as parameter[](#l1.8)
pattern = re.compile('random pattern')[](#l1.9)
self.assertIsInstance(pattern, re._pattern_type)[](#l1.10)
same_pattern = re.compile(pattern)[](#l1.11)
self.assertIsInstance(same_pattern, re._pattern_type)[](#l1.12)
self.assertIs(same_pattern, pattern)[](#l1.13)
# Test behaviour when not given a string or pattern as parameter[](#l1.14)
self.assertRaises(TypeError, re.compile, 0)[](#l1.15)
+ def run_re_tests(): from test.re_tests import tests, SUCCEED, FAIL, SYNTAX_ERROR if verbose:
--- a/Misc/ACKS +++ b/Misc/ACKS @@ -577,6 +577,7 @@ Roman Milner Andrii V. Mishkovskyi Dustin J. Mitchell Dom Mitchell +Florian Mladitsch Doug Moen The Dragon De Monsyne Skip Montanaro