MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_online_docs_link

Method test_online_docs_link

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 5

getdoclocMethod · 0.80
assertIsNotNoneMethod · 0.80
assertInMethod · 0.80
assertNotInMethod · 0.80
assertIsNoneMethod · 0.80

Tested by

no test coverage detected