]> granicus.if.org Git - python/commitdiff
-- enabled some temporarily disabled RE tests
authorFredrik Lundh <fredrik@pythonware.com>
Tue, 8 Aug 2000 17:06:53 +0000 (17:06 +0000)
committerFredrik Lundh <fredrik@pythonware.com>
Tue, 8 Aug 2000 17:06:53 +0000 (17:06 +0000)
-- added basic unicode tests to test_re
-- added test case for Sjoerd's xmllib problem to re_tests

Lib/test/output/test_re
Lib/test/re_tests.py
Lib/test/test_re.py

index 75c46fc243fb7e9c9afa38c3f2f63b0f847240dd..2f5ad4b26cce14c2998aabf8165a6ac6d2bfb7cc 100644 (file)
@@ -1 +1,2 @@
 test_re
+maximum recursion limit exceeded
index adc3a7d4837a6c2400386a9dd15a0bcc35dafd0a..14a2cee36c1daeecf45bc958b3077fc7a8d7d5fc 100755 (executable)
@@ -587,4 +587,10 @@ xyzabc
     ('\t\n\v\r\f\a\g', '\t\n\v\r\f\ag', SUCCEED, 'found', '\t\n\v\r\f\ag'),
     (r'\t\n\v\r\f\a', '\t\n\v\r\f\a', SUCCEED, 'found', chr(9)+chr(10)+chr(11)+chr(13)+chr(12)+chr(7)),
     (r'[\t][\n][\v][\r][\f][\b]', '\t\n\v\r\f\b', SUCCEED, 'found', '\t\n\v\r\f\b'),
+
+    # additional regression tests (1.6 and later)
+
+    # xmllib problem
+    (r'(([a-z]+):)?([a-z]+)$', 'smil', SUCCEED, 'g1+"-"+g2+"-"+g3', 'None-None-smil'),
+
 ]
index fa28417fb37627e95ad9383e650b1c13e2e2e6ec..692980050d2ce994dee115695c6ec1292b892e88 100644 (file)
@@ -28,10 +28,6 @@ try:
 except:
     raise TestFailed, "re.search"
 
-# Try nasty case that overflows the straightforward recursive
-# implementation of repeated groups.
-#assert re.match('(x)*', 50000*'x').span() == (0, 50000)
-
 if verbose:
     print 'Running tests on re.sub'
 
@@ -154,8 +150,8 @@ try:
     assert re.split("(?::*)", ":a:b::c") == ['', 'a', 'b', 'c']
     assert re.split("(:)*", ":a:b::c") == ['', ':', 'a', ':', 'b', ':', 'c']
     assert re.split("([b:]+)", ":a:b::c") == ['', ':', 'a', ':b::', 'c']
-##    assert re.split("(b)|(:+)", ":a:b::c") == \
-##           ['', None, ':', 'a', None, ':', '', 'b', None, '', None, '::', 'c']
+    assert re.split("(b)|(:+)", ":a:b::c") == \
+           ['', None, ':', 'a', None, ':', '', 'b', None, '', None, '::', 'c']
     assert re.split("(?:b)|(?::+)", ":a:b::c") == ['', 'a', '', '', 'c']
 except AssertionError:
     raise TestFailed, "re.split"
@@ -253,6 +249,16 @@ for flags in [re.I, re.M, re.X, re.S, re.L]:
     except:
         print 'Exception raised on flag', flags
 
+if verbose:
+    print 'Test engine limitations'
+
+# Try nasty case that overflows the straightforward recursive
+# implementation of repeated groups.
+try:
+    assert re.match('(x)*', 50000*'x').span() == (0, 50000)
+except RuntimeError, v:
+    print v
+
 from re_tests import *
 
 if verbose:
@@ -326,6 +332,19 @@ for t in tests:
             else:
                 print '=== Failed incorrectly', t
 
+            # Try the match on a unicode string, and check that it
+            # still succeeds.
+            result=obj.search(unicode(s, "latin-1"))
+            if result==None:
+                print '=== Fails on unicode match', t
+
+            # Try the match on a unicode pattern, and check that it
+            # still succeeds.
+            obj=re.compile(unicode(pattern, "latin-1"))
+            result=obj.search(s)
+            if result==None:
+                print '=== Fails on unicode pattern match', t
+
             # Try the match with the search area limited to the extent
             # of the match and see if it still succeeds.  \B will
             # break (because it won't match at the end or start of a
@@ -350,3 +369,10 @@ for t in tests:
             result=obj.search(s)
             if result==None:
                 print '=== Fails on locale-sensitive match', t
+
+            # Try the match with UNICODE locale enabled, and check
+            # that it still succeeds.
+            obj=re.compile(pattern, re.UNICODE)
+            result=obj.search(s)
+            if result==None:
+                print '=== Fails on unicode-sensitive match', t