Tim Peters wrote: > [Brett C.] >>I should have been more explicit; I meant after *every* individual >>test and not after the battery of tests. > > > OK, and back to an unpatched _strptime.py. With the current CVS > locale-restoration code (which differs from what it was half an hour ago, > but should have the same effect): > <SNIP of tests passing with test_logging modified> > > > Again, without restoring locale in test_logging: > > C:\Code\python\PCbuild>python ../lib/test/regrtest.py test_strptime > test_logging > test_time > time.strftime("%c") > '07/22/03 20:39:09' > So no AM/PM. > _strptime.TimeRE()['c'] > '(?P<m>1[0-2]|0[1-9]|[1-9])/(?P<d>3[0-1]|[1-2]\\d|0[1-9]| > [1-9]| [1-9])/(?P<y>\\d\\d)\\s*(?P<H>2[0-3]|[0-1]\\d|\\d) > :(?P<M>[0-5]\\d|\\d):(?P<S>6[0-1]|[0-5]\\d|\\d)' > > locale.getdefaultlocale() > ('en_US', 'cp1252') > > locale.getlocale(locale.LC_TIME) > (None, None) > Note value of here. > test_strptime > time.strftime("%c") > '07/22/03 20:39:10' > > _strptime.TimeRE()['c'] > '(?P<m>1[0-2]|0[1-9]|[1-9])/(?P<d>3[0-1]|[1-2]\\d|0[1-9]| > [1-9]| [1-9])/(?P<y>\\d\\d)\\s*(?P<H>2[0-3]|[0-1]\\d|\\d) > :(?P<M>[0-5]\\d|\\d):(?P<S>6[0-1]|[0-5]\\d|\\d)' > > locale.getdefaultlocale() > ('en_US', 'cp1252') > > locale.getlocale(locale.LC_TIME) > (None, None) > > test_logging > time.strftime("%c") > '07/22/2003 08:39:11 PM' > > _strptime.TimeRE()['c'] > '(?P<m>1[0-2]|0[1-9]|[1-9])/(?P<d>3[0-1]|[1-2]\\d|0[1-9]| > [1-9]| [1-9])/(?P<y>\\d\\d)\\s*(?P<H>2[0-3]|[0-1]\\d|\\d) > :(?P<M>[0-5]\\d|\\d):(?P<S>6[0-1]|[0-5]\\d|\\d)' > > locale.getdefaultlocale() > ('en_US', 'cp1252') > > locale.getlocale(locale.LC_TIME) > ['English_United States', '1252'] > > test_time > test test_time failed -- Traceback (most recent call last): > File "C:\CODE\PYTHON\lib\test\test_time.py", line 49, in test_strptime > self.fail('conversion specifier: %r failed.' % format) > File "C:\CODE\PYTHON\lib\unittest.py", line 260, in fail > raise self.failureException, msg > AssertionError: conversion specifier: ' %c' failed. > > time.strftime("%c") > '07/22/2003 08:39:13 PM' > test_logging does its magic and now AM/PM appears. > _strptime.TimeRE()['c'] > '(?P<m>1[0-2]|0[1-9]|[1-9])/(?P<d>3[0-1]|[1-2]\\d|0[1-9]| > [1-9]| [1-9])/(?P<y>\\d\\d)\\s*(?P<H>2[0-3]|[0-1]\\d|\\d) > :(?P<M>[0-5]\\d|\\d):(?P<S>6[0-1]|[0-5]\\d|\\d)' > > locale.getdefaultlocale() > ('en_US', 'cp1252') > > locale.getlocale(locale.LC_TIME) > ['English_United States', '1252'] > And now locale.getlocale(locale.LC_TIME) returns a different value! > 2 tests OK. > 1 test failed: > test_time > > C:\Code\python\PCbuild> > So this should be solvable by changing some comparison code and what is used to represent the language. I will have a look and see if I can figure out where this is going wrong. If I don't have it fixed by the end of today I will rip out the caching code and just leave a fix for 2.3.1 and 2.4 . -Brett
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4