massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-pyright / node_modules / pyright / dist / typeshed-fallback / stdlib / doctest.pyi
1 import types
2 import unittest
3 from typing import Any, Callable, NamedTuple, Tuple, Type
4
5 class TestResults(NamedTuple):
6     failed: int
7     attempted: int
8
9 OPTIONFLAGS_BY_NAME: dict[str, int]
10
11 def register_optionflag(name: str) -> int: ...
12
13 DONT_ACCEPT_TRUE_FOR_1: int
14 DONT_ACCEPT_BLANKLINE: int
15 NORMALIZE_WHITESPACE: int
16 ELLIPSIS: int
17 SKIP: int
18 IGNORE_EXCEPTION_DETAIL: int
19
20 COMPARISON_FLAGS: int
21
22 REPORT_UDIFF: int
23 REPORT_CDIFF: int
24 REPORT_NDIFF: int
25 REPORT_ONLY_FIRST_FAILURE: int
26 FAIL_FAST: int
27
28 REPORTING_FLAGS: int
29
30 BLANKLINE_MARKER: str
31 ELLIPSIS_MARKER: str
32
33 class Example:
34     source: str
35     want: str
36     exc_msg: str | None
37     lineno: int
38     indent: int
39     options: dict[int, bool]
40     def __init__(
41         self,
42         source: str,
43         want: str,
44         exc_msg: str | None = ...,
45         lineno: int = ...,
46         indent: int = ...,
47         options: dict[int, bool] | None = ...,
48     ) -> None: ...
49     def __hash__(self) -> int: ...
50
51 class DocTest:
52     examples: list[Example]
53     globs: dict[str, Any]
54     name: str
55     filename: str | None
56     lineno: int | None
57     docstring: str | None
58     def __init__(
59         self,
60         examples: list[Example],
61         globs: dict[str, Any],
62         name: str,
63         filename: str | None,
64         lineno: int | None,
65         docstring: str | None,
66     ) -> None: ...
67     def __hash__(self) -> int: ...
68     def __lt__(self, other: DocTest) -> bool: ...
69
70 class DocTestParser:
71     def parse(self, string: str, name: str = ...) -> list[str | Example]: ...
72     def get_doctest(self, string: str, globs: dict[str, Any], name: str, filename: str | None, lineno: int | None) -> DocTest: ...
73     def get_examples(self, string: str, name: str = ...) -> list[Example]: ...
74
75 class DocTestFinder:
76     def __init__(
77         self, verbose: bool = ..., parser: DocTestParser = ..., recurse: bool = ..., exclude_empty: bool = ...
78     ) -> None: ...
79     def find(
80         self,
81         obj: object,
82         name: str | None = ...,
83         module: None | bool | types.ModuleType = ...,
84         globs: dict[str, Any] | None = ...,
85         extraglobs: dict[str, Any] | None = ...,
86     ) -> list[DocTest]: ...
87
88 _Out = Callable[[str], Any]
89 _ExcInfo = Tuple[Type[BaseException], BaseException, types.TracebackType]
90
91 class DocTestRunner:
92     DIVIDER: str
93     optionflags: int
94     original_optionflags: int
95     tries: int
96     failures: int
97     test: DocTest
98     def __init__(self, checker: OutputChecker | None = ..., verbose: bool | None = ..., optionflags: int = ...) -> None: ...
99     def report_start(self, out: _Out, test: DocTest, example: Example) -> None: ...
100     def report_success(self, out: _Out, test: DocTest, example: Example, got: str) -> None: ...
101     def report_failure(self, out: _Out, test: DocTest, example: Example, got: str) -> None: ...
102     def report_unexpected_exception(self, out: _Out, test: DocTest, example: Example, exc_info: _ExcInfo) -> None: ...
103     def run(
104         self, test: DocTest, compileflags: int | None = ..., out: _Out | None = ..., clear_globs: bool = ...
105     ) -> TestResults: ...
106     def summarize(self, verbose: bool | None = ...) -> TestResults: ...
107     def merge(self, other: DocTestRunner) -> None: ...
108
109 class OutputChecker:
110     def check_output(self, want: str, got: str, optionflags: int) -> bool: ...
111     def output_difference(self, example: Example, got: str, optionflags: int) -> str: ...
112
113 class DocTestFailure(Exception):
114     test: DocTest
115     example: Example
116     got: str
117     def __init__(self, test: DocTest, example: Example, got: str) -> None: ...
118
119 class UnexpectedException(Exception):
120     test: DocTest
121     example: Example
122     exc_info: _ExcInfo
123     def __init__(self, test: DocTest, example: Example, exc_info: _ExcInfo) -> None: ...
124
125 class DebugRunner(DocTestRunner): ...
126
127 master: DocTestRunner | None
128
129 def testmod(
130     m: types.ModuleType | None = ...,
131     name: str | None = ...,
132     globs: dict[str, Any] | None = ...,
133     verbose: bool | None = ...,
134     report: bool = ...,
135     optionflags: int = ...,
136     extraglobs: dict[str, Any] | None = ...,
137     raise_on_error: bool = ...,
138     exclude_empty: bool = ...,
139 ) -> TestResults: ...
140 def testfile(
141     filename: str,
142     module_relative: bool = ...,
143     name: str | None = ...,
144     package: None | str | types.ModuleType = ...,
145     globs: dict[str, Any] | None = ...,
146     verbose: bool | None = ...,
147     report: bool = ...,
148     optionflags: int = ...,
149     extraglobs: dict[str, Any] | None = ...,
150     raise_on_error: bool = ...,
151     parser: DocTestParser = ...,
152     encoding: str | None = ...,
153 ) -> TestResults: ...
154 def run_docstring_examples(
155     f: object, globs: dict[str, Any], verbose: bool = ..., name: str = ..., compileflags: int | None = ..., optionflags: int = ...
156 ) -> None: ...
157 def set_unittest_reportflags(flags: int) -> int: ...
158
159 class DocTestCase(unittest.TestCase):
160     def __init__(
161         self,
162         test: DocTest,
163         optionflags: int = ...,
164         setUp: Callable[[DocTest], Any] | None = ...,
165         tearDown: Callable[[DocTest], Any] | None = ...,
166         checker: OutputChecker | None = ...,
167     ) -> None: ...
168     def setUp(self) -> None: ...
169     def tearDown(self) -> None: ...
170     def runTest(self) -> None: ...
171     def format_failure(self, err: str) -> str: ...
172     def debug(self) -> None: ...
173     def id(self) -> str: ...
174     def __hash__(self) -> int: ...
175     def shortDescription(self) -> str: ...
176
177 class SkipDocTestCase(DocTestCase):
178     def __init__(self, module: types.ModuleType) -> None: ...
179     def setUp(self) -> None: ...
180     def test_skip(self) -> None: ...
181     def shortDescription(self) -> str: ...
182
183 class _DocTestSuite(unittest.TestSuite): ...
184
185 def DocTestSuite(
186     module: None | str | types.ModuleType = ...,
187     globs: dict[str, Any] | None = ...,
188     extraglobs: dict[str, Any] | None = ...,
189     test_finder: DocTestFinder | None = ...,
190     **options: Any,
191 ) -> _DocTestSuite: ...
192
193 class DocFileCase(DocTestCase):
194     def id(self) -> str: ...
195     def format_failure(self, err: str) -> str: ...
196
197 def DocFileTest(
198     path: str,
199     module_relative: bool = ...,
200     package: None | str | types.ModuleType = ...,
201     globs: dict[str, Any] | None = ...,
202     parser: DocTestParser = ...,
203     encoding: str | None = ...,
204     **options: Any,
205 ) -> DocFileCase: ...
206 def DocFileSuite(*paths: str, **kw: Any) -> _DocTestSuite: ...
207 def script_from_examples(s: str) -> str: ...
208 def testsource(module: None | str | types.ModuleType, name: str) -> str: ...
209 def debug_src(src: str, pm: bool = ..., globs: dict[str, Any] | None = ...) -> None: ...
210 def debug_script(src: str, pm: bool = ..., globs: dict[str, Any] | None = ...) -> None: ...
211 def debug(module: None | str | types.ModuleType, name: str, pm: bool = ...) -> None: ...