mirror of
https://github.com/python/cpython.git
synced 2025-07-14 23:05:17 +00:00
Issue #23374: Fixed pydoc failure with non-ASCII files when stdout encoding
differs from file system encoding (e.g. on Mac OS).
This commit is contained in:
commit
7065f376e0
3 changed files with 25 additions and 9 deletions
|
@ -34,6 +34,10 @@ try:
|
|||
except ImportError:
|
||||
threading = None
|
||||
|
||||
class nonascii:
|
||||
'Це не латиниця'
|
||||
pass
|
||||
|
||||
if test.support.HAVE_DOCSTRINGS:
|
||||
expected_data_docstrings = (
|
||||
'dictionary for instance variables (if defined)',
|
||||
|
@ -460,6 +464,11 @@ class PydocDocTest(unittest.TestCase):
|
|||
self.assertEqual(expected, result,
|
||||
"documentation for missing module found")
|
||||
|
||||
def test_not_ascii(self):
|
||||
result = run_pydoc('test.test_pydoc.nonascii', PYTHONIOENCODING='ascii')
|
||||
encoded = nonascii.__doc__.encode('ascii', 'backslashreplace')
|
||||
self.assertIn(encoded, result)
|
||||
|
||||
def test_input_strip(self):
|
||||
missing_module = " test.i_am_not_here "
|
||||
result = str(run_pydoc(missing_module), 'ascii')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue