[Python-checkins] python/dist/src/Lib/test test_re.py,1.35,1.36
montanaro@users.sourceforge.net
montanaro@users.sourceforge.net
Fri, 25 Apr 2003 07:12:46 -0700
Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1:/tmp/cvs-serv31075
Modified Files:
test_re.py
Log Message:
copy a few tests from test_sre
Index: test_re.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_re.py,v
retrieving revision 1.35
retrieving revision 1.36
diff -C2 -d -r1.35 -r1.36
*** test_re.py 25 Apr 2003 01:40:11 -0000 1.35
--- test_re.py 25 Apr 2003 14:12:40 -0000 1.36
***************
*** 187,190 ****
--- 187,205 ----
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