[Python-Dev] More joy with test_strptime

Tim Peters tim.peters at gmail.com
Mon Jul 12 03:52:31 CEST 2004

> =)  I like Tim's assessment.  Best way to test that theory would be to
> clear the cache in _strptime.  Tim, can you insert the lines::
>     print "***%s == %s ?" % (_strptime._TimeRE_cache.locale_time.lang,
>                           _strptime._getlang())
>     _strptime._TimeRE_cache = _strptime.TimeRE()
>     _strptime._regex_cache = {}
> in the function (line 282 should be fine; just as long as you do it
> before any calls to _strptime).

I assume you meant I should insert that in test_strptime.py.  Doesn't
do any good as-is, because the regrtest framework eats stdout.  I
changed it to print to stderr instead.

Running all the tests, this gets displayed:

***(None, None) == (None, None) ?
test test_strptime failed -- Traceback (most recent call last):
  File "C:\Code\python\lib\test\test_strptime.py", line 293, in
    self.failUnlessEqual(tz_value, -1)
AssertionError: 0 != -1

Alas, the same thing is displayed when it passes (run in isolation):

***(None, None) == (None, None) ?
1 test OK.

More information about the Python-Dev mailing list