summaryrefslogtreecommitdiff
path: root/sphinx/testing/util.py
diff options
context:
space:
mode:
Diffstat (limited to 'sphinx/testing/util.py')
-rw-r--r--sphinx/testing/util.py19
1 files changed, 9 insertions, 10 deletions
diff --git a/sphinx/testing/util.py b/sphinx/testing/util.py
index f4d44ecde..13147a3f9 100644
--- a/sphinx/testing/util.py
+++ b/sphinx/testing/util.py
@@ -28,7 +28,6 @@ if False:
# For type annotation
from typing import List # NOQA
from typing import Any, Dict, Generator, IO, List, Pattern # NOQA
- from sphinx.util.typing import unicode # NOQA
__all__ = [
@@ -39,25 +38,25 @@ __all__ = [
def assert_re_search(regex, text, flags=0):
- # type: (Pattern, unicode, int) -> None
+ # type: (Pattern, str, int) -> None
if not re.search(regex, text, flags):
assert False, '%r did not match %r' % (regex, text)
def assert_not_re_search(regex, text, flags=0):
- # type: (Pattern, unicode, int) -> None
+ # type: (Pattern, str, int) -> None
if re.search(regex, text, flags):
assert False, '%r did match %r' % (regex, text)
def assert_startswith(thing, prefix):
- # type: (unicode, unicode) -> None
+ # type: (str, str) -> None
if not thing.startswith(prefix):
assert False, '%r does not start with %r' % (thing, prefix)
def assert_node(node, cls=None, xpath="", **kwargs):
- # type: (nodes.Node, Any, unicode, Any) -> None
+ # type: (nodes.Node, Any, str, Any) -> None
if cls:
if isinstance(cls, list):
assert_node(node, cls[0], xpath=xpath, **kwargs)
@@ -96,7 +95,7 @@ def assert_node(node, cls=None, xpath="", **kwargs):
def etree_parse(path):
- # type: (unicode) -> Any
+ # type: (str) -> Any
with warnings.catch_warnings(record=False):
warnings.filterwarnings("ignore", category=DeprecationWarning)
return ElementTree.parse(path)
@@ -117,7 +116,7 @@ class SphinxTestApp(application.Sphinx):
def __init__(self, buildername='html', srcdir=None,
freshenv=False, confoverrides=None, status=None, warning=None,
tags=None, docutilsconf=None):
- # type: (unicode, path, bool, Dict, IO, IO, List[unicode], unicode) -> None
+ # type: (str, path, bool, Dict, IO, IO, List[str], str) -> None
if docutilsconf is not None:
(srcdir / 'docutils.conf').write_text(docutilsconf)
@@ -194,14 +193,14 @@ _unicode_literals_re = re.compile(r'u(".*?")|u(\'.*?\')')
def remove_unicode_literals(s):
- # type: (unicode) -> unicode
+ # type: (str) -> str
warnings.warn('remove_unicode_literals() is deprecated.',
RemovedInSphinx40Warning)
return _unicode_literals_re.sub(lambda x: x.group(1) or x.group(2), s)
def find_files(root, suffix=None):
- # type: (unicode, bool) -> Generator
+ # type: (str, bool) -> Generator
for dirpath, dirs, files in os.walk(root, followlinks=True):
dirpath = path(dirpath)
for f in [f for f in files if not suffix or f.endswith(suffix)]: # type: ignore
@@ -210,5 +209,5 @@ def find_files(root, suffix=None):
def strip_escseq(text):
- # type: (unicode) -> unicode
+ # type: (str) -> str
return re.sub('\x1b.*?m', '', text)