[Python-checkins] python/dist/src/Lib/test test_re.py, 1.45, 1.45.6.1

anthonybaxter at users.sourceforge.net anthonybaxter at users.sourceforge.net
Tue Nov 4 09:11:03 EST 2003


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1:/tmp/cvs-serv4403

Modified Files:
      Tag: release23-maint
	test_re.py 
Log Message:
get tests working again. partial backport of 1.46 - I fixed the 
recursive tests that used to fail, but left test_re_groupref_exists 
disabled, as it fails on the release23-maint branch. Maybe something
else needs to be backported?


Index: test_re.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_re.py,v
retrieving revision 1.45
retrieving revision 1.45.6.1
diff -C2 -d -r1.45 -r1.45.6.1
*** test_re.py	2 Jul 2003 20:03:04 -0000	1.45
--- test_re.py	4 Nov 2003 14:11:01 -0000	1.45.6.1
***************
*** 170,174 ****
  
      def test_re_groupref_exists(self):
!         return # not yet
          self.assertEqual(re.match('^(\()?([^()]+)(?(1)\))$', '(a)').groups(),
                           ('(', 'a'))
--- 170,174 ----
  
      def test_re_groupref_exists(self):
!         return # not yet 
          self.assertEqual(re.match('^(\()?([^()]+)(?(1)\))$', '(a)').groups(),
                           ('(', 'a'))
***************
*** 406,411 ****
                           20003)
          self.assertEqual(re.match('.*?cd', 20000*'abc'+'de').end(0), 60001)
!         # non-simple '*?' still recurses and hits the recursion limit
!         self.assertRaises(RuntimeError, re.search, '(a|b)*?c', 10000*'ab'+'cd')
  
      def test_bug_612074(self):
--- 406,413 ----
                           20003)
          self.assertEqual(re.match('.*?cd', 20000*'abc'+'de').end(0), 60001)
!         # non-simple '*?' still used to hit the recursion limit, before the
!         # non-recursive scheme was implemented. 
!         self.assertEqual(re.search('(a|b)*?c', 10000*'ab'+'cd').end(0), 20001)
! 
  
      def test_bug_612074(self):
***************
*** 414,422 ****
  
      def test_stack_overflow(self):
!         # nasty case that overflows the straightforward recursive
          # implementation of repeated groups.
!         self.assertRaises(RuntimeError, re.match, '(x)*', 50000*'x')
!         self.assertRaises(RuntimeError, re.match, '(x)*y', 50000*'x'+'y')
!         self.assertRaises(RuntimeError, re.match, '(x)*?y', 50000*'x'+'y')
  
      def test_scanner(self):
--- 416,424 ----
  
      def test_stack_overflow(self):
!         # nasty cases that used to overflow the straightforward recursive
          # implementation of repeated groups.
!         self.assertEqual(re.match('(x)*', 50000*'x').group(1), 'x')
!         self.assertEqual(re.match('(x)*y', 50000*'x'+'y').group(1), 'x')
!         self.assertEqual(re.match('(x)*?y', 50000*'x'+'y').group(1), 'x')
  
      def test_scanner(self):





More information about the Python-checkins mailing list