Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes
test.test_gettext.GettextCacheTestCase Class Reference
Inheritance diagram for test.test_gettext.GettextCacheTestCase:
Inheritance graph
[legend]
Collaboration diagram for test.test_gettext.GettextCacheTestCase:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def test_cache
def setUp
def tearDown

Public Attributes

 localedir
 mofile
 env

Detailed Description

Definition at line 333 of file test_gettext.py.


Member Function Documentation

def test.test_gettext.GettextBaseTest.setUp (   self) [inherited]

Reimplemented in test.test_gettext.WeirdMetadataTest, test.test_gettext.UnicodeTranslationsTest, test.test_gettext.PluralFormsTestCase, test.test_gettext.GettextTestCase2, and test.test_gettext.GettextTestCase1.

Definition at line 64 of file test_gettext.py.

00064 
00065     def setUp(self):
00066         if not os.path.isdir(LOCALEDIR):
00067             os.makedirs(LOCALEDIR)
00068         with open(MOFILE, 'wb') as fp:
00069             fp.write(base64.decodebytes(GNU_MO_DATA))
00070         with open(UMOFILE, 'wb') as fp:
00071             fp.write(base64.decodebytes(UMO_DATA))
00072         with open(MMOFILE, 'wb') as fp:
00073             fp.write(base64.decodebytes(MMO_DATA))
00074         self.env = support.EnvironmentVarGuard()
00075         self.env['LANGUAGE'] = 'xx'
00076         gettext._translations.clear()

Here is the call graph for this function:

Here is the caller graph for this function:

def test.test_gettext.GettextBaseTest.tearDown (   self) [inherited]

Definition at line 77 of file test_gettext.py.

00077 
00078     def tearDown(self):
00079         self.env.__exit__()
00080         del self.env
00081         shutil.rmtree(os.path.split(LOCALEDIR)[0])
00082 

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 334 of file test_gettext.py.

00334 
00335     def test_cache(self):
00336         self.localedir = os.curdir
00337         self.mofile = MOFILE
00338 
00339         self.assertEqual(len(gettext._translations), 0)
00340 
00341         t = gettext.translation('gettext', self.localedir)
00342 
00343         self.assertEqual(len(gettext._translations), 1)
00344 
00345         t = gettext.translation('gettext', self.localedir,
00346                                 class_=DummyGNUTranslations)
00347 
00348         self.assertEqual(len(gettext._translations), 2)
00349         self.assertEqual(t.__class__, DummyGNUTranslations)
00350 
00351         # Calling it again doesn't add to the cache
00352 
00353         t = gettext.translation('gettext', self.localedir,
00354                                 class_=DummyGNUTranslations)
00355 
00356         self.assertEqual(len(gettext._translations), 2)
00357         self.assertEqual(t.__class__, DummyGNUTranslations)
00358 


Member Data Documentation

Definition at line 73 of file test_gettext.py.

Definition at line 335 of file test_gettext.py.

Definition at line 336 of file test_gettext.py.


The documentation for this class was generated from the following file: