MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / DocFileTest

Function DocFileTest

tools/python-3.11.9-amd64/Lib/doctest.py:2455–2479  ·  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

2453 )
2454
2455def DocFileTest(path, module_relative=True, package=None,
2456 globs=None, parser=DocTestParser(),
2457 encoding=None, **options):
2458 if globs is None:
2459 globs = {}
2460 else:
2461 globs = globs.copy()
2462
2463 if package and not module_relative:
2464 raise ValueError("Package may only be specified for module-"
2465 "relative paths.")
2466
2467 # Relativize the path.
2468 doc, path = _load_testfile(path, package, module_relative,
2469 encoding or "utf-8")
2470
2471 if "__file__" not in globs:
2472 globs["__file__"] = path
2473
2474 # Find the file and read it.
2475 name = os.path.basename(path)
2476
2477 # Convert it to a test, and wrap it in a DocFileCase.
2478 test = parser.get_doctest(doc, globs, name, path, 0)
2479 return DocFileCase(test, **options)
2480
2481def DocFileSuite(*paths, **kw):
2482 """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