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

Function DocFileTest

Lib/doctest.py:2620–2644  ·  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

2618 )
2619
2620def DocFileTest(path, module_relative=True, package=None,
2621 globs=None, parser=DocTestParser(),
2622 encoding=None, **options):
2623 if globs is None:
2624 globs = {}
2625 else:
2626 globs = globs.copy()
2627
2628 if package and not module_relative:
2629 raise ValueError("Package may only be specified for module-"
2630 "relative paths.")
2631
2632 # Relativize the path.
2633 doc, path = _load_testfile(path, package, module_relative,
2634 encoding or "utf-8")
2635
2636 if "__file__" not in globs:
2637 globs["__file__"] = path
2638
2639 # Find the file and read it.
2640 name = os.path.basename(path)
2641
2642 # Convert it to a test, and wrap it in a DocFileCase.
2643 test = parser.get_doctest(doc, globs, name, path, 0)
2644 return DocFileCase(test, **options)
2645
2646def DocFileSuite(*paths, **kw):
2647 """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
get_doctestMethod · 0.80
copyMethod · 0.45
basenameMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…