annotate babel/messages/tests/catalog.py @ 278:709410bfd67c stable-0.9.x

Ported [305] to 0.9.x branch.
author cmlenz
date Tue, 04 Sep 2007 15:12:23 +0000
parents 2097287603e7
children 61e6b1933af4 274506f102ed
rev   line source
56
27fba894d3ca Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
1 # -*- coding: utf-8 -*-
27fba894d3ca Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
2 #
27fba894d3ca Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
3 # Copyright (C) 2007 Edgewall Software
27fba894d3ca Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
4 # All rights reserved.
27fba894d3ca Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
5 #
27fba894d3ca Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
6 # This software is licensed as described in the file COPYING, which
27fba894d3ca Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
7 # you should have received as part of this distribution. The terms
27fba894d3ca Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
8 # are also available at http://babel.edgewall.org/wiki/License.
27fba894d3ca Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
9 #
27fba894d3ca Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
10 # This software consists of voluntary contributions made by many
27fba894d3ca Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
11 # individuals. For the exact contribution history, see the revision
27fba894d3ca Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
12 # history and logs, available at http://babel.edgewall.org/log/.
27fba894d3ca Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
13
27fba894d3ca Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
14 import doctest
27fba894d3ca Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
15 import unittest
27fba894d3ca Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
16
27fba894d3ca Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
17 from babel.messages import catalog
27fba894d3ca Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
18
27fba894d3ca Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
19
27fba894d3ca Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
20 class MessageTestCase(unittest.TestCase):
27fba894d3ca Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
21
27fba894d3ca Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
22 def test_python_format(self):
220
677147547e2d Added infrastructure for adding catalog checkers, and implement a checker that validations Python format parameters in translations, closing #19.
cmlenz
parents: 200
diff changeset
23 assert catalog.PYTHON_FORMAT.search('foo %d bar')
677147547e2d Added infrastructure for adding catalog checkers, and implement a checker that validations Python format parameters in translations, closing #19.
cmlenz
parents: 200
diff changeset
24 assert catalog.PYTHON_FORMAT.search('foo %s bar')
677147547e2d Added infrastructure for adding catalog checkers, and implement a checker that validations Python format parameters in translations, closing #19.
cmlenz
parents: 200
diff changeset
25 assert catalog.PYTHON_FORMAT.search('foo %r bar')
225
3703ded648ab Applied patch by Ramiro Morales for more extensive detection of Python string formatting specifiers. Closes #57.
cmlenz
parents: 220
diff changeset
26 assert catalog.PYTHON_FORMAT.search('foo %(name).1f')
3703ded648ab Applied patch by Ramiro Morales for more extensive detection of Python string formatting specifiers. Closes #57.
cmlenz
parents: 220
diff changeset
27 assert catalog.PYTHON_FORMAT.search('foo %(name)3.3f')
3703ded648ab Applied patch by Ramiro Morales for more extensive detection of Python string formatting specifiers. Closes #57.
cmlenz
parents: 220
diff changeset
28 assert catalog.PYTHON_FORMAT.search('foo %(name)3f')
3703ded648ab Applied patch by Ramiro Morales for more extensive detection of Python string formatting specifiers. Closes #57.
cmlenz
parents: 220
diff changeset
29 assert catalog.PYTHON_FORMAT.search('foo %(name)06d')
3703ded648ab Applied patch by Ramiro Morales for more extensive detection of Python string formatting specifiers. Closes #57.
cmlenz
parents: 220
diff changeset
30 assert catalog.PYTHON_FORMAT.search('foo %(name)Li')
3703ded648ab Applied patch by Ramiro Morales for more extensive detection of Python string formatting specifiers. Closes #57.
cmlenz
parents: 220
diff changeset
31 assert catalog.PYTHON_FORMAT.search('foo %(name)#d')
3703ded648ab Applied patch by Ramiro Morales for more extensive detection of Python string formatting specifiers. Closes #57.
cmlenz
parents: 220
diff changeset
32 assert catalog.PYTHON_FORMAT.search('foo %(name)-4.4hs')
3703ded648ab Applied patch by Ramiro Morales for more extensive detection of Python string formatting specifiers. Closes #57.
cmlenz
parents: 220
diff changeset
33 assert catalog.PYTHON_FORMAT.search('foo %(name)*.3f')
3703ded648ab Applied patch by Ramiro Morales for more extensive detection of Python string formatting specifiers. Closes #57.
cmlenz
parents: 220
diff changeset
34 assert catalog.PYTHON_FORMAT.search('foo %(name).*f')
3703ded648ab Applied patch by Ramiro Morales for more extensive detection of Python string formatting specifiers. Closes #57.
cmlenz
parents: 220
diff changeset
35 assert catalog.PYTHON_FORMAT.search('foo %(name)3.*f')
3703ded648ab Applied patch by Ramiro Morales for more extensive detection of Python string formatting specifiers. Closes #57.
cmlenz
parents: 220
diff changeset
36 assert catalog.PYTHON_FORMAT.search('foo %(name)*.*f')
105
f744dd56573d `Message`, `read_po` and `write_po` now all handle user/auto comments correctly.
palgarvio
parents: 95
diff changeset
37
80
9c84b9fa5d30 Added support for translator comments at the API and frontends levels.(See #12, item 1). Updated docs and tests accordingly.
palgarvio
parents: 69
diff changeset
38 def test_translator_comments(self):
105
f744dd56573d `Message`, `read_po` and `write_po` now all handle user/auto comments correctly.
palgarvio
parents: 95
diff changeset
39 mess = catalog.Message('foo', user_comments=['Comment About `foo`'])
200
2983c718f6e2 Added `--no-fuzzy-matching` to the frontends and also `--previous` which adds the old msgid's as comments. The latest closes #31.
palgarvio
parents: 181
diff changeset
40 self.assertEqual(mess.user_comments, ['Comment About `foo`'])
80
9c84b9fa5d30 Added support for translator comments at the API and frontends levels.(See #12, item 1). Updated docs and tests accordingly.
palgarvio
parents: 69
diff changeset
41 mess = catalog.Message('foo',
105
f744dd56573d `Message`, `read_po` and `write_po` now all handle user/auto comments correctly.
palgarvio
parents: 95
diff changeset
42 auto_comments=['Comment 1 About `foo`',
80
9c84b9fa5d30 Added support for translator comments at the API and frontends levels.(See #12, item 1). Updated docs and tests accordingly.
palgarvio
parents: 69
diff changeset
43 'Comment 2 About `foo`'])
105
f744dd56573d `Message`, `read_po` and `write_po` now all handle user/auto comments correctly.
palgarvio
parents: 95
diff changeset
44 self.assertEqual(mess.auto_comments, ['Comment 1 About `foo`',
80
9c84b9fa5d30 Added support for translator comments at the API and frontends levels.(See #12, item 1). Updated docs and tests accordingly.
palgarvio
parents: 69
diff changeset
45 'Comment 2 About `foo`'])
56
27fba894d3ca Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
46
27fba894d3ca Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
47
69
9b8079807245 Message catalogs can have multiple messages with the same ID, where some of them have plural strings, and others don't. Still the same message.
cmlenz
parents: 67
diff changeset
48 class CatalogTestCase(unittest.TestCase):
9b8079807245 Message catalogs can have multiple messages with the same ID, where some of them have plural strings, and others don't. Still the same message.
cmlenz
parents: 67
diff changeset
49
9b8079807245 Message catalogs can have multiple messages with the same ID, where some of them have plural strings, and others don't. Still the same message.
cmlenz
parents: 67
diff changeset
50 def test_two_messages_with_same_singular(self):
9b8079807245 Message catalogs can have multiple messages with the same ID, where some of them have plural strings, and others don't. Still the same message.
cmlenz
parents: 67
diff changeset
51 cat = catalog.Catalog()
9b8079807245 Message catalogs can have multiple messages with the same ID, where some of them have plural strings, and others don't. Still the same message.
cmlenz
parents: 67
diff changeset
52 cat.add('foo')
9b8079807245 Message catalogs can have multiple messages with the same ID, where some of them have plural strings, and others don't. Still the same message.
cmlenz
parents: 67
diff changeset
53 cat.add(('foo', 'foos'))
9b8079807245 Message catalogs can have multiple messages with the same ID, where some of them have plural strings, and others don't. Still the same message.
cmlenz
parents: 67
diff changeset
54 self.assertEqual(1, len(cat))
95
008cd3f7d485 Fix for #11 (use local timezone in timestamps of generated POT).
cmlenz
parents: 89
diff changeset
55
227
01dd895f396c Fix tests broken by [233], and add new tests.
cmlenz
parents: 225
diff changeset
56 def test_duplicate_auto_comment(self):
228
fd29fabdc986 Follow-up to [239]: also combine duplicate comments when writing PO files.
cmlenz
parents: 227
diff changeset
57 cat = catalog.Catalog()
fd29fabdc986 Follow-up to [239]: also combine duplicate comments when writing PO files.
cmlenz
parents: 227
diff changeset
58 cat.add('foo', auto_comments=['A comment'])
fd29fabdc986 Follow-up to [239]: also combine duplicate comments when writing PO files.
cmlenz
parents: 227
diff changeset
59 cat.add('foo', auto_comments=['A comment', 'Another comment'])
fd29fabdc986 Follow-up to [239]: also combine duplicate comments when writing PO files.
cmlenz
parents: 227
diff changeset
60 self.assertEqual(['A comment', 'Another comment'],
fd29fabdc986 Follow-up to [239]: also combine duplicate comments when writing PO files.
cmlenz
parents: 227
diff changeset
61 cat['foo'].auto_comments)
227
01dd895f396c Fix tests broken by [233], and add new tests.
cmlenz
parents: 225
diff changeset
62
01dd895f396c Fix tests broken by [233], and add new tests.
cmlenz
parents: 225
diff changeset
63 def test_duplicate_user_comment(self):
228
fd29fabdc986 Follow-up to [239]: also combine duplicate comments when writing PO files.
cmlenz
parents: 227
diff changeset
64 cat = catalog.Catalog()
fd29fabdc986 Follow-up to [239]: also combine duplicate comments when writing PO files.
cmlenz
parents: 227
diff changeset
65 cat.add('foo', user_comments=['A comment'])
fd29fabdc986 Follow-up to [239]: also combine duplicate comments when writing PO files.
cmlenz
parents: 227
diff changeset
66 cat.add('foo', user_comments=['A comment', 'Another comment'])
fd29fabdc986 Follow-up to [239]: also combine duplicate comments when writing PO files.
cmlenz
parents: 227
diff changeset
67 self.assertEqual(['A comment', 'Another comment'],
fd29fabdc986 Follow-up to [239]: also combine duplicate comments when writing PO files.
cmlenz
parents: 227
diff changeset
68 cat['foo'].user_comments)
227
01dd895f396c Fix tests broken by [233], and add new tests.
cmlenz
parents: 225
diff changeset
69
230
2097287603e7 Forgot to update test method name after copy/paste.
cmlenz
parents: 229
diff changeset
70 def test_duplicate_location(self):
229
9a3f2acb55e6 Remove duplicate locations of catalog messages.
cmlenz
parents: 228
diff changeset
71 cat = catalog.Catalog()
9a3f2acb55e6 Remove duplicate locations of catalog messages.
cmlenz
parents: 228
diff changeset
72 cat.add('foo', locations=[('foo.py', 1)])
9a3f2acb55e6 Remove duplicate locations of catalog messages.
cmlenz
parents: 228
diff changeset
73 cat.add('foo', locations=[('foo.py', 1)])
9a3f2acb55e6 Remove duplicate locations of catalog messages.
cmlenz
parents: 228
diff changeset
74 self.assertEqual([('foo.py', 1)], cat['foo'].locations)
9a3f2acb55e6 Remove duplicate locations of catalog messages.
cmlenz
parents: 228
diff changeset
75
278
709410bfd67c Ported [305] to 0.9.x branch.
cmlenz
parents: 230
diff changeset
76 def test_update_message_changed_to_plural(self):
709410bfd67c Ported [305] to 0.9.x branch.
cmlenz
parents: 230
diff changeset
77 cat = catalog.Catalog()
709410bfd67c Ported [305] to 0.9.x branch.
cmlenz
parents: 230
diff changeset
78 cat.add(u'foo', u'Voh')
709410bfd67c Ported [305] to 0.9.x branch.
cmlenz
parents: 230
diff changeset
79 tmpl = catalog.Catalog()
709410bfd67c Ported [305] to 0.9.x branch.
cmlenz
parents: 230
diff changeset
80 tmpl.add((u'foo', u'foos'))
709410bfd67c Ported [305] to 0.9.x branch.
cmlenz
parents: 230
diff changeset
81 cat.update(tmpl)
709410bfd67c Ported [305] to 0.9.x branch.
cmlenz
parents: 230
diff changeset
82 self.assertEqual((u'Voh', ''), cat['foo'].string)
709410bfd67c Ported [305] to 0.9.x branch.
cmlenz
parents: 230
diff changeset
83 assert cat['foo'].fuzzy
709410bfd67c Ported [305] to 0.9.x branch.
cmlenz
parents: 230
diff changeset
84
709410bfd67c Ported [305] to 0.9.x branch.
cmlenz
parents: 230
diff changeset
85 def test_update_message_changed_to_simple(self):
709410bfd67c Ported [305] to 0.9.x branch.
cmlenz
parents: 230
diff changeset
86 cat = catalog.Catalog()
709410bfd67c Ported [305] to 0.9.x branch.
cmlenz
parents: 230
diff changeset
87 cat.add((u'foo' u'foos'), (u'Voh', u'Vöhs'))
709410bfd67c Ported [305] to 0.9.x branch.
cmlenz
parents: 230
diff changeset
88 tmpl = catalog.Catalog()
709410bfd67c Ported [305] to 0.9.x branch.
cmlenz
parents: 230
diff changeset
89 tmpl.add(u'foo')
709410bfd67c Ported [305] to 0.9.x branch.
cmlenz
parents: 230
diff changeset
90 cat.update(tmpl)
709410bfd67c Ported [305] to 0.9.x branch.
cmlenz
parents: 230
diff changeset
91 self.assertEqual(u'Voh', cat['foo'].string)
709410bfd67c Ported [305] to 0.9.x branch.
cmlenz
parents: 230
diff changeset
92 assert cat['foo'].fuzzy
709410bfd67c Ported [305] to 0.9.x branch.
cmlenz
parents: 230
diff changeset
93
89
5a456b7ebc0a Unittest for the problem reported by pjenvey fixed on [88].
palgarvio
parents: 80
diff changeset
94 def test_update_message_updates_comments(self):
5a456b7ebc0a Unittest for the problem reported by pjenvey fixed on [88].
palgarvio
parents: 80
diff changeset
95 cat = catalog.Catalog()
5a456b7ebc0a Unittest for the problem reported by pjenvey fixed on [88].
palgarvio
parents: 80
diff changeset
96 cat[u'foo'] = catalog.Message('foo', locations=[('main.py', 5)])
105
f744dd56573d `Message`, `read_po` and `write_po` now all handle user/auto comments correctly.
palgarvio
parents: 95
diff changeset
97 self.assertEqual(cat[u'foo'].auto_comments, [])
f744dd56573d `Message`, `read_po` and `write_po` now all handle user/auto comments correctly.
palgarvio
parents: 95
diff changeset
98 self.assertEqual(cat[u'foo'].user_comments, [])
89
5a456b7ebc0a Unittest for the problem reported by pjenvey fixed on [88].
palgarvio
parents: 80
diff changeset
99 # Update cat[u'foo'] with a new location and a comment
5a456b7ebc0a Unittest for the problem reported by pjenvey fixed on [88].
palgarvio
parents: 80
diff changeset
100 cat[u'foo'] = catalog.Message('foo', locations=[('main.py', 7)],
105
f744dd56573d `Message`, `read_po` and `write_po` now all handle user/auto comments correctly.
palgarvio
parents: 95
diff changeset
101 user_comments=['Foo Bar comment 1'])
f744dd56573d `Message`, `read_po` and `write_po` now all handle user/auto comments correctly.
palgarvio
parents: 95
diff changeset
102 self.assertEqual(cat[u'foo'].user_comments, ['Foo Bar comment 1'])
89
5a456b7ebc0a Unittest for the problem reported by pjenvey fixed on [88].
palgarvio
parents: 80
diff changeset
103 # now add yet another location with another comment
5a456b7ebc0a Unittest for the problem reported by pjenvey fixed on [88].
palgarvio
parents: 80
diff changeset
104 cat[u'foo'] = catalog.Message('foo', locations=[('main.py', 9)],
200
2983c718f6e2 Added `--no-fuzzy-matching` to the frontends and also `--previous` which adds the old msgid's as comments. The latest closes #31.
palgarvio
parents: 181
diff changeset
105 auto_comments=['Foo Bar comment 2'])
105
f744dd56573d `Message`, `read_po` and `write_po` now all handle user/auto comments correctly.
palgarvio
parents: 95
diff changeset
106 self.assertEqual(cat[u'foo'].auto_comments, ['Foo Bar comment 2'])
69
9b8079807245 Message catalogs can have multiple messages with the same ID, where some of them have plural strings, and others don't. Still the same message.
cmlenz
parents: 67
diff changeset
107
165
650a6e996ede Implement fuzzy matching to catalog updates. No frontend yet.
cmlenz
parents: 111
diff changeset
108 def test_update_fuzzy_matching_with_case_change(self):
650a6e996ede Implement fuzzy matching to catalog updates. No frontend yet.
cmlenz
parents: 111
diff changeset
109 cat = catalog.Catalog()
650a6e996ede Implement fuzzy matching to catalog updates. No frontend yet.
cmlenz
parents: 111
diff changeset
110 cat.add('foo', 'Voh')
650a6e996ede Implement fuzzy matching to catalog updates. No frontend yet.
cmlenz
parents: 111
diff changeset
111 cat.add('bar', 'Bahr')
650a6e996ede Implement fuzzy matching to catalog updates. No frontend yet.
cmlenz
parents: 111
diff changeset
112 tmpl = catalog.Catalog()
650a6e996ede Implement fuzzy matching to catalog updates. No frontend yet.
cmlenz
parents: 111
diff changeset
113 tmpl.add('Foo')
181
9a1acb41e7dd The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents: 165
diff changeset
114 cat.update(tmpl)
9a1acb41e7dd The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents: 165
diff changeset
115 self.assertEqual(1, len(cat.obsolete))
165
650a6e996ede Implement fuzzy matching to catalog updates. No frontend yet.
cmlenz
parents: 111
diff changeset
116 assert 'foo' not in cat
650a6e996ede Implement fuzzy matching to catalog updates. No frontend yet.
cmlenz
parents: 111
diff changeset
117
650a6e996ede Implement fuzzy matching to catalog updates. No frontend yet.
cmlenz
parents: 111
diff changeset
118 self.assertEqual('Voh', cat['Foo'].string)
650a6e996ede Implement fuzzy matching to catalog updates. No frontend yet.
cmlenz
parents: 111
diff changeset
119 self.assertEqual(True, cat['Foo'].fuzzy)
650a6e996ede Implement fuzzy matching to catalog updates. No frontend yet.
cmlenz
parents: 111
diff changeset
120
650a6e996ede Implement fuzzy matching to catalog updates. No frontend yet.
cmlenz
parents: 111
diff changeset
121 def test_update_fuzzy_matching_with_char_change(self):
650a6e996ede Implement fuzzy matching to catalog updates. No frontend yet.
cmlenz
parents: 111
diff changeset
122 cat = catalog.Catalog()
650a6e996ede Implement fuzzy matching to catalog updates. No frontend yet.
cmlenz
parents: 111
diff changeset
123 cat.add('fo', 'Voh')
650a6e996ede Implement fuzzy matching to catalog updates. No frontend yet.
cmlenz
parents: 111
diff changeset
124 cat.add('bar', 'Bahr')
650a6e996ede Implement fuzzy matching to catalog updates. No frontend yet.
cmlenz
parents: 111
diff changeset
125 tmpl = catalog.Catalog()
650a6e996ede Implement fuzzy matching to catalog updates. No frontend yet.
cmlenz
parents: 111
diff changeset
126 tmpl.add('foo')
181
9a1acb41e7dd The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents: 165
diff changeset
127 cat.update(tmpl)
9a1acb41e7dd The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents: 165
diff changeset
128 self.assertEqual(1, len(cat.obsolete))
165
650a6e996ede Implement fuzzy matching to catalog updates. No frontend yet.
cmlenz
parents: 111
diff changeset
129 assert 'fo' not in cat
650a6e996ede Implement fuzzy matching to catalog updates. No frontend yet.
cmlenz
parents: 111
diff changeset
130
650a6e996ede Implement fuzzy matching to catalog updates. No frontend yet.
cmlenz
parents: 111
diff changeset
131 self.assertEqual('Voh', cat['foo'].string)
650a6e996ede Implement fuzzy matching to catalog updates. No frontend yet.
cmlenz
parents: 111
diff changeset
132 self.assertEqual(True, cat['foo'].fuzzy)
650a6e996ede Implement fuzzy matching to catalog updates. No frontend yet.
cmlenz
parents: 111
diff changeset
133
650a6e996ede Implement fuzzy matching to catalog updates. No frontend yet.
cmlenz
parents: 111
diff changeset
134 def test_update_without_fuzzy_matching(self):
650a6e996ede Implement fuzzy matching to catalog updates. No frontend yet.
cmlenz
parents: 111
diff changeset
135 cat = catalog.Catalog()
650a6e996ede Implement fuzzy matching to catalog updates. No frontend yet.
cmlenz
parents: 111
diff changeset
136 cat.add('fo', 'Voh')
650a6e996ede Implement fuzzy matching to catalog updates. No frontend yet.
cmlenz
parents: 111
diff changeset
137 cat.add('bar', 'Bahr')
650a6e996ede Implement fuzzy matching to catalog updates. No frontend yet.
cmlenz
parents: 111
diff changeset
138 tmpl = catalog.Catalog()
650a6e996ede Implement fuzzy matching to catalog updates. No frontend yet.
cmlenz
parents: 111
diff changeset
139 tmpl.add('foo')
200
2983c718f6e2 Added `--no-fuzzy-matching` to the frontends and also `--previous` which adds the old msgid's as comments. The latest closes #31.
palgarvio
parents: 181
diff changeset
140 cat.update(tmpl, no_fuzzy_matching=True)
181
9a1acb41e7dd The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents: 165
diff changeset
141 self.assertEqual(2, len(cat.obsolete))
165
650a6e996ede Implement fuzzy matching to catalog updates. No frontend yet.
cmlenz
parents: 111
diff changeset
142
69
9b8079807245 Message catalogs can have multiple messages with the same ID, where some of them have plural strings, and others don't. Still the same message.
cmlenz
parents: 67
diff changeset
143
56
27fba894d3ca Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
144 def suite():
27fba894d3ca Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
145 suite = unittest.TestSuite()
67
5496b9127a07 Enhance catalog to also manage the MIME headers.
cmlenz
parents: 56
diff changeset
146 suite.addTest(doctest.DocTestSuite(catalog, optionflags=doctest.ELLIPSIS))
56
27fba894d3ca Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
147 suite.addTest(unittest.makeSuite(MessageTestCase))
69
9b8079807245 Message catalogs can have multiple messages with the same ID, where some of them have plural strings, and others don't. Still the same message.
cmlenz
parents: 67
diff changeset
148 suite.addTest(unittest.makeSuite(CatalogTestCase))
56
27fba894d3ca Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
149 return suite
27fba894d3ca Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
150
27fba894d3ca Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
151 if __name__ == '__main__':
27fba894d3ca Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
diff changeset
152 unittest.main(defaultTest='suite')
Copyright (C) 2012-2017 Edgewall Software