diff options
author | Niklas Hambüchen <mail@nh2.me> | 2020-01-28 02:46:25 +0100 |
---|---|---|
committer | Niklas Hambüchen <mail@nh2.me> | 2020-01-28 02:58:42 +0100 |
commit | f4f6653e6aa053724d2c6dc0ee71dcb928013352 (patch) | |
tree | fe3b30f503cd79d4763ab529b4f505ca65927422 /tests | |
parent | 4fa749b918810b52a63b312d82e4003e24db0406 (diff) | |
download | babel-f4f6653e6aa053724d2c6dc0ee71dcb928013352.tar.gz |
Introduce invariant that _invalid_pofile() takes unicode line.
This makes debugging and reasoning about the code easier;
otherwise it is surprising that sometimes `line` is a unicode
and sometimes not.
So far, when it was not, it could either be only `""` or
`'Algo esta mal'`; thus this commit makes those two u"" strings.
In all other cases, it was guaranteed that it's unicode,
because all code paths leading to `_invalid_pofile()` went through
if not isinstance(line, text_type):
line = line.decode(self.catalog.charset)
before.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/messages/test_pofile.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/messages/test_pofile.py b/tests/messages/test_pofile.py index e77fa6e..214ddf5 100644 --- a/tests/messages/test_pofile.py +++ b/tests/messages/test_pofile.py @@ -480,7 +480,7 @@ msgstr[2] "Vohs [text]" def test_invalid_pofile_with_abort_flag(self): parser = pofile.PoFileParser(None, abort_invalid=True) lineno = 10 - line = 'Algo esta mal' + line = u'Algo esta mal' msg = 'invalid file' with self.assertRaises(pofile.PoFileError) as e: parser._invalid_pofile(line, lineno, msg) |