@@ -679,33 +679,33 @@ class CacheTests(unittest.TestCase):
679
679
def test_time_re_recreation (self ):
680
680
# Make sure cache is recreated when current locale does not match what
681
681
# cached object was created with.
682
- _strptime ._strptime_time ("10" , "%d" )
682
+ _strptime ._strptime_time ("10 2004 " , "%d %Y " )
683
683
_strptime ._strptime_time ("2005" , "%Y" )
684
684
_strptime ._TimeRE_cache .locale_time .lang = "Ni"
685
685
original_time_re = _strptime ._TimeRE_cache
686
- _strptime ._strptime_time ("10" , "%d" )
686
+ _strptime ._strptime_time ("10 2004 " , "%d %Y " )
687
687
self .assertIsNot (original_time_re , _strptime ._TimeRE_cache )
688
688
self .assertEqual (len (_strptime ._regex_cache ), 1 )
689
689
690
690
def test_regex_cleanup (self ):
691
691
# Make sure cached regexes are discarded when cache becomes "full".
692
692
try :
693
- del _strptime ._regex_cache ['%d' ]
693
+ del _strptime ._regex_cache ['%d %Y ' ]
694
694
except KeyError :
695
695
pass
696
696
bogus_key = 0
697
697
while len (_strptime ._regex_cache ) <= _strptime ._CACHE_MAX_SIZE :
698
698
_strptime ._regex_cache [bogus_key ] = None
699
699
bogus_key += 1
700
- _strptime ._strptime_time ("10" , "%d" )
700
+ _strptime ._strptime_time ("10 2004 " , "%d %Y " )
701
701
self .assertEqual (len (_strptime ._regex_cache ), 1 )
702
702
703
703
def test_new_localetime (self ):
704
704
# A new LocaleTime instance should be created when a new TimeRE object
705
705
# is created.
706
706
locale_time_id = _strptime ._TimeRE_cache .locale_time
707
707
_strptime ._TimeRE_cache .locale_time .lang = "Ni"
708
- _strptime ._strptime_time ("10" , "%d" )
708
+ _strptime ._strptime_time ("10 2004 " , "%d %Y " )
709
709
self .assertIsNot (locale_time_id , _strptime ._TimeRE_cache .locale_time )
710
710
711
711
def test_TimeRE_recreation_locale (self ):
@@ -716,13 +716,13 @@ def test_TimeRE_recreation_locale(self):
716
716
except locale .Error :
717
717
self .skipTest ('test needs en_US.UTF8 locale' )
718
718
try :
719
- _strptime ._strptime_time ('10' , '%d' )
719
+ _strptime ._strptime_time ('10 2004 ' , '%d %Y ' )
720
720
# Get id of current cache object.
721
721
first_time_re = _strptime ._TimeRE_cache
722
722
try :
723
723
# Change the locale and force a recreation of the cache.
724
724
locale .setlocale (locale .LC_TIME , ('de_DE' , 'UTF8' ))
725
- _strptime ._strptime_time ('10' , '%d' )
725
+ _strptime ._strptime_time ('10 2004 ' , '%d %Y ' )
726
726
# Get the new cache object's id.
727
727
second_time_re = _strptime ._TimeRE_cache
728
728
# They should not be equal.
0 commit comments