summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSkip Montanaro <skip@pobox.com>2003-04-25 14:12:40 (GMT)
committerSkip Montanaro <skip@pobox.com>2003-04-25 14:12:40 (GMT)
commit7d9963fea8295962e501b23800aee57a15bd2b8e (patch)
tree84b39e6be0d2ba0e825b011f994e456274db6ae9
parentdbcede5d66aee2999c16367fd4a2529fe77e91ae (diff)
downloadcpython-7d9963fea8295962e501b23800aee57a15bd2b8e.zip
cpython-7d9963fea8295962e501b23800aee57a15bd2b8e.tar.gz
cpython-7d9963fea8295962e501b23800aee57a15bd2b8e.tar.bz2
copy a few tests from test_sre
-rw-r--r--Lib/test/test_re.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/Lib/test/test_re.py b/Lib/test/test_re.py
index 51ab02d..ae61b26 100644
--- a/Lib/test/test_re.py
+++ b/Lib/test/test_re.py
@@ -186,6 +186,21 @@ class ReTests(unittest.TestCase):
else:
self.fail("re.match('(x)*', 50000*'x') should have failed")
+ def test_sre_character_literals(self):
+ for i in [0, 8, 16, 32, 64, 127, 128, 255]:
+ self.assertNotEqual(re.match(r"\%03o" % i, chr(i)), None)
+ self.assertNotEqual(re.match(r"\%03o0" % i, chr(i)+"0"), None)
+ self.assertNotEqual(re.match(r"\%03o8" % i, chr(i)+"8"), None)
+ self.assertNotEqual(re.match(r"\x%02x" % i, chr(i)), None)
+ self.assertNotEqual(re.match(r"\x%02x0" % i, chr(i)+"0"), None)
+ self.assertNotEqual(re.match(r"\x%02xz" % i, chr(i)+"z"), None)
+ self.assertRaises(re.error, re.match, "\911", "")
+
+ def test_bug_113254(self):
+ self.assertEqual(re.match(r'(a)|(b)', 'b').start(1), -1)
+ self.assertEqual(re.match(r'(a)|(b)', 'b').end(1), -1)
+ self.assertEqual(re.match(r'(a)|(b)', 'b').span(1), (-1, -1))
+
def run_re_tests():
from test.re_tests import benchmarks, tests, SUCCEED, FAIL, SYNTAX_ERROR
if verbose: