Mercurial > babel > old > mirror
comparison babel/messages/tests/extract.py @ 87:f140be344563
Fixed de-pluralization bug introduced in [85] regarding the extraction of translator comments.
Added a unittest which tests the extraction of translator comments that have non-translator comments right before the comment tag.
author | palgarvio |
---|---|
date | Sun, 10 Jun 2007 21:14:38 +0000 |
parents | e10f82c1d4c4 |
children | 30ed605cff51 |
comparison
equal
deleted
inserted
replaced
86:8a703ecdba91 | 87:f140be344563 |
---|---|
42 """) | 42 """) |
43 messages = list(extract.extract_python(buf, ('_',), ['NOTE'], {})) | 43 messages = list(extract.extract_python(buf, ('_',), ['NOTE'], {})) |
44 self.assertEqual('Foo Bar', messages[0][2]) | 44 self.assertEqual('Foo Bar', messages[0][2]) |
45 self.assertEqual(['NOTE: A translation comment', 'with a second line'], | 45 self.assertEqual(['NOTE: A translation comment', 'with a second line'], |
46 messages[0][3]) | 46 messages[0][3]) |
47 | |
48 def test_translator_comments_with_previous_non_translator_comments(self): | |
49 buf = StringIO(""" | |
50 # This shouldn't be in the output | |
51 # because it didn't start with a comment tag | |
52 # NOTE: A translation comment | |
53 # with a second line | |
54 msg = _(u'Foo Bar') | |
55 """) | |
56 messages = list(extract.extract_python(buf, ('_',), ['NOTE'], {})) | |
57 self.assertEqual('Foo Bar', messages[0][2]) | |
58 self.assertEqual(['NOTE: A translation comment', 'with a second line'], | |
59 messages[0][3]) | |
47 | 60 |
48 | 61 |
49 def suite(): | 62 def suite(): |
50 suite = unittest.TestSuite() | 63 suite = unittest.TestSuite() |
51 suite.addTest(doctest.DocTestSuite(extract)) | 64 suite.addTest(doctest.DocTestSuite(extract)) |