Back to index

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

List of all members.

Public Member Functions

def setUp
def test_plural_forms1
def test_plural_forms2
def test_hu
def test_de
def test_fr
def test_gd
def test_gd2
def test_lt
def test_ru
def test_pl
def test_sl
def test_security
def tearDown

Public Attributes

 mofile
 env

Detailed Description

Definition at line 212 of file test_gettext.py.


Member Function Documentation

Reimplemented from test.test_gettext.GettextBaseTest.

Definition at line 213 of file test_gettext.py.

00213 
00214     def setUp(self):
00215         GettextBaseTest.setUp(self)
00216         self.mofile = MOFILE

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 239 of file test_gettext.py.

00239 
00240     def test_de(self):
00241         eq = self.assertEqual
00242         f = gettext.c2py('n != 1')
00243         s = ''.join([ str(f(x)) for x in range(200) ])
00244         eq(s, "10111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111")

Here is the call graph for this function:

Definition at line 245 of file test_gettext.py.

00245 
00246     def test_fr(self):
00247         eq = self.assertEqual
00248         f = gettext.c2py('n>1')
00249         s = ''.join([ str(f(x)) for x in range(200) ])
00250         eq(s, "00111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111")

Here is the call graph for this function:

Definition at line 251 of file test_gettext.py.

00251 
00252     def test_gd(self):
00253         eq = self.assertEqual
00254         f = gettext.c2py('n==1 ? 0 : n==2 ? 1 : 2')
00255         s = ''.join([ str(f(x)) for x in range(200) ])
00256         eq(s, "20122222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222")

Here is the call graph for this function:

Definition at line 257 of file test_gettext.py.

00257 
00258     def test_gd2(self):
00259         eq = self.assertEqual
00260         # Tests the combination of parentheses and "?:"
00261         f = gettext.c2py('n==1 ? 0 : (n==2 ? 1 : 2)')
00262         s = ''.join([ str(f(x)) for x in range(200) ])
00263         eq(s, "20122222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222")

Here is the call graph for this function:

Definition at line 233 of file test_gettext.py.

00233 
00234     def test_hu(self):
00235         eq = self.assertEqual
00236         f = gettext.c2py('0')
00237         s = ''.join([ str(f(x)) for x in range(200) ])
00238         eq(s, "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")

Here is the call graph for this function:

Definition at line 264 of file test_gettext.py.

00264 
00265     def test_lt(self):
00266         eq = self.assertEqual
00267         f = gettext.c2py('n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2')
00268         s = ''.join([ str(f(x)) for x in range(200) ])
00269         eq(s, "20111111112222222222201111111120111111112011111111201111111120111111112011111111201111111120111111112011111111222222222220111111112011111111201111111120111111112011111111201111111120111111112011111111")

Here is the call graph for this function:

Definition at line 276 of file test_gettext.py.

00276 
00277     def test_pl(self):
00278         eq = self.assertEqual
00279         f = gettext.c2py('n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2')
00280         s = ''.join([ str(f(x)) for x in range(200) ])
00281         eq(s, "20111222222222222222221112222222111222222211122222221112222222111222222211122222221112222222111222222211122222222222222222111222222211122222221112222222111222222211122222221112222222111222222211122222")

Here is the call graph for this function:

Definition at line 217 of file test_gettext.py.

00217 
00218     def test_plural_forms1(self):
00219         eq = self.assertEqual
00220         x = gettext.ngettext('There is %s file', 'There are %s files', 1)
00221         eq(x, 'Hay %s fichero')
00222         x = gettext.ngettext('There is %s file', 'There are %s files', 2)
00223         eq(x, 'Hay %s ficheros')

Here is the call graph for this function:

Definition at line 224 of file test_gettext.py.

00224 
00225     def test_plural_forms2(self):
00226         eq = self.assertEqual
00227         with open(self.mofile, 'rb') as fp:
00228             t = gettext.GNUTranslations(fp)
00229         x = t.ngettext('There is %s file', 'There are %s files', 1)
00230         eq(x, 'Hay %s fichero')
00231         x = t.ngettext('There is %s file', 'There are %s files', 2)
00232         eq(x, 'Hay %s ficheros')

Here is the call graph for this function:

Definition at line 270 of file test_gettext.py.

00270 
00271     def test_ru(self):
00272         eq = self.assertEqual
00273         f = gettext.c2py('n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2')
00274         s = ''.join([ str(f(x)) for x in range(200) ])
00275         eq(s, "20111222222222222222201112222220111222222011122222201112222220111222222011122222201112222220111222222011122222222222222220111222222011122222201112222220111222222011122222201112222220111222222011122222")

Here is the call graph for this function:

Definition at line 288 of file test_gettext.py.

00288 
00289     def test_security(self):
00290         raises = self.assertRaises
00291         # Test for a dangerous expression
00292         raises(ValueError, gettext.c2py, "os.chmod('/etc/passwd',0777)")
00293 

Here is the call graph for this function:

Definition at line 282 of file test_gettext.py.

00282 
00283     def test_sl(self):
00284         eq = self.assertEqual
00285         f = gettext.c2py('n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3')
00286         s = ''.join([ str(f(x)) for x in range(200) ])
00287         eq(s, "30122333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333012233333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333")

Here is the call graph for this function:


Member Data Documentation

Definition at line 73 of file test_gettext.py.

Definition at line 215 of file test_gettext.py.


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