(self)
| 2111 | self.check_line(output, expected_line, regex=False) |
| 2112 | |
| 2113 | def test_doctest(self): |
| 2114 | code = textwrap.dedent(r''' |
| 2115 | import doctest |
| 2116 | import sys |
| 2117 | from test import support |
| 2118 | |
| 2119 | def my_function(): |
| 2120 | """ |
| 2121 | Pass: |
| 2122 | |
| 2123 | >>> 1 + 1 |
| 2124 | 2 |
| 2125 | |
| 2126 | Failure: |
| 2127 | |
| 2128 | >>> 2 + 3 |
| 2129 | 23 |
| 2130 | >>> 1 + 1 |
| 2131 | 11 |
| 2132 | |
| 2133 | Skipped test (ignored): |
| 2134 | |
| 2135 | >>> id(1.0) # doctest: +SKIP |
| 2136 | 7948648 |
| 2137 | """ |
| 2138 | |
| 2139 | def load_tests(loader, tests, pattern): |
| 2140 | tests.addTest(doctest.DocTestSuite()) |
| 2141 | return tests |
| 2142 | ''') |
| 2143 | testname = self.create_test(code=code) |
| 2144 | |
| 2145 | output = self.run_tests("--fail-env-changed", "-v", "-j1", testname, |
| 2146 | exitcode=EXITCODE_BAD_TEST) |
| 2147 | self.check_executed_tests(output, [testname], |
| 2148 | failed=[testname], |
| 2149 | parallel=True, |
| 2150 | stats=TestStats(1, 2, 1)) |
| 2151 | |
| 2152 | def _check_random_seed(self, run_workers: bool): |
| 2153 | # gh-109276: When -r/--randomize is used, random.seed() is called |
nothing calls this directly
no test coverage detected