comparison babel/messages/tests/catalog.py @ 91:f517ad70d8fc

Unittest for the problem reported by pjenvey fixed on [88].
author palgarvio
date Mon, 11 Jun 2007 20:22:49 +0000
parents f421e5576d26
children debd9ac3bb4d
comparison
equal deleted inserted replaced
90:cbc44fce25aa 91:f517ad70d8fc
40 def test_two_messages_with_same_singular(self): 40 def test_two_messages_with_same_singular(self):
41 cat = catalog.Catalog() 41 cat = catalog.Catalog()
42 cat.add('foo') 42 cat.add('foo')
43 cat.add(('foo', 'foos')) 43 cat.add(('foo', 'foos'))
44 self.assertEqual(1, len(cat)) 44 self.assertEqual(1, len(cat))
45
46 def test_update_message_updates_comments(self):
47 cat = catalog.Catalog()
48 cat[u'foo'] = catalog.Message('foo', locations=[('main.py', 5)])
49 self.assertEqual(cat[u'foo'].comments, [])
50 # Update cat[u'foo'] with a new location and a comment
51 cat[u'foo'] = catalog.Message('foo', locations=[('main.py', 7)],
52 comments=['Foo Bar comment 1'])
53 self.assertEqual(cat[u'foo'].comments, ['Foo Bar comment 1'])
54 # now add yet another location with another comment
55 cat[u'foo'] = catalog.Message('foo', locations=[('main.py', 9)],
56 comments=['Foo Bar comment 2'])
57 self.assertEqual(cat[u'foo'].comments,
58 ['Foo Bar comment 1', 'Foo Bar comment 2'])
45 59
46 60
47 def suite(): 61 def suite():
48 suite = unittest.TestSuite() 62 suite = unittest.TestSuite()
49 suite.addTest(doctest.DocTestSuite(catalog, optionflags=doctest.ELLIPSIS)) 63 suite.addTest(doctest.DocTestSuite(catalog, optionflags=doctest.ELLIPSIS))
Copyright (C) 2012-2017 Edgewall Software