#NEWLINE# def test_strings_parser( self ) : #NEWLINE# #INDENT# 'STRINGS parsing tests.' #NEWLINE# files = [ 'test_utf_16.strings' , 'test_utf_8.strings' ] #NEWLINE# for i in range ( 1 , 9 ) : #NEWLINE# #INDENT# files . append ( ( 'bad%d.strings' % i ) ) #NEWLINE# #UNINDENT# for file_ in files : #NEWLINE# #INDENT# handler = AppleStringsHandler ( ) #NEWLINE# handler . bind_file ( os . path . join ( os . path . dirname ( __file__ ) , file_ ) ) #NEWLINE# handler . set_language ( self . resource . source_language ) #NEWLINE# if ( file_ in [ 'test_utf_16.strings' , 'test_utf_8.strings' ] ) : #NEWLINE# #INDENT# handler . parse_file ( is_source = True ) #NEWLINE# self . stringset = handler . stringset #NEWLINE# entities = 0 #NEWLINE# translations = 0 #NEWLINE# for s in self . stringset . strings : #NEWLINE# #INDENT# entities += 1 #NEWLINE# if ( s . translation . strip ( ) != '' ) : #NEWLINE# #INDENT# translations += 1 #NEWLINE# #UNINDENT# #UNINDENT# self . assertEqual ( entities , 4 ) #NEWLINE# self . assertEqual ( translations , 4 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . assertRaises ( StringsParseError , handler . parse_file , is_source = True )