[Python-checkins] python/dist/src/Lib/test test__locale.py,1.4,1.5

jlgijsbers at users.sourceforge.net jlgijsbers at users.sourceforge.net
Sat Aug 14 12:56:57 CEST 2004


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22785

Modified Files:
	test__locale.py 
Log Message:
Reset old locale after running tests. Not doing so broke
test_format/test_unicode in some circumstances (patch #1007539/bug #992078).


Index: test__locale.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test__locale.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** test__locale.py	19 Dec 2003 01:16:03 -0000	1.4
--- test__locale.py	14 Aug 2004 10:56:54 -0000	1.5
***************
*** 14,34 ****
      'es_ES.ISO8859-1', 'fr_FR.ISO8859-15', 'ru_RU.KOI8-R', 'ko_KR.eucKR']
  
! saw_locale = 0
! for loc in candidate_locales:
!     try:
!         setlocale(LC_NUMERIC, loc)
!     except Error:
!         continue
!     if verbose:
!         print "locale %r" % loc
!     saw_locale = 1
!     nl_radixchar = nl_langinfo(RADIXCHAR)
!     li_radixchar = localeconv()['decimal_point']
!     if nl_radixchar != li_radixchar:
!         print "%r != %r" % (nl_radixchar, li_radixchar)
!     nl_radixchar = nl_langinfo(THOUSEP)
!     li_radixchar = localeconv()['thousands_sep']
!     if nl_radixchar != li_radixchar:
!         print "%r != %r" % (nl_radixchar, li_radixchar)
! if not saw_locale:
!     raise ImportError, "None of the listed locales found"
--- 14,38 ----
      'es_ES.ISO8859-1', 'fr_FR.ISO8859-15', 'ru_RU.KOI8-R', 'ko_KR.eucKR']
  
! oldlocale = setlocale(LC_NUMERIC)
! try:
!     saw_locale = 0
!     for loc in candidate_locales:
!         try:
!             setlocale(LC_NUMERIC, loc)
!         except Error:
!             continue
!         if verbose:
!             print "locale %r" % loc
!         saw_locale = 1
!         nl_radixchar = nl_langinfo(RADIXCHAR)
!         li_radixchar = localeconv()['decimal_point']
!         if nl_radixchar != li_radixchar:
!             print "%r != %r" % (nl_radixchar, li_radixchar)
!         nl_radixchar = nl_langinfo(THOUSEP)
!         li_radixchar = localeconv()['thousands_sep']
!         if nl_radixchar != li_radixchar:
!             print "%r != %r" % (nl_radixchar, li_radixchar)
!     if not saw_locale:
!             raise ImportError, "None of the listed locales found"
! finally:
!     setlocale(LC_NUMERIC, oldlocale)



More information about the Python-checkins mailing list