summaryrefslogtreecommitdiff
path: root/sphinx/ext/doctest.py
diff options
context:
space:
mode:
authorAdam Turner <9087854+aa-turner@users.noreply.github.com>2022-07-18 22:49:56 +0100
committerAdam Turner <9087854+aa-turner@users.noreply.github.com>2022-07-18 22:49:56 +0100
commit94024e6efaa23869a6141dba05118c158d3d3f8f (patch)
tree1bfccc5447ca099627c4c31f536d7082b7b9eb6a /sphinx/ext/doctest.py
parenta4d41aa889388bf8ee2815d4819235b5ca978a8d (diff)
parenteb0a6c574fd18d5c5d903e5d07cba8cafc376ee0 (diff)
downloadsphinx-git-94024e6efaa23869a6141dba05118c158d3d3f8f.tar.gz
Merge branch '5.x'
# Conflicts: # sphinx/ext/autodoc/__init__.py # sphinx/writers/html5.py
Diffstat (limited to 'sphinx/ext/doctest.py')
-rw-r--r--sphinx/ext/doctest.py12
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.