diff options
author | Benjamin Peterson <benjamin@python.org> | 2014-06-08 03:14:26 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2014-06-08 03:14:26 (GMT) |
commit | 159824ea2a1872dadef69a229fb294c571d2ac73 (patch) | |
tree | 6796bae35982004fb1932a2f93bd97a36fdfcccd /Lib/test/test_pydoc.py | |
parent | 96e0430dfb36c5fa336684601bf271b0ce43e367 (diff) | |
download | cpython-159824ea2a1872dadef69a229fb294c571d2ac73.zip cpython-159824ea2a1872dadef69a229fb294c571d2ac73.tar.gz cpython-159824ea2a1872dadef69a229fb294c571d2ac73.tar.bz2 |
make sure the builtin help function doesn't fail when sys.stdin is not a valid file (closes #11709)
Original patch by Amaury Forgeot d'Arc with a test by bdettmer.
Diffstat (limited to 'Lib/test/test_pydoc.py')
-rw-r--r-- | Lib/test/test_pydoc.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_pydoc.py b/Lib/test/test_pydoc.py index 188c4c2..542b433 100644 --- a/Lib/test/test_pydoc.py +++ b/Lib/test/test_pydoc.py @@ -446,6 +446,14 @@ class PydocDocTest(unittest.TestCase): result, doc_loc = get_pydoc_text(xml.etree) self.assertEqual(doc_loc, "", "MODULE DOCS incorrectly includes a link") + def test_getpager_with_stdin_none(self): + previous_stdin = sys.stdin + try: + sys.stdin = None + pydoc.getpager() # Shouldn't fail. + finally: + sys.stdin = previous_stdin + def test_non_str_name(self): # issue14638 # Treat illegal (non-str) name like no name |