diff options
author | Kirill Podoprigora <kirill.bast9@mail.ru> | 2023-07-11 18:04:09 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-11 18:04:09 (GMT) |
commit | 292ac4bfe92768140c2d383fd329cfa1949869b2 (patch) | |
tree | f854a135ce313a5ba6a446a6993a17bc5514b657 /Lib/test | |
parent | d0b7e18262e69dd4b8252e804e4f98fc9533bcd6 (diff) | |
download | cpython-292ac4bfe92768140c2d383fd329cfa1949869b2.zip cpython-292ac4bfe92768140c2d383fd329cfa1949869b2.tar.gz cpython-292ac4bfe92768140c2d383fd329cfa1949869b2.tar.bz2 |
gh-102541: Add test case for help() for non_existent_module (#106340)
Test fix for when one enters, for instance, 'abd' at the 'help>' prompt.
---------
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_pydoc.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/Lib/test/test_pydoc.py b/Lib/test/test_pydoc.py index 115ffd3..ddb5187 100644 --- a/Lib/test/test_pydoc.py +++ b/Lib/test/test_pydoc.py @@ -24,7 +24,8 @@ from collections import namedtuple from urllib.request import urlopen, urlcleanup from test.support import import_helper from test.support import os_helper -from test.support.script_helper import assert_python_ok, assert_python_failure +from test.support.script_helper import (assert_python_ok, + assert_python_failure, spawn_python) from test.support import threading_helper from test.support import (reap_children, captured_output, captured_stdout, captured_stderr, is_emscripten, is_wasi, @@ -631,6 +632,14 @@ class PydocDocTest(unittest.TestCase): # Testing that the subclasses section does not appear self.assertNotIn('Built-in subclasses', text) + def test_fail_help_cli(self): + elines = (missing_pattern % 'abd').splitlines() + with spawn_python("-c" "help()") as proc: + out, _ = proc.communicate(b"abd") + olines = out.decode().splitlines()[-9:-6] + olines[0] = olines[0].removeprefix('help> ') + self.assertEqual(elines, olines) + def test_fail_help_output_redirect(self): with StringIO() as buf: helper = pydoc.Helper(output=buf) |