#NEWLINE# def test_sorting( self ) : #NEWLINE# #INDENT# catalog = Catalog ( locale = 'en_US' ) #NEWLINE# catalog . add ( '' , '"Content-Type: text/plain; charset=utf-8\n"\n"Content-Transfer-Encoding: 8bit\n' ) #NEWLINE# catalog . add ( 'foo' , 'Voh' ) #NEWLINE# catalog . add ( ( 'There is' , 'There are' ) , ( 'Es gibt' , 'Es gibt' ) ) #NEWLINE# catalog . add ( 'Fizz' , '' ) #NEWLINE# catalog . add ( ( 'Fuzz' , 'Fuzzes' ) , ( '' , '' ) ) #NEWLINE# buf = StringIO ( ) #NEWLINE# mofile . write_mo ( buf , catalog ) #NEWLINE# buf . seek ( 0 ) #NEWLINE# translations = gettext . GNUTranslations ( fp = buf ) #NEWLINE# self . assertEqual ( 'Voh' , translations . ugettext ( 'foo' ) ) #NEWLINE# assert isinstance ( translations . ugettext ( 'foo' ) , unicode ) #NEWLINE# self . assertEqual ( 'Es gibt' , translations . ungettext ( 'There is' , 'There are' , 1 ) ) #NEWLINE# assert isinstance ( translations . ungettext ( 'There is' , 'There are' , 1 ) , unicode ) #NEWLINE# self . assertEqual ( 'Fizz' , translations . ugettext ( 'Fizz' ) ) #NEWLINE# assert isinstance ( translations . ugettext ( 'Fizz' ) , unicode ) #NEWLINE# self . assertEqual ( 'Fuzz' , translations . ugettext ( 'Fuzz' ) ) #NEWLINE# assert isinstance ( translations . ugettext ( 'Fuzz' ) , unicode ) #NEWLINE# self . assertEqual ( 'Fuzzes' , translations . ugettext ( 'Fuzzes' ) ) #NEWLINE# assert isinstance ( translations . ugettext ( 'Fuzzes' ) , unicode )