[Python-Dev] New test failure on Windows

Gary Herron gherron@islandtraining.com
Thu, 24 Apr 2003 16:33:50 -0700


There's a bit more to this problem.  It has to do with the *sre* test
versus the *re* tests.  When test_sre is run, it claims to run all its
own tests as well as all of test_re.  However any failed tests in
test_re are not reported by test_sre.  (Neither the one found by Tim
nor any others I just purposely introduced into test_re.)  This is
clearly a problem with test_sre.  Only if you run test_re directly
rather than through test_sre do you see Tim's error.

I'm hoping that Skip, who made these changes, can fix them.  (BTW, I
like the idea of putting all these tests into unittest -- the old test
code looked like a cancer of multiple test methods grown on top of
each other.)

Gary Herron



On Thursday 24 April 2003 03:38 pm, Gary Herron wrote:
> 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
>
>
>
> _______________________________________________
> Python-Dev mailing list
> Python-Dev@python.org
> http://mail.python.org/mailman/listinfo/python-dev