@@ -193,7 +193,7 @@ def __ne__(self, other):
193
193
"""
194
194
return not (self == other )
195
195
196
- def _process_doc (self , doctests , doc , namespace , start ):
196
+ def _process_doc (self , doctests : list [ doctest . DocTest ] , doc , namespace , start ):
197
197
"""
198
198
Appends doctests defined in ``doc`` to the list ``doctests``.
199
199
@@ -266,7 +266,7 @@ def file_optional_tags(self):
266
266
"""
267
267
return set ()
268
268
269
- def _create_doctests (self , namespace , tab_okay = None ):
269
+ def _create_doctests (self , namespace , tab_okay = None ) -> tuple [ list [ doctest . DocTest ], dict ] :
270
270
"""
271
271
Create a list of doctests defined in this source.
272
272
@@ -314,7 +314,7 @@ def _create_doctests(self, namespace, tab_okay=None):
314
314
probed_tags = self .options .probe ,
315
315
file_optional_tags = self .file_optional_tags )
316
316
self .linking = False
317
- doctests = []
317
+ doctests : list [ doctest . DocTest ] = []
318
318
in_docstring = False
319
319
unparsed_doc = False
320
320
doc = []
@@ -480,7 +480,7 @@ def __iter__(self):
480
480
for lineno , line in enumerate (self .source .split ('\n ' )):
481
481
yield lineno + self .lineno_shift , line + '\n '
482
482
483
- def create_doctests (self , namespace ):
483
+ def create_doctests (self , namespace ) -> tuple [ list [ doctest . DocTest ], dict ] :
484
484
r"""
485
485
Create doctests from this string.
486
486
@@ -492,8 +492,8 @@ def create_doctests(self, namespace):
492
492
493
493
- ``doctests`` -- list of doctests defined by this string
494
494
495
- - ``tab_locations `` -- either ``False `` or a list of linenumbers
496
- on which tabs appear
495
+ - ``extras `` -- dictionary with ``extras['tab'] `` either
496
+ ``False`` or a list of linenumbers on which tabs appear
497
497
498
498
EXAMPLES::
499
499
@@ -503,10 +503,12 @@ def create_doctests(self, namespace):
503
503
sage: s = "'''\n sage: 2 + 2\n 4\n'''"
504
504
sage: PythonStringSource = dynamic_class('PythonStringSource',(StringDocTestSource, PythonSource))
505
505
sage: PSS = PythonStringSource('<runtime>', s, DocTestDefaults(), 'runtime')
506
- sage: dt, tabs = PSS.create_doctests({})
506
+ sage: dt, extras = PSS.create_doctests({})
507
507
sage: for t in dt:
508
508
....: print("{} {}".format(t.name, t.examples[0].sage_source))
509
509
<runtime> 2 + 2
510
+ sage: extras
511
+ {...'tab': []...}
510
512
"""
511
513
return self ._create_doctests (namespace )
512
514
@@ -736,7 +738,7 @@ def file_optional_tags(self):
736
738
from .parsing import parse_file_optional_tags
737
739
return parse_file_optional_tags (self )
738
740
739
- def create_doctests (self , namespace ):
741
+ def create_doctests (self , namespace ) -> tuple [ list [ doctest . DocTest ], dict ] :
740
742
r"""
741
743
Return a list of doctests for this file.
742
744
@@ -910,7 +912,7 @@ class SourceLanguage:
910
912
911
913
Currently supported languages include Python, ReST and LaTeX.
912
914
"""
913
- def parse_docstring (self , docstring , namespace , start ):
915
+ def parse_docstring (self , docstring , namespace , start ) -> list [ doctest . DocTest ] :
914
916
"""
915
917
Return a list of doctest defined in this docstring.
916
918
0 commit comments