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

Function DocFileTest

Lib/doctest.py:2544–2568  ·  view source on GitHub ↗
(path, module_relative=True, package=None,
                globs=None, parser=DocTestParser(),
                encoding=None, **options)

Source from the content-addressed store, hash-verified

2542 )
2543
2544def DocFileTest(path, module_relative=True, package=None,
2545 globs=None, parser=DocTestParser(),
2546 encoding=None, **options):
2547 if globs is None:
2548 globs = {}
2549 else:
2550 globs = globs.copy()
2551
2552 if package and not module_relative:
2553 raise ValueError("Package may only be specified for module-"
2554 "relative paths.")
2555
2556 # Relativize the path.
2557 doc, path = _load_testfile(path, package, module_relative,
2558 encoding or "utf-8")
2559
2560 if "__file__" not in globs:
2561 globs["__file__"] = path
2562
2563 # Find the file and read it.
2564 name = os.path.basename(path)
2565
2566 # Convert it to a test, and wrap it in a DocFileCase.
2567 test = parser.get_doctest(doc, globs, name, path, 0)
2568 return DocFileCase(test, **options)
2569
2570def DocFileSuite(*paths, **kw):
2571 """A unittest suite for one or more doctest files.

Callers 1

DocFileSuiteFunction · 0.85

Calls 6

DocTestParserClass · 0.85
_load_testfileFunction · 0.85
DocFileCaseClass · 0.85
basenameMethod · 0.80
get_doctestMethod · 0.80
copyMethod · 0.45

Tested by

no test coverage detected