mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Merged revisions 86236,86240,86332,86340,87271,87273,87447 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k To comply with the 2.x doc style, the methods in trace.rst use brackets around optional arguments. The rest is a mostly straight merge, modulo support changed to test_support and use of the old super call style in test_tuple. ........ r86236 | eric.araujo | 2010-11-06 03:44:43 +0100 (sam., 06 nov. 2010) | 2 lines Make sure each test can be run standalone (./python Lib/distutils/tests/x.py) ........ r86240 | eric.araujo | 2010-11-06 05:11:59 +0100 (sam., 06 nov. 2010) | 2 lines Prevent ResourceWarnings in test_gettext ........ r86332 | eric.araujo | 2010-11-08 19:15:17 +0100 (lun., 08 nov. 2010) | 4 lines Add missing NEWS entry for a fix committed by Senthil. All recent modifications to distutils should now be covered in NEWS. ........ r86340 | eric.araujo | 2010-11-08 22:48:23 +0100 (lun., 08 nov. 2010) | 2 lines This was actually fixed for the previous alpha. ........ r87271 | eric.araujo | 2010-12-15 20:09:58 +0100 (mer., 15 déc. 2010) | 2 lines Improve trace documentation (#9264). Patch by Eli Bendersky. ........ r87273 | eric.araujo | 2010-12-15 20:30:15 +0100 (mer., 15 déc. 2010) | 2 lines Use nested method directives, rewrap long lines, fix whitespace. ........ r87447 | eric.araujo | 2010-12-23 20:13:05 +0100 (jeu., 23 déc. 2010) | 2 lines Fix typo in superclass method name ........
This commit is contained in:
parent
67843b3886
commit
54274ad96a
37 changed files with 221 additions and 128 deletions
|
@ -64,15 +64,13 @@ class GettextBaseTest(unittest.TestCase):
|
|||
def setUp(self):
|
||||
if not os.path.isdir(LOCALEDIR):
|
||||
os.makedirs(LOCALEDIR)
|
||||
fp = open(MOFILE, 'wb')
|
||||
fp.write(base64.decodestring(GNU_MO_DATA))
|
||||
fp.close()
|
||||
fp = open(UMOFILE, 'wb')
|
||||
fp.write(base64.decodestring(UMO_DATA))
|
||||
fp.close()
|
||||
fp = open(MMOFILE, 'wb')
|
||||
fp.write(base64.decodestring(MMO_DATA))
|
||||
fp.close()
|
||||
with open(MOFILE, 'wb') as fp:
|
||||
fp.write(base64.decodestring(GNU_MO_DATA))
|
||||
with open(UMOFILE, 'wb') as fp:
|
||||
fp.write(base64.decodestring(UMO_DATA))
|
||||
with open(MMOFILE, 'wb') as fp:
|
||||
fp.write(base64.decodestring(MMO_DATA))
|
||||
|
||||
self.env = test_support.EnvironmentVarGuard()
|
||||
self.env['LANGUAGE'] = 'xx'
|
||||
gettext._translations.clear()
|
||||
|
@ -135,9 +133,8 @@ trggrkg zrffntr pngnybt yvoenel.''')
|
|||
def test_the_alternative_interface(self):
|
||||
eq = self.assertEqual
|
||||
# test the alternative interface
|
||||
fp = open(self.mofile, 'rb')
|
||||
t = gettext.GNUTranslations(fp)
|
||||
fp.close()
|
||||
with open(self.mofile, 'rb') as fp:
|
||||
t = gettext.GNUTranslations(fp)
|
||||
# Install the translation object
|
||||
t.install()
|
||||
eq(_('nudge nudge'), 'wink wink')
|
||||
|
@ -227,9 +224,8 @@ class PluralFormsTestCase(GettextBaseTest):
|
|||
|
||||
def test_plural_forms2(self):
|
||||
eq = self.assertEqual
|
||||
fp = open(self.mofile, 'rb')
|
||||
t = gettext.GNUTranslations(fp)
|
||||
fp.close()
|
||||
with open(self.mofile, 'rb') as fp:
|
||||
t = gettext.GNUTranslations(fp)
|
||||
x = t.ngettext('There is %s file', 'There are %s files', 1)
|
||||
eq(x, 'Hay %s fichero')
|
||||
x = t.ngettext('There is %s file', 'There are %s files', 2)
|
||||
|
@ -299,11 +295,8 @@ class PluralFormsTestCase(GettextBaseTest):
|
|||
class UnicodeTranslationsTest(GettextBaseTest):
|
||||
def setUp(self):
|
||||
GettextBaseTest.setUp(self)
|
||||
fp = open(UMOFILE, 'rb')
|
||||
try:
|
||||
with open(UMOFILE, 'rb') as fp:
|
||||
self.t = gettext.GNUTranslations(fp)
|
||||
finally:
|
||||
fp.close()
|
||||
self._ = self.t.ugettext
|
||||
|
||||
def test_unicode_msgid(self):
|
||||
|
@ -319,15 +312,12 @@ class UnicodeTranslationsTest(GettextBaseTest):
|
|||
class WeirdMetadataTest(GettextBaseTest):
|
||||
def setUp(self):
|
||||
GettextBaseTest.setUp(self)
|
||||
fp = open(MMOFILE, 'rb')
|
||||
try:
|
||||
with open(MMOFILE, 'rb') as fp:
|
||||
try:
|
||||
self.t = gettext.GNUTranslations(fp)
|
||||
except:
|
||||
self.tearDown()
|
||||
raise
|
||||
finally:
|
||||
fp.close()
|
||||
|
||||
def test_weird_metadata(self):
|
||||
info = self.t.info()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue