#11926: merge with 3.1.
This commit is contained in:
commit
44aad855dd
|
@ -1576,6 +1576,9 @@ class Helper:
|
||||||
# in Doc/ and copying the output file into the Lib/ directory.
|
# in Doc/ and copying the output file into the Lib/ directory.
|
||||||
|
|
||||||
keywords = {
|
keywords = {
|
||||||
|
'False': '',
|
||||||
|
'None': '',
|
||||||
|
'True': '',
|
||||||
'and': 'BOOLEAN',
|
'and': 'BOOLEAN',
|
||||||
'as': 'with',
|
'as': 'with',
|
||||||
'assert': ('assert', ''),
|
'assert': ('assert', ''),
|
||||||
|
@ -1791,6 +1794,9 @@ has the same effect as typing a particular string at the help> prompt.
|
||||||
elif request[:8] == 'modules ':
|
elif request[:8] == 'modules ':
|
||||||
self.listmodules(request.split()[1])
|
self.listmodules(request.split()[1])
|
||||||
elif request in self.symbols: self.showsymbol(request)
|
elif request in self.symbols: self.showsymbol(request)
|
||||||
|
elif request in ['True', 'False', 'None']:
|
||||||
|
# special case these keywords since they are objects too
|
||||||
|
doc(eval(request), 'Help on %s:')
|
||||||
elif request in self.keywords: self.showtopic(request)
|
elif request in self.keywords: self.showtopic(request)
|
||||||
elif request in self.topics: self.showtopic(request)
|
elif request in self.topics: self.showtopic(request)
|
||||||
elif request: doc(request, 'Help on %s:', output=self._output)
|
elif request: doc(request, 'Help on %s:', output=self._output)
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -3,6 +3,7 @@ import sys
|
||||||
import difflib
|
import difflib
|
||||||
import inspect
|
import inspect
|
||||||
import pydoc
|
import pydoc
|
||||||
|
import keyword
|
||||||
import re
|
import re
|
||||||
import string
|
import string
|
||||||
import subprocess
|
import subprocess
|
||||||
|
@ -465,11 +466,17 @@ class PydocUrlHandlerTest(unittest.TestCase):
|
||||||
self.assertEqual(result, title)
|
self.assertEqual(result, title)
|
||||||
|
|
||||||
|
|
||||||
|
class TestHelper(unittest.TestCase):
|
||||||
|
def test_keywords(self):
|
||||||
|
self.assertEqual(sorted(pydoc.Helper.keywords),
|
||||||
|
sorted(keyword.kwlist))
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
test.support.run_unittest(PydocDocTest,
|
test.support.run_unittest(PydocDocTest,
|
||||||
TestDescriptions,
|
TestDescriptions,
|
||||||
PydocServerTest,
|
PydocServerTest,
|
||||||
PydocUrlHandlerTest,
|
PydocUrlHandlerTest,
|
||||||
|
TestHelper,
|
||||||
)
|
)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
Loading…
Reference in New Issue