diff options
author | Senthil Kumaran <senthil@uthcode.com> | 2012-03-13 00:15:15 -0700 |
---|---|---|
committer | Senthil Kumaran <senthil@uthcode.com> | 2012-03-13 00:15:15 -0700 |
commit | b968b36ad0b46bf7a909afffb3b558ed5aeebfe0 (patch) | |
tree | 4cbf1e583d9ff94daf3cf5c3b6f5e74e100689f1 /Lib/test | |
parent | c768d4caa81100a27dab517a8eccc18fea6843fc (diff) | |
parent | b56b6fff1f05df4dd3ffe92d0d5cf371e84af9ac (diff) | |
download | cpython-git-b968b36ad0b46bf7a909afffb3b558ed5aeebfe0.tar.gz |
merge heads
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_re.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_re.py b/Lib/test/test_re.py index b19834cae6..6f6d014cb1 100644 --- 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 + pattern = re.compile('random pattern') + self.assertIsInstance(pattern, re._pattern_type) + same_pattern = re.compile(pattern) + self.assertIsInstance(same_pattern, re._pattern_type) + self.assertIs(same_pattern, pattern) + # Test behaviour when not given a string or pattern as parameter + self.assertRaises(TypeError, re.compile, 0) + def run_re_tests(): from test.re_tests import tests, SUCCEED, FAIL, SYNTAX_ERROR if verbose: |