[Python-checkins] python/dist/src/Lib/test test_strptime.py,1.18,1.19

bcannon@users.sourceforge.net bcannon@users.sourceforge.net
Wed, 23 Jul 2003 23:27:20 -0700


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1:/tmp/cvs-serv14296/Lib/test

Modified Files:
	test_strptime.py 
Log Message:
Remove caching of TimeRE (and thus LocaleTime) instance.  Error was being
caught when executing test_strptime, test_logging, and test_time in that order
when the testing of "%c" occured.  Suspect the cache was not being recreated
(the test passed when test_logging was forced to re-establish the locale).


Index: test_strptime.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_strptime.py,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** test_strptime.py	22 Jul 2003 21:07:16 -0000	1.18
--- test_strptime.py	24 Jul 2003 06:27:17 -0000	1.19
***************
*** 9,12 ****
--- 9,17 ----
  import _strptime
  
+ class getlang_Tests(unittest.TestCase):
+     """Test _getlang"""
+     def test_basic(self):
+         self.failUnlessEqual(_strptime._getlang(), locale.getlocale(locale.LC_TIME))
+ 
  class LocaleTime_Tests(unittest.TestCase):
      """Tests for _strptime.LocaleTime."""
***************
*** 90,98 ****
  
      def test_lang(self):
!         # Make sure lang is set
!         self.failUnless(self.LT_ins.lang in (locale.getdefaultlocale()[0],
!                                              locale.getlocale(locale.LC_TIME)[0],
!                                              ''),
!                         "Setting of lang failed")
  
      def test_by_hand_input(self):
--- 95,101 ----
  
      def test_lang(self):
!         # Make sure lang is set to what _getlang() returns
!         # Assuming locale has not changed between now and when self.LT_ins was created
!         self.failUnlessEqual(self.LT_ins.lang, _strptime._getlang())
  
      def test_by_hand_input(self):
***************
*** 411,417 ****
                          "Calculation of day of the week failed;"
                           "%s != %s" % (result.tm_wday, self.time_tuple.tm_wday))
- 
  def test_main():
      test_support.run_unittest(
          LocaleTime_Tests,
          TimeRETests,
--- 414,420 ----
                          "Calculation of day of the week failed;"
                           "%s != %s" % (result.tm_wday, self.time_tuple.tm_wday))
  def test_main():
      test_support.run_unittest(
+         getlang_Tests,
          LocaleTime_Tests,
          TimeRETests,
***************
*** 419,423 ****
          Strptime12AMPMTests,
          JulianTests,
!         CalculationTests
      )
  
--- 422,426 ----
          Strptime12AMPMTests,
          JulianTests,
!         CalculationTests,
      )