MCPcopy Index your code
hub / github.com/python/cpython / test_online_docs_link

Method test_online_docs_link

Lib/test/test_pydoc/test_pydoc.py:476–500  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

474 self.assertEqual(doc_loc, "", "MODULE DOCS incorrectly includes a link")
475
476 def test_online_docs_link(self):
477 import encodings.idna
478 import importlib._bootstrap
479
480 module_docs = {
481 'encodings': 'codecs#module-encodings',
482 'encodings.idna': 'codecs#module-encodings.idna',
483 }
484
485 with unittest.mock.patch('pydoc_data.module_docs.module_docs', module_docs):
486 doc = pydoc.TextDoc()
487
488 basedir = os.path.dirname(encodings.__file__)
489 doc_link = doc.getdocloc(encodings, basedir=basedir)
490 self.assertIsNotNone(doc_link)
491 self.assertIn('codecs#module-encodings', doc_link)
492 self.assertNotIn('encodings.html', doc_link)
493
494 doc_link = doc.getdocloc(encodings.idna, basedir=basedir)
495 self.assertIsNotNone(doc_link)
496 self.assertIn('codecs#module-encodings.idna', doc_link)
497 self.assertNotIn('encodings.idna.html', doc_link)
498
499 doc_link = doc.getdocloc(importlib._bootstrap, basedir=basedir)
500 self.assertIsNone(doc_link)
501
502 def test_getpager_with_stdin_none(self):
503 previous_stdin = sys.stdin

Callers

nothing calls this directly

Calls 6

getdoclocMethod · 0.80
assertIsNotNoneMethod · 0.80
assertInMethod · 0.80
assertNotInMethod · 0.80
assertIsNoneMethod · 0.80
dirnameMethod · 0.45

Tested by

no test coverage detected