2 # vim: set fileencoding=utf-8 :
4 Test the BaseL10N class to ensure that we have a solid foundation.
12 class TestBaseL10N(unittest.TestCase):
16 'msgid': 'Using Library',
17 'msgstr': 'Utiliser la bibliothèque',
19 {'line': 240, 'name': 'field.aihu.org_unit.label'},
20 {'line': 257, 'name': 'field.ancihu.org_unit.label'},
23 'msgid': '\nSuper crazy long and repetitive message ID from hell\nSuper crazy long and repetitive message ID from hell\nSuper crazy long and repetitive message ID from hell\nSuper crazy long and repetitive message ID from hell\nSuper crazy long and repetitive message ID from hell',
26 {'line': 2475, 'name': 'field.rxbt.voided.label'},
29 'msgid': 'Record Source',
31 {'line': 524, 'name': 'field.bre.source.label'},
36 sys.path.append('../scripts/')
38 for dir in self.tmpdirs:
42 for dir in self.tmpdirs:
43 if os.access(dir, os.F_OK):
44 for file in os.listdir(dir):
45 os.remove(os.path.join(dir, file))
50 Load a translated PO file and compare to a generated one
53 poload = basel10n.BaseL10N()
54 poload.loadpo('data/complex.po')
55 pogen = basel10n.BaseL10N()
56 pogen.pothead('Evergreen 1.4', '1999-12-31 23:59:59 -0400')
57 pogen.pot.metadata['PO-Revision-Date'] = '2007-12-08 23:14:20 -0400'
58 pogen.pot.metadata['Last-Translator'] = ' Dan Scott <dscott@laurentian.ca>'
59 pogen.pot.metadata['Language-Team'] = 'fr-CA <LL@li.org>'
60 for msg in self.poentries:
62 for x in msg['occurences']:
63 poe.occurences.append((x['line'], x['name']))
64 poe.msgid = msg['msgid']
65 if msg.has_key('msgstr'):
66 poe.msgstr = msg['msgstr']
69 self.assertEqual(str(poload), str(pogen))
71 if __name__ == '__main__':