summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_re.py
diff options
context:
space:
mode:
authorEzio Melotti <ezio.melotti@gmail.com>2012-03-12 23:33:30 (GMT)
committerEzio Melotti <ezio.melotti@gmail.com>2012-03-12 23:33:30 (GMT)
commitcc50ba26bd186dd2f7e093be9f7b7bb18d08a35a (patch)
tree49df4f5970ca26db83c632c2a2ab65f6d9c1ac7e /Lib/test/test_re.py
parenta8ec5ea923c86415835ddecae795071804dca69d (diff)
parentdf723e1e5e4e0022a28618f953219aaf52852643 (diff)
downloadcpython-cc50ba26bd186dd2f7e093be9f7b7bb18d08a35a.zip
cpython-cc50ba26bd186dd2f7e093be9f7b7bb18d08a35a.tar.gz
cpython-cc50ba26bd186dd2f7e093be9f7b7bb18d08a35a.tar.bz2
#14179: merge with 3.2.
Diffstat (limited to 'Lib/test/test_re.py')
-rw-r--r--Lib/test/test_re.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_re.py b/Lib/test/test_re.py
index 34c4a5f..425c0eb 100644
--- a/Lib/test/test_re.py
+++ b/Lib/test/test_re.py
@@ -825,6 +825,16 @@ class ReTests(unittest.TestCase):
self.assertIsNotNone(re.search("123.*-", '123\U0010ffff-'))
self.assertIsNotNone(re.search("123.*-", '123\xe9\u20ac\U0010ffff-'))
+ 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: