Test that pygettext outputs error messages to stderr.
(self)
| 428 | self.assertIn(b'pygettext -- Python equivalent of xgettext(1)', res.err) |
| 429 | |
| 430 | def test_error_messages(self): |
| 431 | """Test that pygettext outputs error messages to stderr.""" |
| 432 | stderr = self.get_stderr(dedent('''\ |
| 433 | _(1+2) |
| 434 | ngettext('foo') |
| 435 | dgettext(*args, 'foo') |
| 436 | ''')) |
| 437 | |
| 438 | # Normalize line endings on Windows |
| 439 | stderr = stderr.decode('utf-8').replace('\r', '') |
| 440 | |
| 441 | self.assertEqual( |
| 442 | stderr, |
| 443 | "*** test.py:1: Expected a string constant for argument 1, got 1 + 2\n" |
| 444 | "*** test.py:2: Expected at least 2 positional argument(s) in gettext call, got 1\n" |
| 445 | "*** test.py:3: Variable positional arguments are not allowed in gettext calls\n" |
| 446 | ) |
| 447 | |
| 448 | def test_extract_all_comments(self): |
| 449 | """ |
nothing calls this directly
no test coverage detected