comparison babel/messages/tests/pofile.py @ 293:e1c100327308 stable-0.9.x

Merged revisions 321-323 via svnmerge from http://svn.edgewall.org/repos/babel/trunk ........ r321 | pjenvey | 2007-09-27 21:44:55 -0700 (Thu, 27 Sep 2007) | 1 line we must mean options.locale here ........ r322 | pjenvey | 2007-09-27 22:16:25 -0700 (Thu, 27 Sep 2007) | 2 lines fix catalogs' charset values not being recognized thanks Jose Galvez ........ r323 | pjenvey | 2007-09-27 22:18:27 -0700 (Thu, 27 Sep 2007) | 1 line woops, misplaced changelog ........
author pjenvey
date Fri, 28 Sep 2007 05:25:20 +0000
parents 00960ab0a631
children 5e80cf8e3299
comparison
equal deleted inserted replaced
289:09528558c0cd 293:e1c100327308
16 from StringIO import StringIO 16 from StringIO import StringIO
17 import unittest 17 import unittest
18 18
19 from babel.messages.catalog import Catalog, Message 19 from babel.messages.catalog import Catalog, Message
20 from babel.messages import pofile 20 from babel.messages import pofile
21 from babel.util import FixedOffsetTimezone, LOCALTZ
21 22
22 23
23 class ReadPoTestCase(unittest.TestCase): 24 class ReadPoTestCase(unittest.TestCase):
24 25
25 def test_preserve_locale(self): 26 def test_preserve_locale(self):
72 # 73 #
73 ''') 74 ''')
74 catalog = pofile.read_po(buf) 75 catalog = pofile.read_po(buf)
75 self.assertEqual(1, len(list(catalog))) 76 self.assertEqual(1, len(list(catalog)))
76 self.assertEqual(False, list(catalog)[0].fuzzy) 77 self.assertEqual(False, list(catalog)[0].fuzzy)
78
79 def test_header_entry(self):
80 buf = StringIO(r'''\
81 # SOME DESCRIPTIVE TITLE.
82 # Copyright (C) 2007 THE PACKAGE'S COPYRIGHT HOLDER
83 # This file is distributed under the same license as the PACKAGE package.
84 # FIRST AUTHOR <EMAIL@ADDRESS>, 2007.
85 #
86 #, fuzzy
87 msgid ""
88 msgstr ""
89 "Project-Id-Version: 3.15\n"
90 "Report-Msgid-Bugs-To: Fliegender Zirkus <fliegender@zirkus.de>\n"
91 "POT-Creation-Date: 2007-09-27 11:19+0700\n"
92 "PO-Revision-Date: 2007-09-27 21:42-0700\n"
93 "Last-Translator: John <cleese@bavaria.de>\n"
94 "Language-Team: German Lang <de@babel.org>\n"
95 "Plural-Forms: nplurals=2; plural=(n != 1)\n"
96 "MIME-Version: 1.0\n"
97 "Content-Type: text/plain; charset=iso-8859-2\n"
98 "Content-Transfer-Encoding: 8bit\n"
99 "Generated-By: Babel 1.0dev-r313\n"
100 ''')
101 catalog = pofile.read_po(buf)
102 self.assertEqual(1, len(list(catalog)))
103 self.assertEqual(u'3.15', catalog.version)
104 self.assertEqual(u'Fliegender Zirkus <fliegender@zirkus.de>',
105 catalog.msgid_bugs_address)
106 self.assertEqual(datetime(2007, 9, 27, 11, 19,
107 tzinfo=FixedOffsetTimezone(7 * 60)),
108 catalog.creation_date)
109 self.assertEqual(u'John <cleese@bavaria.de>', catalog.last_translator)
110 self.assertEqual(u'German Lang <de@babel.org>', catalog.language_team)
111 self.assertEqual(u'iso-8859-2', catalog.charset)
112 self.assertEqual(True, list(catalog)[0].fuzzy)
77 113
78 def test_obsolete_message(self): 114 def test_obsolete_message(self):
79 buf = StringIO(r'''# This is an obsolete message 115 buf = StringIO(r'''# This is an obsolete message
80 #~ msgid "foo" 116 #~ msgid "foo"
81 #~ msgstr "Voh" 117 #~ msgstr "Voh"
Copyright (C) 2012-2017 Edgewall Software