comparison babel/messages/tests/catalog.py @ 421:cadc2f937a78

Testcase for fix of #148.
author palgarvio
date Tue, 16 Dec 2008 13:35:23 +0000
parents 1b78b747b386
children d07989336794
comparison
equal deleted inserted replaced
420:b00041003734 421:cadc2f937a78
9 # 9 #
10 # This software consists of voluntary contributions made by many 10 # This software consists of voluntary contributions made by many
11 # individuals. For the exact contribution history, see the revision 11 # individuals. For the exact contribution history, see the revision
12 # history and logs, available at http://babel.edgewall.org/log/. 12 # history and logs, available at http://babel.edgewall.org/log/.
13 13
14 import copy
15 import datetime
14 import doctest 16 import doctest
15 import unittest 17 import unittest
16 18
17 from babel.messages import catalog 19 from babel.messages import catalog
18 20
222 cat2 = catalog.Catalog() 224 cat2 = catalog.Catalog()
223 cat2.update(tmpl) 225 cat2.update(tmpl)
224 226
225 self.assertEqual(None, cat2['foo'].string) 227 self.assertEqual(None, cat2['foo'].string)
226 self.assertEqual(False, cat2['foo'].fuzzy) 228 self.assertEqual(False, cat2['foo'].fuzzy)
229
230 def test_update_po_updates_pot_creation_date(self):
231 template = catalog.Catalog()
232 localized_catalog = copy.deepcopy(template)
233 localized_catalog.locale = 'de_DE'
234 self.assertNotEqual(template.mime_headers,
235 localized_catalog.mime_headers)
236 self.assertEqual(template.creation_date,
237 localized_catalog.creation_date)
238 template.creation_date = datetime.datetime.now() - \
239 datetime.timedelta(minutes=5)
240 localized_catalog.update(template)
241 self.assertEqual(template.creation_date,
242 localized_catalog.creation_date)
227 243
228 244
229 def suite(): 245 def suite():
230 suite = unittest.TestSuite() 246 suite = unittest.TestSuite()
231 suite.addTest(doctest.DocTestSuite(catalog, optionflags=doctest.ELLIPSIS)) 247 suite.addTest(doctest.DocTestSuite(catalog, optionflags=doctest.ELLIPSIS))
Copyright (C) 2012-2017 Edgewall Software