[Python-checkins] CVS: python/dist/src/Lib/test test_re.py,1.23,1.24 re_tests.py,1.14,1.15

Fredrik Lundh python-dev@python.org
Tue, 8 Aug 2000 10:06:56 -0700


Update of /cvsroot/python/python/dist/src/Lib/test
In directory slayer.i.sourceforge.net:/tmp/cvs-serv29632/lib/test

Modified Files:
	test_re.py re_tests.py 
Log Message:


-- enabled some temporarily disabled RE tests
-- added basic unicode tests to test_re
-- added test case for Sjoerd's xmllib problem to re_tests

Index: test_re.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_re.py,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -r1.23 -r1.24
*** test_re.py	2000/08/08 16:47:42	1.23
--- test_re.py	2000/08/08 17:06:52	1.24
***************
*** 29,36 ****
      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'
--- 29,32 ----
***************
*** 155,160 ****
      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") == ['', 'a', '', '', 'c']
  except AssertionError:
--- 151,156 ----
      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") == ['', 'a', '', '', 'c']
  except AssertionError:
***************
*** 254,257 ****
--- 250,263 ----
          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 *
  
***************
*** 327,330 ****
--- 333,349 ----
                  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
***************
*** 351,352 ****
--- 370,378 ----
              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

Index: re_tests.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/re_tests.py,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -r1.14 -r1.15
*** re_tests.py	2000/08/08 16:52:51	1.14
--- re_tests.py	2000/08/08 17:06:52	1.15
***************
*** 588,590 ****
--- 588,596 ----
      (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'),
+ 
  ]