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

Method test_doctest

Lib/test/test_regrtest.py:2082–2119  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2080 self.check_line(output, expected_line, regex=False)
2081
2082 def test_doctest(self):
2083 code = textwrap.dedent(r'''
2084 import doctest
2085 import sys
2086 from test import support
2087
2088 def my_function():
2089 """
2090 Pass:
2091
2092 >>> 1 + 1
2093 2
2094
2095 Failure:
2096
2097 >>> 2 + 3
2098 23
2099 >>> 1 + 1
2100 11
2101
2102 Skipped test (ignored):
2103
2104 >>> id(1.0) # doctest: +SKIP
2105 7948648
2106 """
2107
2108 def load_tests(loader, tests, pattern):
2109 tests.addTest(doctest.DocTestSuite())
2110 return tests
2111 ''')
2112 testname = self.create_test(code=code)
2113
2114 output = self.run_tests("--fail-env-changed", "-v", "-j1", testname,
2115 exitcode=EXITCODE_BAD_TEST)
2116 self.check_executed_tests(output, [testname],
2117 failed=[testname],
2118 parallel=True,
2119 stats=TestStats(1, 1, 0))
2120
2121 def _check_random_seed(self, run_workers: bool):
2122 # gh-109276: When -r/--randomize is used, random.seed() is called

Callers

nothing calls this directly

Calls 5

run_testsMethod · 0.95
TestStatsClass · 0.90
dedentMethod · 0.80
create_testMethod · 0.80
check_executed_testsMethod · 0.80

Tested by

no test coverage detected