diff options
Diffstat (limited to 'sphinx/ext/doctest.py')
-rw-r--r-- | sphinx/ext/doctest.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/sphinx/ext/doctest.py b/sphinx/ext/doctest.py index 0d414697c..4168e998a 100644 --- a/sphinx/ext/doctest.py +++ b/sphinx/ext/doctest.py @@ -9,8 +9,8 @@ import sys import time from io import StringIO from os import path -from typing import (TYPE_CHECKING, Any, Callable, Dict, Iterable, List, Sequence, Set, Tuple, - Type) +from typing import (TYPE_CHECKING, Any, Callable, Dict, Iterable, List, Optional, Sequence, + Set, Tuple, Type) from docutils import nodes from docutils.nodes import Element, Node, TextElement @@ -225,7 +225,7 @@ class TestGroup: class TestCode: def __init__(self, code: str, type: str, filename: str, - lineno: int, options: Dict = None) -> None: + lineno: int, options: Optional[Dict] = None) -> None: self.code = code self.type = type self.filename = filename @@ -317,7 +317,7 @@ class DocTestBuilder(Builder): logger.info(text, nonl=True) self.outfile.write(text) - def get_target_uri(self, docname: str, typ: str = None) -> str: + def get_target_uri(self, docname: str, typ: Optional[str] = None) -> str: return '' def get_outdated_docs(self) -> Set[str]: @@ -362,11 +362,11 @@ Doctest summary filename = relpath(node.source, self.env.srcdir)\ .rsplit(':docstring of ', maxsplit=1)[0] except Exception: - filename = self.env.doc2path(docname, base=None) + filename = self.env.doc2path(docname, False) return filename @staticmethod - def get_line_number(node: Node) -> int: + def get_line_number(node: Node) -> Optional[int]: """Get the real line number or admit we don't know.""" # TODO: Work out how to store or calculate real (file-relative) # line numbers for doctest blocks in docstrings. |