diff options
author | Senthil Kumaran <senthil@uthcode.com> | 2012-03-13 00:14:59 -0700 |
---|---|---|
committer | Senthil Kumaran <senthil@uthcode.com> | 2012-03-13 00:14:59 -0700 |
commit | 784ddb08a692a531d35e48c44bd7d84592ffb32a (patch) | |
tree | 6162ff8bdf913cf64adc06094f1c8bee8b1d6606 /Lib/test/test_re.py | |
parent | 6080db76066a83fc7c2e50975b616f649fbfb2d6 (diff) | |
parent | df723e1e5e4e0022a28618f953219aaf52852643 (diff) | |
download | cpython-git-784ddb08a692a531d35e48c44bd7d84592ffb32a.tar.gz |
merge heads
Diffstat (limited to 'Lib/test/test_re.py')
-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 4e18531803..940ba39058 100644 --- a/Lib/test/test_re.py +++ b/Lib/test/test_re.py @@ -818,6 +818,16 @@ class ReTests(unittest.TestCase): self.assertRaises(OverflowError, _sre.compile, "abc", 0, [long_overflow]) self.assertRaises(TypeError, _sre.compile, {}, 0, []) + 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: |