Mercurial > babel > mirror
annotate babel/messages/tests/pofile.py @ 106:2cd83f77cc98 trunk
Fix for #16: the header message (`msgid = ""`) is now treated specially by `read_po` and `Catalog`.
author | cmlenz |
---|---|
date | Thu, 14 Jun 2007 09:49:00 +0000 |
parents | c62b68a0b65e |
children | 5d32098d8352 |
rev | line source |
---|---|
1 | 1 # -*- coding: utf-8 -*- |
2 # | |
12
e6ba3e878b10
* Removed pkg_resources/setuptools requirement from various places.
cmlenz
parents:
1
diff
changeset
|
3 # Copyright (C) 2007 Edgewall Software |
1 | 4 # All rights reserved. |
5 # | |
6 # This software is licensed as described in the file COPYING, which | |
7 # you should have received as part of this distribution. The terms | |
8 # are also available at http://babel.edgewall.org/wiki/License. | |
9 # | |
10 # This software consists of voluntary contributions made by many | |
11 # individuals. For the exact contribution history, see the revision | |
12 # history and logs, available at http://babel.edgewall.org/log/. | |
13 | |
104
395704fda00b
Merged `write_pot` and `write_po` functions by moving more functionality to the `Catalog` class. This is certainly not perfect yet, but moves us in the right direction.
cmlenz
parents:
103
diff
changeset
|
14 from datetime import datetime |
1 | 15 import doctest |
24
b09e90803d1b
Reimplement line wrapping for PO writing (as the `textwrap` module is too destructive with white space) and move it to the `normalize` function (which was already doing some handling of line breaks).
cmlenz
parents:
17
diff
changeset
|
16 from StringIO import StringIO |
1 | 17 import unittest |
18 | |
56
f40fc143439c
Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
54
diff
changeset
|
19 from babel.messages.catalog import Catalog |
54
7dbcbc3f07e0
Rename the `babel.catalog` package to `babel.messages` for consistency with the other package names.
cmlenz
parents:
51
diff
changeset
|
20 from babel.messages import pofile |
1 | 21 |
17
55e22bc56f0c
Recognize python-format messages also for unnamed parameters.
cmlenz
parents:
12
diff
changeset
|
22 |
106
2cd83f77cc98
Fix for #16: the header message (`msgid = ""`) is now treated specially by `read_po` and `Catalog`.
cmlenz
parents:
105
diff
changeset
|
23 class ReadPoTestCase(unittest.TestCase): |
2cd83f77cc98
Fix for #16: the header message (`msgid = ""`) is now treated specially by `read_po` and `Catalog`.
cmlenz
parents:
105
diff
changeset
|
24 |
2cd83f77cc98
Fix for #16: the header message (`msgid = ""`) is now treated specially by `read_po` and `Catalog`.
cmlenz
parents:
105
diff
changeset
|
25 def test_read_multiline(self): |
2cd83f77cc98
Fix for #16: the header message (`msgid = ""`) is now treated specially by `read_po` and `Catalog`.
cmlenz
parents:
105
diff
changeset
|
26 buf = StringIO(r'''msgid "" |
2cd83f77cc98
Fix for #16: the header message (`msgid = ""`) is now treated specially by `read_po` and `Catalog`.
cmlenz
parents:
105
diff
changeset
|
27 "Here's some text that\n" |
2cd83f77cc98
Fix for #16: the header message (`msgid = ""`) is now treated specially by `read_po` and `Catalog`.
cmlenz
parents:
105
diff
changeset
|
28 "includesareallylongwordthatmightbutshouldnt" |
2cd83f77cc98
Fix for #16: the header message (`msgid = ""`) is now treated specially by `read_po` and `Catalog`.
cmlenz
parents:
105
diff
changeset
|
29 " throw us into an infinite " |
2cd83f77cc98
Fix for #16: the header message (`msgid = ""`) is now treated specially by `read_po` and `Catalog`.
cmlenz
parents:
105
diff
changeset
|
30 "loop\n" |
2cd83f77cc98
Fix for #16: the header message (`msgid = ""`) is now treated specially by `read_po` and `Catalog`.
cmlenz
parents:
105
diff
changeset
|
31 msgstr ""''') |
2cd83f77cc98
Fix for #16: the header message (`msgid = ""`) is now treated specially by `read_po` and `Catalog`.
cmlenz
parents:
105
diff
changeset
|
32 catalog = pofile.read_po(buf) |
2cd83f77cc98
Fix for #16: the header message (`msgid = ""`) is now treated specially by `read_po` and `Catalog`.
cmlenz
parents:
105
diff
changeset
|
33 self.assertEqual(1, len(catalog)) |
2cd83f77cc98
Fix for #16: the header message (`msgid = ""`) is now treated specially by `read_po` and `Catalog`.
cmlenz
parents:
105
diff
changeset
|
34 message = list(catalog)[1] |
2cd83f77cc98
Fix for #16: the header message (`msgid = ""`) is now treated specially by `read_po` and `Catalog`.
cmlenz
parents:
105
diff
changeset
|
35 self.assertEqual("Here's some text that\nincludesareallylongwordthat" |
2cd83f77cc98
Fix for #16: the header message (`msgid = ""`) is now treated specially by `read_po` and `Catalog`.
cmlenz
parents:
105
diff
changeset
|
36 "mightbutshouldnt throw us into an infinite loop\n", |
2cd83f77cc98
Fix for #16: the header message (`msgid = ""`) is now treated specially by `read_po` and `Catalog`.
cmlenz
parents:
105
diff
changeset
|
37 message.id) |
2cd83f77cc98
Fix for #16: the header message (`msgid = ""`) is now treated specially by `read_po` and `Catalog`.
cmlenz
parents:
105
diff
changeset
|
38 |
2cd83f77cc98
Fix for #16: the header message (`msgid = ""`) is now treated specially by `read_po` and `Catalog`.
cmlenz
parents:
105
diff
changeset
|
39 |
104
395704fda00b
Merged `write_pot` and `write_po` functions by moving more functionality to the `Catalog` class. This is certainly not perfect yet, but moves us in the right direction.
cmlenz
parents:
103
diff
changeset
|
40 class WritePoTestCase(unittest.TestCase): |
24
b09e90803d1b
Reimplement line wrapping for PO writing (as the `textwrap` module is too destructive with white space) and move it to the `normalize` function (which was already doing some handling of line breaks).
cmlenz
parents:
17
diff
changeset
|
41 |
b09e90803d1b
Reimplement line wrapping for PO writing (as the `textwrap` module is too destructive with white space) and move it to the `normalize` function (which was already doing some handling of line breaks).
cmlenz
parents:
17
diff
changeset
|
42 def test_join_locations(self): |
56
f40fc143439c
Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
54
diff
changeset
|
43 catalog = Catalog() |
f40fc143439c
Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
54
diff
changeset
|
44 catalog.add(u'foo', locations=[('main.py', 1)]) |
f40fc143439c
Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
54
diff
changeset
|
45 catalog.add(u'foo', locations=[('utils.py', 3)]) |
24
b09e90803d1b
Reimplement line wrapping for PO writing (as the `textwrap` module is too destructive with white space) and move it to the `normalize` function (which was already doing some handling of line breaks).
cmlenz
parents:
17
diff
changeset
|
46 buf = StringIO() |
104
395704fda00b
Merged `write_pot` and `write_po` functions by moving more functionality to the `Catalog` class. This is certainly not perfect yet, but moves us in the right direction.
cmlenz
parents:
103
diff
changeset
|
47 pofile.write_po(buf, catalog, omit_header=True) |
24
b09e90803d1b
Reimplement line wrapping for PO writing (as the `textwrap` module is too destructive with white space) and move it to the `normalize` function (which was already doing some handling of line breaks).
cmlenz
parents:
17
diff
changeset
|
48 self.assertEqual('''#: main.py:1 utils.py:3 |
b09e90803d1b
Reimplement line wrapping for PO writing (as the `textwrap` module is too destructive with white space) and move it to the `normalize` function (which was already doing some handling of line breaks).
cmlenz
parents:
17
diff
changeset
|
49 msgid "foo" |
b09e90803d1b
Reimplement line wrapping for PO writing (as the `textwrap` module is too destructive with white space) and move it to the `normalize` function (which was already doing some handling of line breaks).
cmlenz
parents:
17
diff
changeset
|
50 msgstr ""''', buf.getvalue().strip()) |
b09e90803d1b
Reimplement line wrapping for PO writing (as the `textwrap` module is too destructive with white space) and move it to the `normalize` function (which was already doing some handling of line breaks).
cmlenz
parents:
17
diff
changeset
|
51 |
b09e90803d1b
Reimplement line wrapping for PO writing (as the `textwrap` module is too destructive with white space) and move it to the `normalize` function (which was already doing some handling of line breaks).
cmlenz
parents:
17
diff
changeset
|
52 def test_wrap_long_lines(self): |
b09e90803d1b
Reimplement line wrapping for PO writing (as the `textwrap` module is too destructive with white space) and move it to the `normalize` function (which was already doing some handling of line breaks).
cmlenz
parents:
17
diff
changeset
|
53 text = """Here's some text where |
b09e90803d1b
Reimplement line wrapping for PO writing (as the `textwrap` module is too destructive with white space) and move it to the `normalize` function (which was already doing some handling of line breaks).
cmlenz
parents:
17
diff
changeset
|
54 white space and line breaks matter, and should |
b09e90803d1b
Reimplement line wrapping for PO writing (as the `textwrap` module is too destructive with white space) and move it to the `normalize` function (which was already doing some handling of line breaks).
cmlenz
parents:
17
diff
changeset
|
55 |
b09e90803d1b
Reimplement line wrapping for PO writing (as the `textwrap` module is too destructive with white space) and move it to the `normalize` function (which was already doing some handling of line breaks).
cmlenz
parents:
17
diff
changeset
|
56 not be removed |
b09e90803d1b
Reimplement line wrapping for PO writing (as the `textwrap` module is too destructive with white space) and move it to the `normalize` function (which was already doing some handling of line breaks).
cmlenz
parents:
17
diff
changeset
|
57 |
b09e90803d1b
Reimplement line wrapping for PO writing (as the `textwrap` module is too destructive with white space) and move it to the `normalize` function (which was already doing some handling of line breaks).
cmlenz
parents:
17
diff
changeset
|
58 """ |
56
f40fc143439c
Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
54
diff
changeset
|
59 catalog = Catalog() |
f40fc143439c
Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
54
diff
changeset
|
60 catalog.add(text, locations=[('main.py', 1)]) |
24
b09e90803d1b
Reimplement line wrapping for PO writing (as the `textwrap` module is too destructive with white space) and move it to the `normalize` function (which was already doing some handling of line breaks).
cmlenz
parents:
17
diff
changeset
|
61 buf = StringIO() |
104
395704fda00b
Merged `write_pot` and `write_po` functions by moving more functionality to the `Catalog` class. This is certainly not perfect yet, but moves us in the right direction.
cmlenz
parents:
103
diff
changeset
|
62 pofile.write_po(buf, catalog, no_location=True, omit_header=True, |
56
f40fc143439c
Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
54
diff
changeset
|
63 width=42) |
24
b09e90803d1b
Reimplement line wrapping for PO writing (as the `textwrap` module is too destructive with white space) and move it to the `normalize` function (which was already doing some handling of line breaks).
cmlenz
parents:
17
diff
changeset
|
64 self.assertEqual(r'''msgid "" |
b09e90803d1b
Reimplement line wrapping for PO writing (as the `textwrap` module is too destructive with white space) and move it to the `normalize` function (which was already doing some handling of line breaks).
cmlenz
parents:
17
diff
changeset
|
65 "Here's some text where \n" |
b09e90803d1b
Reimplement line wrapping for PO writing (as the `textwrap` module is too destructive with white space) and move it to the `normalize` function (which was already doing some handling of line breaks).
cmlenz
parents:
17
diff
changeset
|
66 "white space and line breaks matter, and" |
b09e90803d1b
Reimplement line wrapping for PO writing (as the `textwrap` module is too destructive with white space) and move it to the `normalize` function (which was already doing some handling of line breaks).
cmlenz
parents:
17
diff
changeset
|
67 " should\n" |
b09e90803d1b
Reimplement line wrapping for PO writing (as the `textwrap` module is too destructive with white space) and move it to the `normalize` function (which was already doing some handling of line breaks).
cmlenz
parents:
17
diff
changeset
|
68 "\n" |
b09e90803d1b
Reimplement line wrapping for PO writing (as the `textwrap` module is too destructive with white space) and move it to the `normalize` function (which was already doing some handling of line breaks).
cmlenz
parents:
17
diff
changeset
|
69 "not be removed\n" |
b09e90803d1b
Reimplement line wrapping for PO writing (as the `textwrap` module is too destructive with white space) and move it to the `normalize` function (which was already doing some handling of line breaks).
cmlenz
parents:
17
diff
changeset
|
70 "\n" |
b09e90803d1b
Reimplement line wrapping for PO writing (as the `textwrap` module is too destructive with white space) and move it to the `normalize` function (which was already doing some handling of line breaks).
cmlenz
parents:
17
diff
changeset
|
71 msgstr ""''', buf.getvalue().strip()) |
b09e90803d1b
Reimplement line wrapping for PO writing (as the `textwrap` module is too destructive with white space) and move it to the `normalize` function (which was already doing some handling of line breaks).
cmlenz
parents:
17
diff
changeset
|
72 |
b09e90803d1b
Reimplement line wrapping for PO writing (as the `textwrap` module is too destructive with white space) and move it to the `normalize` function (which was already doing some handling of line breaks).
cmlenz
parents:
17
diff
changeset
|
73 def test_wrap_long_lines_with_long_word(self): |
b09e90803d1b
Reimplement line wrapping for PO writing (as the `textwrap` module is too destructive with white space) and move it to the `normalize` function (which was already doing some handling of line breaks).
cmlenz
parents:
17
diff
changeset
|
74 text = """Here's some text that |
b09e90803d1b
Reimplement line wrapping for PO writing (as the `textwrap` module is too destructive with white space) and move it to the `normalize` function (which was already doing some handling of line breaks).
cmlenz
parents:
17
diff
changeset
|
75 includesareallylongwordthatmightbutshouldnt throw us into an infinite loop |
b09e90803d1b
Reimplement line wrapping for PO writing (as the `textwrap` module is too destructive with white space) and move it to the `normalize` function (which was already doing some handling of line breaks).
cmlenz
parents:
17
diff
changeset
|
76 """ |
56
f40fc143439c
Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
54
diff
changeset
|
77 catalog = Catalog() |
f40fc143439c
Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
54
diff
changeset
|
78 catalog.add(text, locations=[('main.py', 1)]) |
24
b09e90803d1b
Reimplement line wrapping for PO writing (as the `textwrap` module is too destructive with white space) and move it to the `normalize` function (which was already doing some handling of line breaks).
cmlenz
parents:
17
diff
changeset
|
79 buf = StringIO() |
104
395704fda00b
Merged `write_pot` and `write_po` functions by moving more functionality to the `Catalog` class. This is certainly not perfect yet, but moves us in the right direction.
cmlenz
parents:
103
diff
changeset
|
80 pofile.write_po(buf, catalog, no_location=True, omit_header=True, |
56
f40fc143439c
Add actual data structures for handling message catalogs, so that more code can be reused here between the frontends.
cmlenz
parents:
54
diff
changeset
|
81 width=32) |
24
b09e90803d1b
Reimplement line wrapping for PO writing (as the `textwrap` module is too destructive with white space) and move it to the `normalize` function (which was already doing some handling of line breaks).
cmlenz
parents:
17
diff
changeset
|
82 self.assertEqual(r'''msgid "" |
b09e90803d1b
Reimplement line wrapping for PO writing (as the `textwrap` module is too destructive with white space) and move it to the `normalize` function (which was already doing some handling of line breaks).
cmlenz
parents:
17
diff
changeset
|
83 "Here's some text that\n" |
b09e90803d1b
Reimplement line wrapping for PO writing (as the `textwrap` module is too destructive with white space) and move it to the `normalize` function (which was already doing some handling of line breaks).
cmlenz
parents:
17
diff
changeset
|
84 "includesareallylongwordthatmightbutshouldnt" |
b09e90803d1b
Reimplement line wrapping for PO writing (as the `textwrap` module is too destructive with white space) and move it to the `normalize` function (which was already doing some handling of line breaks).
cmlenz
parents:
17
diff
changeset
|
85 " throw us into an infinite " |
b09e90803d1b
Reimplement line wrapping for PO writing (as the `textwrap` module is too destructive with white space) and move it to the `normalize` function (which was already doing some handling of line breaks).
cmlenz
parents:
17
diff
changeset
|
86 "loop\n" |
b09e90803d1b
Reimplement line wrapping for PO writing (as the `textwrap` module is too destructive with white space) and move it to the `normalize` function (which was already doing some handling of line breaks).
cmlenz
parents:
17
diff
changeset
|
87 msgstr ""''', buf.getvalue().strip()) |
80
116e34b8cefa
Added support for translator comments at the API and frontends levels.(See #12, item 1). Updated docs and tests accordingly.
palgarvio
parents:
56
diff
changeset
|
88 |
103
dacfbaf0d1e0
Implement wrapping of header comments in PO(T) output. Related to #14.
cmlenz
parents:
80
diff
changeset
|
89 def test_wrap_long_lines_in_header(self): |
dacfbaf0d1e0
Implement wrapping of header comments in PO(T) output. Related to #14.
cmlenz
parents:
80
diff
changeset
|
90 """ |
dacfbaf0d1e0
Implement wrapping of header comments in PO(T) output. Related to #14.
cmlenz
parents:
80
diff
changeset
|
91 Verify that long lines in the header comment are wrapped correctly. |
dacfbaf0d1e0
Implement wrapping of header comments in PO(T) output. Related to #14.
cmlenz
parents:
80
diff
changeset
|
92 """ |
104
395704fda00b
Merged `write_pot` and `write_po` functions by moving more functionality to the `Catalog` class. This is certainly not perfect yet, but moves us in the right direction.
cmlenz
parents:
103
diff
changeset
|
93 catalog = Catalog(project='AReallyReallyLongNameForAProject', |
395704fda00b
Merged `write_pot` and `write_po` functions by moving more functionality to the `Catalog` class. This is certainly not perfect yet, but moves us in the right direction.
cmlenz
parents:
103
diff
changeset
|
94 revision_date=datetime(2007, 4, 1)) |
103
dacfbaf0d1e0
Implement wrapping of header comments in PO(T) output. Related to #14.
cmlenz
parents:
80
diff
changeset
|
95 buf = StringIO() |
104
395704fda00b
Merged `write_pot` and `write_po` functions by moving more functionality to the `Catalog` class. This is certainly not perfect yet, but moves us in the right direction.
cmlenz
parents:
103
diff
changeset
|
96 pofile.write_po(buf, catalog) |
103
dacfbaf0d1e0
Implement wrapping of header comments in PO(T) output. Related to #14.
cmlenz
parents:
80
diff
changeset
|
97 self.assertEqual('''\ |
dacfbaf0d1e0
Implement wrapping of header comments in PO(T) output. Related to #14.
cmlenz
parents:
80
diff
changeset
|
98 # Translations template for AReallyReallyLongNameForAProject. |
dacfbaf0d1e0
Implement wrapping of header comments in PO(T) output. Related to #14.
cmlenz
parents:
80
diff
changeset
|
99 # Copyright (C) 2007 ORGANIZATION |
dacfbaf0d1e0
Implement wrapping of header comments in PO(T) output. Related to #14.
cmlenz
parents:
80
diff
changeset
|
100 # This file is distributed under the same license as the |
dacfbaf0d1e0
Implement wrapping of header comments in PO(T) output. Related to #14.
cmlenz
parents:
80
diff
changeset
|
101 # AReallyReallyLongNameForAProject project. |
104
395704fda00b
Merged `write_pot` and `write_po` functions by moving more functionality to the `Catalog` class. This is certainly not perfect yet, but moves us in the right direction.
cmlenz
parents:
103
diff
changeset
|
102 # FIRST AUTHOR <EMAIL@ADDRESS>, 2007. |
103
dacfbaf0d1e0
Implement wrapping of header comments in PO(T) output. Related to #14.
cmlenz
parents:
80
diff
changeset
|
103 # |
dacfbaf0d1e0
Implement wrapping of header comments in PO(T) output. Related to #14.
cmlenz
parents:
80
diff
changeset
|
104 #, fuzzy''', '\n'.join(buf.getvalue().splitlines()[:7])) |
dacfbaf0d1e0
Implement wrapping of header comments in PO(T) output. Related to #14.
cmlenz
parents:
80
diff
changeset
|
105 |
80
116e34b8cefa
Added support for translator comments at the API and frontends levels.(See #12, item 1). Updated docs and tests accordingly.
palgarvio
parents:
56
diff
changeset
|
106 def test_pot_with_translator_comments(self): |
116e34b8cefa
Added support for translator comments at the API and frontends levels.(See #12, item 1). Updated docs and tests accordingly.
palgarvio
parents:
56
diff
changeset
|
107 catalog = Catalog() |
116e34b8cefa
Added support for translator comments at the API and frontends levels.(See #12, item 1). Updated docs and tests accordingly.
palgarvio
parents:
56
diff
changeset
|
108 catalog.add(u'foo', locations=[('main.py', 1)], |
105
c62b68a0b65e
`Message`, `read_po` and `write_po` now all handle user/auto comments correctly.
palgarvio
parents:
104
diff
changeset
|
109 auto_comments=['Comment About `foo`']) |
80
116e34b8cefa
Added support for translator comments at the API and frontends levels.(See #12, item 1). Updated docs and tests accordingly.
palgarvio
parents:
56
diff
changeset
|
110 catalog.add(u'bar', locations=[('utils.py', 3)], |
105
c62b68a0b65e
`Message`, `read_po` and `write_po` now all handle user/auto comments correctly.
palgarvio
parents:
104
diff
changeset
|
111 user_comments=['Comment About `bar` with', |
c62b68a0b65e
`Message`, `read_po` and `write_po` now all handle user/auto comments correctly.
palgarvio
parents:
104
diff
changeset
|
112 'multiple lines.']) |
80
116e34b8cefa
Added support for translator comments at the API and frontends levels.(See #12, item 1). Updated docs and tests accordingly.
palgarvio
parents:
56
diff
changeset
|
113 buf = StringIO() |
104
395704fda00b
Merged `write_pot` and `write_po` functions by moving more functionality to the `Catalog` class. This is certainly not perfect yet, but moves us in the right direction.
cmlenz
parents:
103
diff
changeset
|
114 pofile.write_po(buf, catalog, omit_header=True) |
80
116e34b8cefa
Added support for translator comments at the API and frontends levels.(See #12, item 1). Updated docs and tests accordingly.
palgarvio
parents:
56
diff
changeset
|
115 self.assertEqual('''#. Comment About `foo` |
116e34b8cefa
Added support for translator comments at the API and frontends levels.(See #12, item 1). Updated docs and tests accordingly.
palgarvio
parents:
56
diff
changeset
|
116 #: main.py:1 |
116e34b8cefa
Added support for translator comments at the API and frontends levels.(See #12, item 1). Updated docs and tests accordingly.
palgarvio
parents:
56
diff
changeset
|
117 msgid "foo" |
116e34b8cefa
Added support for translator comments at the API and frontends levels.(See #12, item 1). Updated docs and tests accordingly.
palgarvio
parents:
56
diff
changeset
|
118 msgstr "" |
116e34b8cefa
Added support for translator comments at the API and frontends levels.(See #12, item 1). Updated docs and tests accordingly.
palgarvio
parents:
56
diff
changeset
|
119 |
105
c62b68a0b65e
`Message`, `read_po` and `write_po` now all handle user/auto comments correctly.
palgarvio
parents:
104
diff
changeset
|
120 # Comment About `bar` with |
c62b68a0b65e
`Message`, `read_po` and `write_po` now all handle user/auto comments correctly.
palgarvio
parents:
104
diff
changeset
|
121 # multiple lines. |
80
116e34b8cefa
Added support for translator comments at the API and frontends levels.(See #12, item 1). Updated docs and tests accordingly.
palgarvio
parents:
56
diff
changeset
|
122 #: utils.py:3 |
116e34b8cefa
Added support for translator comments at the API and frontends levels.(See #12, item 1). Updated docs and tests accordingly.
palgarvio
parents:
56
diff
changeset
|
123 msgid "bar" |
116e34b8cefa
Added support for translator comments at the API and frontends levels.(See #12, item 1). Updated docs and tests accordingly.
palgarvio
parents:
56
diff
changeset
|
124 msgstr ""''', buf.getvalue().strip()) |
24
b09e90803d1b
Reimplement line wrapping for PO writing (as the `textwrap` module is too destructive with white space) and move it to the `normalize` function (which was already doing some handling of line breaks).
cmlenz
parents:
17
diff
changeset
|
125 |
b09e90803d1b
Reimplement line wrapping for PO writing (as the `textwrap` module is too destructive with white space) and move it to the `normalize` function (which was already doing some handling of line breaks).
cmlenz
parents:
17
diff
changeset
|
126 |
1 | 127 def suite(): |
128 suite = unittest.TestSuite() | |
129 suite.addTest(doctest.DocTestSuite(pofile)) | |
106
2cd83f77cc98
Fix for #16: the header message (`msgid = ""`) is now treated specially by `read_po` and `Catalog`.
cmlenz
parents:
105
diff
changeset
|
130 suite.addTest(unittest.makeSuite(ReadPoTestCase)) |
104
395704fda00b
Merged `write_pot` and `write_po` functions by moving more functionality to the `Catalog` class. This is certainly not perfect yet, but moves us in the right direction.
cmlenz
parents:
103
diff
changeset
|
131 suite.addTest(unittest.makeSuite(WritePoTestCase)) |
1 | 132 return suite |
133 | |
134 if __name__ == '__main__': | |
135 unittest.main(defaultTest='suite') |