[Python-Dev] New test failure on Windows

Gary Herron gherron@islandtraining.com
Thu, 24 Apr 2003 15:38:42 -0700


On Thursday 24 April 2003 03:01 pm, Tim Peters wrote:
> Last-second re changes don't appear to be going in the right direction
> <wink>:
>
> C:\Code\python\PCbuild>python ../lib/test/test_re.py
> Running re_tests test suite
> test_basic_re_sub (__main__.ReTests) ... ok
> test_constants (__main__.ReTests) ... ok
> test_escaped_re_sub (__main__.ReTests) ... ok
> test_flags (__main__.ReTests) ... ok
> test_limitations (__main__.ReTests) ... ERROR
> test_pickling (__main__.ReTests) ... ok
> test_qualified_re_split (__main__.ReTests) ... ok
> test_qualified_re_sub (__main__.ReTests) ... ok
> test_re_escape (__main__.ReTests) ... ok
> test_re_findall (__main__.ReTests) ... ok
> test_re_match (__main__.ReTests) ... ok
> test_re_split (__main__.ReTests) ... ok
> test_re_subn (__main__.ReTests) ... ok
> test_search_star_plus (__main__.ReTests) ... ok
> test_symbolic_refs (__main__.ReTests) ... ok
>
> ======================================================================
> ERROR: test_limitations (__main__.ReTests)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File "../lib/test/test_re.py", line 182, in test_limitations
>     self.assertEqual(re.match('(x)*', 50000*'x').span(), (0, 50000))
>   File "C:\Code\python\lib\sre.py", line 132, in match
>     return _compile(pattern, flags).match(string)
> RuntimeError: maximum recursion limit exceeded
>

Today's change to test_re (rather than a change to any of the sre
code) is the problem.  It appears the Skip was attempting to translate
the tests to use the unittest module.  One test (and perhaps others)
were translated incorrectly.


The original test was:

  try:
      verify(re.match('(x)*', 50000*'x').span() == (0, 50000))
  except RuntimeError, v:
      print v

Since this is *supposed* to cause a RuntimeError, it should be
translated something like

  self.assertRaises(RuntimeError, re.match, '(x)*', 50000*'x')

but definitely not as

  self.assertEqual(re.match('(x)*', 50000*'x').span(), (0, 50000))


Here's the CVS log entry:
----------------------------
revision 1.34
date: 2003/04/24 19:43:18;  author: montanaro;  state: Exp;  lines: +294 -371
first cut at unittest version of re tests
----------------------------

Gary Herron