current.id = message.id
current.string = message.string
current.locations.extend(message.locations)
- current.auto_comments.extend(message.auto_comments)
- current.user_comments.extend(message.user_comments)
+ current.auto_comments = list(distinct(current.auto_comments +
+ message.auto_comments))
+ current.user_comments = list(distinct(current.user_comments +
+ message.user_comments))
current.flags |= message.flags
message = current
elif id == '':
self.assertEqual(1, len(cat))
def test_duplicate_auto_comment(self):
- msg = catalog.Message('foo', auto_comments=['A comment', 'A comment'])
- self.assertEqual(['A comment'], msg.auto_comments)
+ cat = catalog.Catalog()
+ cat.add('foo', auto_comments=['A comment'])
+ cat.add('foo', auto_comments=['A comment', 'Another comment'])
+ self.assertEqual(['A comment', 'Another comment'],
+ cat['foo'].auto_comments)
def test_duplicate_user_comment(self):
- msg = catalog.Message('foo', user_comments=['A comment', 'A comment'])
- self.assertEqual(['A comment'], msg.user_comments)
+ cat = catalog.Catalog()
+ cat.add('foo', user_comments=['A comment'])
+ cat.add('foo', user_comments=['A comment', 'Another comment'])
+ self.assertEqual(['A comment', 'Another comment'],
+ cat['foo'].user_comments)
def test_update_message_updates_comments(self):
cat = catalog.Catalog()
pofile.write_po(buf, catalog, omit_header=True)
self.assertEqual('''#: main.py:1 utils.py:3
msgid "foo"
+msgstr ""''', buf.getvalue().strip())
+
+ def test_duplicate_comments(self):
+ catalog = Catalog()
+ catalog.add(u'foo', auto_comments=['A comment'])
+ catalog.add(u'foo', auto_comments=['A comment'])
+ buf = StringIO()
+ pofile.write_po(buf, catalog, omit_header=True)
+ self.assertEqual('''#. A comment
+msgid "foo"
msgstr ""''', buf.getvalue().strip())
def test_wrap_long_lines(self):