diff --git a/tests/test_autodoc.py b/tests/test_autodoc.py
index d3c0a1f50..8d67cdb6f 100644
--- a/tests/test_autodoc.py
+++ b/tests/test_autodoc.py
@@ -425,7 +425,7 @@ def test_get_doc():
# class has __init__ method without docstring and
# __new__ method with docstring
# class docstring: depends on config value which one is taken
- class I:
+ class I: # NOQA
"""Class docstring"""
def __new__(cls):
"""New docstring"""
diff --git a/tests/test_build.py b/tests/test_build.py
index 387e308a8..6892ddfad 100644
--- a/tests/test_build.py
+++ b/tests/test_build.py
@@ -34,8 +34,8 @@ def nonascii_srcdir(request, rootdir, sphinx_test_tempdir):
basedir = sphinx_test_tempdir / request.node.originalname
# Windows with versions prior to 3.2 (I think) doesn't support unicode on system path
# so we force a non-unicode path in that case
- if sys.platform == "win32" and \
- not (sys.version_info.major >= 3 and sys.version_info.minor >= 2):
+ if (sys.platform == "win32" and
+ not (sys.version_info.major >= 3 and sys.version_info.minor >= 2)):
return basedir / 'all'
try:
srcdir = basedir / test_name
diff --git a/tests/test_build_epub.py b/tests/test_build_epub.py
index 397547734..e5d86b0ed 100644
--- a/tests/test_build_epub.py
+++ b/tests/test_build_epub.py
@@ -245,5 +245,3 @@ def test_epub_writing_mode(app):
# vertical / writing-mode (CSS)
css = (app.outdir / '_static' / 'epub.css').text()
assert 'writing-mode: vertical-rl;' in css
-
-
diff --git a/tests/test_build_html.py b/tests/test_build_html.py
index 2d56ba5c6..dafc1f09f 100644
--- a/tests/test_build_html.py
+++ b/tests/test_build_html.py
@@ -15,7 +15,6 @@ from itertools import cycle, chain
from six import PY3
-from sphinx import __display_version__
from sphinx.util.inventory import InventoryFile
from sphinx.testing.util import remove_unicode_literals, strip_escseq
import xml.etree.cElementTree as ElementTree
diff --git a/tests/test_build_latex.py b/tests/test_build_latex.py
index bf0e84c57..5c0450810 100644
--- a/tests/test_build_latex.py
+++ b/tests/test_build_latex.py
@@ -773,6 +773,7 @@ def test_toctree_maxdepth_manual(app, status, warning):
assert '\\setcounter{secnumdepth}' not in result
assert '\\chapter{Foo}' in result
+
@pytest.mark.sphinx(
'latex', testroot='toctree-maxdepth',
confoverrides={'latex_documents': [
@@ -789,6 +790,7 @@ def test_toctree_maxdepth_howto(app, status, warning):
assert '\\setcounter{secnumdepth}' not in result
assert '\\section{Foo}' in result
+
@pytest.mark.sphinx(
'latex', testroot='toctree-maxdepth',
confoverrides={'master_doc': 'foo'})
@@ -802,6 +804,7 @@ def test_toctree_not_found(app, status, warning):
assert '\\setcounter{secnumdepth}' not in result
assert '\\chapter{Foo A}' in result
+
@pytest.mark.sphinx(
'latex', testroot='toctree-maxdepth',
confoverrides={'master_doc': 'bar'})
@@ -858,8 +861,8 @@ def test_latex_toplevel_sectioning_is_part(app, status, warning):
'latex', testroot='toctree-maxdepth',
confoverrides={'latex_toplevel_sectioning': 'part',
'latex_documents': [
- ('index', 'Python.tex', 'Sphinx Tests Documentation',
- 'Georg Brandl', 'howto')
+ ('index', 'Python.tex', 'Sphinx Tests Documentation',
+ 'Georg Brandl', 'howto')
]})
def test_latex_toplevel_sectioning_is_part_with_howto(app, status, warning):
app.builder.build_all()
@@ -888,8 +891,8 @@ def test_latex_toplevel_sectioning_is_chapter(app, status, warning):
'latex', testroot='toctree-maxdepth',
confoverrides={'latex_toplevel_sectioning': 'chapter',
'latex_documents': [
- ('index', 'Python.tex', 'Sphinx Tests Documentation',
- 'Georg Brandl', 'howto')
+ ('index', 'Python.tex', 'Sphinx Tests Documentation',
+ 'Georg Brandl', 'howto')
]})
def test_latex_toplevel_sectioning_is_chapter_with_howto(app, status, warning):
app.builder.build_all()
diff --git a/tests/test_docutilsconf.py b/tests/test_docutilsconf.py
index fd5cf7a61..bca41feea 100644
--- a/tests/test_docutilsconf.py
+++ b/tests/test_docutilsconf.py
@@ -72,7 +72,7 @@ def test_texinfo(app, status, warning):
@pytest.mark.sphinx('html', testroot='docutilsconf',
docutilsconf='[general]\nsource_link=true\n')
-@pytest.mark.skip(sys.platform == "win32" and \
+@pytest.mark.skip(sys.platform == "win32" and
not (sys.version_info.major >= 3 and sys.version_info.minor >= 2),
reason="Python < 3.2 on Win32 doesn't handle non-ASCII paths right")
def test_docutils_source_link_with_nonascii_file(app, status, warning):
diff --git a/tests/test_domain_cpp.py b/tests/test_domain_cpp.py
index e4f3a678b..aed574daf 100644
--- a/tests/test_domain_cpp.py
+++ b/tests/test_domain_cpp.py
@@ -101,13 +101,13 @@ def test_fundamental_types():
if t == "std::nullptr_t":
id = "NSt9nullptr_tE"
return "1f%s" % id
- check("function", "void f(%s arg)" % t, {1: makeIdV1(), 2:makeIdV2()})
+ check("function", "void f(%s arg)" % t, {1: makeIdV1(), 2: makeIdV2()})
def test_expressions():
def exprCheck(expr, id):
ids = 'IE1CIA%s_1aE'
- check('class', 'template<> C' % expr, {2:ids % expr, 3:ids % id})
+ check('class', 'template<> C' % expr, {2: ids % expr, 3: ids % id})
# primary
exprCheck('nullptr', 'LDnE')
exprCheck('true', 'L1E')
@@ -118,9 +118,9 @@ def test_expressions():
for i in ints:
for u in unsignedSuffix:
for l in longSuffix:
- expr = i + u + l;
+ expr = i + u + l
exprCheck(expr, 'L' + expr + 'E')
- expr = i + l + u;
+ expr = i + l + u
exprCheck(expr, 'L' + expr + 'E')
for suffix in ['', 'f', 'F', 'l', 'L']:
expr = '5.0' + suffix
@@ -200,55 +200,55 @@ def test_expressions():
# a < expression that starts with something that could be a template
exprCheck('A < 42', 'lt1AL42E')
check('function', 'template<> void f(A &v)',
- {2:"IE1fR1AI1BX2EE", 3:"IE1fR1AI1BXL2EEE"})
+ {2: "IE1fR1AI1BX2EE", 3: "IE1fR1AI1BXL2EEE"})
exprCheck('A<1>::value', 'N1AIXL1EEE5valueE')
- check('class', "template A", {2:"I_iE1A"})
- check('enumerator', 'A = std::numeric_limits::max()', {2:"1A"})
+ check('class', "template A", {2: "I_iE1A"})
+ check('enumerator', 'A = std::numeric_limits::max()', {2: "1A"})
def test_type_definitions():
- check("type", "public bool b", {1:"b", 2:"1b"}, "bool b")
- check("type", "bool A::b", {1:"A::b", 2:"N1A1bE"})
- check("type", "bool *b", {1:"b", 2:"1b"})
- check("type", "bool *const b", {1:"b", 2:"1b"})
- check("type", "bool *volatile const b", {1:"b", 2:"1b"})
- check("type", "bool *volatile const b", {1:"b", 2:"1b"})
- check("type", "bool *volatile const *b", {1:"b", 2:"1b"})
- check("type", "bool &b", {1:"b", 2:"1b"})
- check("type", "bool b[]", {1:"b", 2:"1b"})
- check("type", "std::pair coord", {1:"coord", 2:"5coord"})
- check("type", "long long int foo", {1:"foo", 2:"3foo"})
+ check("type", "public bool b", {1: "b", 2: "1b"}, "bool b")
+ check("type", "bool A::b", {1: "A::b", 2: "N1A1bE"})
+ check("type", "bool *b", {1: "b", 2: "1b"})
+ check("type", "bool *const b", {1: "b", 2: "1b"})
+ check("type", "bool *volatile const b", {1: "b", 2: "1b"})
+ check("type", "bool *volatile const b", {1: "b", 2: "1b"})
+ check("type", "bool *volatile const *b", {1: "b", 2: "1b"})
+ check("type", "bool &b", {1: "b", 2: "1b"})
+ check("type", "bool b[]", {1: "b", 2: "1b"})
+ check("type", "std::pair coord", {1: "coord", 2: "5coord"})
+ check("type", "long long int foo", {1: "foo", 2: "3foo"})
check("type", 'std::vector> module::blah',
- {1:"module::blah", 2:"N6module4blahE"})
- check("type", "std::function F", {1:"F", 2:"1F"})
- check("type", "std::function F", {1:"F", 2:"1F"})
- check("type", "std::function F", {1:"F", 2:"1F"})
- check("type", "std::function F", {1:"F", 2:"1F"})
+ {1: "module::blah", 2: "N6module4blahE"})
+ check("type", "std::function F", {1: "F", 2: "1F"})
+ check("type", "std::function F", {1: "F", 2: "1F"})
+ check("type", "std::function F", {1: "F", 2: "1F"})
+ check("type", "std::function F", {1: "F", 2: "1F"})
check("type", "MyContainer::const_iterator",
- {1:"MyContainer::const_iterator", 2:"N11MyContainer14const_iteratorE"})
+ {1: "MyContainer::const_iterator", 2: "N11MyContainer14const_iteratorE"})
check("type",
"public MyContainer::const_iterator",
- {1:"MyContainer::const_iterator", 2:"N11MyContainer14const_iteratorE"},
+ {1: "MyContainer::const_iterator", 2: "N11MyContainer14const_iteratorE"},
output="MyContainer::const_iterator")
# test decl specs on right
- check("type", "bool const b", {1:"b", 2:"1b"})
+ check("type", "bool const b", {1: "b", 2: "1b"})
# test name in global scope
- check("type", "bool ::B::b", {1:"B::b", 2:"N1B1bE"})
+ check("type", "bool ::B::b", {1: "B::b", 2: "N1B1bE"})
- check('type', 'A = B', {2:'1A'})
- check('type', 'A = decltype(b)', {2:'1A'})
+ check('type', 'A = B', {2: '1A'})
+ check('type', 'A = decltype(b)', {2: '1A'})
# from breathe#267 (named function parameters for function pointers
check('type', 'void (*gpio_callback_t)(struct device *port, uint32_t pin)',
- {1:'gpio_callback_t', 2:'15gpio_callback_t'})
- check('type', 'void (*f)(std::function g)', {1:'f', 2:'1f'})
+ {1: 'gpio_callback_t', 2: '15gpio_callback_t'})
+ check('type', 'void (*f)(std::function g)', {1: 'f', 2: '1f'})
def test_concept_definitions():
check('concept', 'template A::B::Concept',
- {2:'I0EN1A1B7ConceptE'})
+ {2: 'I0EN1A1B7ConceptE'})
check('concept', 'template Foo',
- {2:'I00DpE3Foo'})
+ {2: 'I00DpE3Foo'})
with pytest.raises(DefinitionError):
parse('concept', 'Foo')
with pytest.raises(DefinitionError):
@@ -257,269 +257,270 @@ def test_concept_definitions():
def test_member_definitions():
check('member', ' const std::string & name = 42',
- {1:"name__ssCR", 2:"4name"}, output='const std::string &name = 42')
- check('member', ' const std::string & name', {1:"name__ssCR", 2:"4name"},
+ {1: "name__ssCR", 2: "4name"}, output='const std::string &name = 42')
+ check('member', ' const std::string & name', {1: "name__ssCR", 2: "4name"},
output='const std::string &name')
check('member', ' const std::string & name [ n ]',
- {1:"name__ssCRA", 2:"4name"}, output='const std::string &name[n]')
+ {1: "name__ssCRA", 2: "4name"}, output='const std::string &name[n]')
check('member', 'const std::vector< unsigned int, long> &name',
- {1:"name__std::vector:unsigned-i.l:CR", 2:"4name"},
+ {1: "name__std::vector:unsigned-i.l:CR", 2: "4name"},
output='const std::vector &name')
- check('member', 'module::myclass foo[n]', {1:"foo__module::myclassA", 2:"3foo"})
- check('member', 'int *const p', {1:'p__iPC', 2:'1p'})
- check('member', 'extern int myInt', {1:'myInt__i', 2:'5myInt'})
- check('member', 'thread_local int myInt', {1:'myInt__i', 2:'5myInt'})
- check('member', 'extern thread_local int myInt', {1:'myInt__i', 2:'5myInt'})
- check('member', 'thread_local extern int myInt', {1:'myInt__i', 2:'5myInt'},
+ check('member', 'module::myclass foo[n]', {1: "foo__module::myclassA", 2: "3foo"})
+ check('member', 'int *const p', {1: 'p__iPC', 2: '1p'})
+ check('member', 'extern int myInt', {1: 'myInt__i', 2: '5myInt'})
+ check('member', 'thread_local int myInt', {1: 'myInt__i', 2: '5myInt'})
+ check('member', 'extern thread_local int myInt', {1: 'myInt__i', 2: '5myInt'})
+ check('member', 'thread_local extern int myInt', {1: 'myInt__i', 2: '5myInt'},
'extern thread_local int myInt')
def test_function_definitions():
- check('function', 'operator bool() const', {1:"castto-b-operatorC", 2:"NKcvbEv"})
+ check('function', 'operator bool() const', {1: "castto-b-operatorC", 2: "NKcvbEv"})
check('function', 'A::operator bool() const',
- {1:"A::castto-b-operatorC", 2:"NK1AcvbEv"})
+ {1: "A::castto-b-operatorC", 2: "NK1AcvbEv"})
check('function', 'A::operator bool() volatile const &',
- {1:"A::castto-b-operatorVCR", 2:"NVKR1AcvbEv"})
+ {1: "A::castto-b-operatorVCR", 2: "NVKR1AcvbEv"})
check('function', 'A::operator bool() volatile const &&',
- {1:"A::castto-b-operatorVCO", 2:"NVKO1AcvbEv"})
+ {1: "A::castto-b-operatorVCO", 2: "NVKO1AcvbEv"})
check('function', 'bool namespaced::theclass::method(arg1, arg2)',
- {1:"namespaced::theclass::method__arg1.arg2",
- 2:"N10namespaced8theclass6methodE4arg14arg2"})
+ {1: "namespaced::theclass::method__arg1.arg2",
+ 2: "N10namespaced8theclass6methodE4arg14arg2"})
x = 'std::vector> &module::test(register int ' \
'foo, bar, std::string baz = "foobar, blah, bleh") const = 0'
- check('function', x, {1:"module::test__i.bar.ssC",
- 2:"NK6module4testEi3barNSt6stringE"})
+ check('function', x, {1: "module::test__i.bar.ssC",
+ 2: "NK6module4testEi3barNSt6stringE"})
check('function', 'void f(std::pair)',
- {1:"f__std::pair:A.B:", 2:"1fNSt4pairI1A1BEE"})
+ {1: "f__std::pair:A.B:", 2: "1fNSt4pairI1A1BEE"})
check('function', 'explicit module::myclass::foo::foo()',
- {1:"module::myclass::foo::foo", 2:"N6module7myclass3foo3fooEv"})
+ {1: "module::myclass::foo::foo", 2: "N6module7myclass3foo3fooEv"})
check('function', 'module::myclass::foo::~foo()',
- {1:"module::myclass::foo::~foo", 2:"N6module7myclass3fooD0Ev"})
+ {1: "module::myclass::foo::~foo", 2: "N6module7myclass3fooD0Ev"})
check('function', 'int printf(const char *fmt, ...)',
- {1:"printf__cCP.z", 2:"6printfPKcz"})
+ {1: "printf__cCP.z", 2: "6printfPKcz"})
check('function', 'int foo(const unsigned int j)',
- {1:"foo__unsigned-iC", 2:"3fooKj"})
+ {1: "foo__unsigned-iC", 2: "3fooKj"})
check('function', 'int foo(const int *const ptr)',
- {1:"foo__iCPC", 2:"3fooPCKi"})
+ {1: "foo__iCPC", 2: "3fooPCKi"})
check('function', 'module::myclass::operator std::vector()',
- {1:"module::myclass::castto-std::vector:ss:-operator",
- 2:"N6module7myclasscvNSt6vectorINSt6stringEEEEv"})
+ {1: "module::myclass::castto-std::vector:ss:-operator",
+ 2: "N6module7myclasscvNSt6vectorINSt6stringEEEEv"})
check('function',
'void operator()(const boost::array &v) const',
- {1:"call-operator__boost::array:VertexID.2:CRC",
- 2:"NKclERKN5boost5arrayI8VertexIDX2EEE",
- 3:"NKclERKN5boost5arrayI8VertexIDXL2EEEE"})
+ {1: "call-operator__boost::array:VertexID.2:CRC",
+ 2: "NKclERKN5boost5arrayI8VertexIDX2EEE",
+ 3: "NKclERKN5boost5arrayI8VertexIDXL2EEEE"})
check('function',
'void operator()(const boost::array &v) const',
- {1:'call-operator__boost::array:VertexID.2."foo,--bar":CRC',
- 2:'NKclERKN5boost5arrayI8VertexIDX2EX"foo, bar"EEE',
- 3:'NKclERKN5boost5arrayI8VertexIDXL2EEXLA9_KcEEEE'})
+ {1: 'call-operator__boost::array:VertexID.2."foo,--bar":CRC',
+ 2: 'NKclERKN5boost5arrayI8VertexIDX2EX"foo, bar"EEE',
+ 3: 'NKclERKN5boost5arrayI8VertexIDXL2EEXLA9_KcEEEE'})
check('function', 'MyClass::MyClass(MyClass::MyClass&&)',
- {1:"MyClass::MyClass__MyClass::MyClassRR",
- 2:"N7MyClass7MyClassERRN7MyClass7MyClassE"})
- check('function', 'constexpr int get_value()', {1:"get_valueCE", 2:"9get_valuev"})
+ {1: "MyClass::MyClass__MyClass::MyClassRR",
+ 2: "N7MyClass7MyClassERRN7MyClass7MyClassE"})
+ check('function', 'constexpr int get_value()', {1: "get_valueCE", 2: "9get_valuev"})
check('function', 'static constexpr int get_value()',
- {1:"get_valueCE", 2:"9get_valuev"})
+ {1: "get_valueCE", 2: "9get_valuev"})
check('function', 'int get_value() const noexcept',
- {1:"get_valueC", 2:"NK9get_valueEv"})
+ {1: "get_valueC", 2: "NK9get_valueEv"})
check('function', 'int get_value() const noexcept = delete',
- {1:"get_valueC", 2:"NK9get_valueEv"})
+ {1: "get_valueC", 2: "NK9get_valueEv"})
check('function', 'int get_value() volatile const',
- {1:"get_valueVC", 2:"NVK9get_valueEv"})
+ {1: "get_valueVC", 2: "NVK9get_valueEv"})
check('function', 'MyClass::MyClass(MyClass::MyClass&&) = default',
- {1:"MyClass::MyClass__MyClass::MyClassRR",
- 2:"N7MyClass7MyClassERRN7MyClass7MyClassE"})
+ {1: "MyClass::MyClass__MyClass::MyClassRR",
+ 2: "N7MyClass7MyClassERRN7MyClass7MyClassE"})
check('function', 'virtual MyClass::a_virtual_function() const override',
- {1:"MyClass::a_virtual_functionC", 2:"NK7MyClass18a_virtual_functionEv"})
- check('function', 'A B() override', {1:"B", 2:"1Bv"})
- check('function', 'A B() final', {1:"B", 2:"1Bv"})
- check('function', 'A B() final override', {1:"B", 2:"1Bv"})
- check('function', 'A B() override final', {1:"B", 2:"1Bv"},
+ {1: "MyClass::a_virtual_functionC", 2: "NK7MyClass18a_virtual_functionEv"})
+ check('function', 'A B() override', {1: "B", 2: "1Bv"})
+ check('function', 'A B() final', {1: "B", 2: "1Bv"})
+ check('function', 'A B() final override', {1: "B", 2: "1Bv"})
+ check('function', 'A B() override final', {1: "B", 2: "1Bv"},
output='A B() final override')
check('function', 'MyClass::a_member_function() volatile',
- {1:"MyClass::a_member_functionV", 2:"NV7MyClass17a_member_functionEv"})
+ {1: "MyClass::a_member_functionV", 2: "NV7MyClass17a_member_functionEv"})
check('function', 'MyClass::a_member_function() volatile const',
- {1:"MyClass::a_member_functionVC", 2:"NVK7MyClass17a_member_functionEv"})
+ {1: "MyClass::a_member_functionVC", 2: "NVK7MyClass17a_member_functionEv"})
check('function', 'MyClass::a_member_function() &&',
- {1:"MyClass::a_member_functionO", 2:"NO7MyClass17a_member_functionEv"})
+ {1: "MyClass::a_member_functionO", 2: "NO7MyClass17a_member_functionEv"})
check('function', 'MyClass::a_member_function() &',
- {1:"MyClass::a_member_functionR", 2:"NR7MyClass17a_member_functionEv"})
+ {1: "MyClass::a_member_functionR", 2: "NR7MyClass17a_member_functionEv"})
check('function', 'MyClass::a_member_function() const &',
- {1:"MyClass::a_member_functionCR", 2:"NKR7MyClass17a_member_functionEv"})
+ {1: "MyClass::a_member_functionCR", 2: "NKR7MyClass17a_member_functionEv"})
check('function', 'int main(int argc, char *argv[])',
- {1:"main__i.cPA", 2:"4mainiA_Pc"})
+ {1: "main__i.cPA", 2: "4mainiA_Pc"})
check('function', 'MyClass &MyClass::operator++()',
- {1:"MyClass::inc-operator", 2:"N7MyClassppEv"})
+ {1: "MyClass::inc-operator", 2: "N7MyClassppEv"})
check('function', 'MyClass::pointer MyClass::operator->()',
- {1:"MyClass::pointer-operator", 2:"N7MyClassptEv"})
+ {1: "MyClass::pointer-operator", 2: "N7MyClassptEv"})
x = 'std::vector> &module::test(register int ' \
'foo, bar[n], std::string baz = "foobar, blah, bleh") const = 0'
- check('function', x, {1:"module::test__i.barA.ssC",
- 2:"NK6module4testEiAn_3barNSt6stringE",
- 3:"NK6module4testEiA1n_3barNSt6stringE"})
+ check('function', x, {1: "module::test__i.barA.ssC",
+ 2: "NK6module4testEiAn_3barNSt6stringE",
+ 3: "NK6module4testEiA1n_3barNSt6stringE"})
check('function',
'int foo(Foo f = Foo(double(), std::make_pair(int(2), double(3.4))))',
- {1:"foo__Foo", 2:"3foo3Foo"})
- check('function', 'int foo(A a = x(a))', {1:"foo__A", 2:"3foo1A"})
+ {1: "foo__Foo", 2: "3foo3Foo"})
+ check('function', 'int foo(A a = x(a))', {1: "foo__A", 2: "3foo1A"})
with pytest.raises(DefinitionError):
parse('function', 'int foo(B b=x(a)')
with pytest.raises(DefinitionError):
parse('function', 'int foo)C c=x(a))')
with pytest.raises(DefinitionError):
parse('function', 'int foo(D d=x(a')
- check('function', 'int foo(const A&... a)', {1:"foo__ACRDp", 2:"3fooDpRK1A"})
- check('function', 'virtual void f()', {1:"f", 2:"1fv"})
+ check('function', 'int foo(const A&... a)', {1: "foo__ACRDp", 2: "3fooDpRK1A"})
+ check('function', 'virtual void f()', {1: "f", 2: "1fv"})
# test for ::nestedName, from issue 1738
check("function", "result(int val, ::std::error_category const &cat)",
- {1:"result__i.std::error_categoryCR", 2:"6resultiRNSt14error_categoryE"})
- check("function", "int *f()", {1:"f", 2:"1fv"})
+ {1: "result__i.std::error_categoryCR", 2: "6resultiRNSt14error_categoryE"})
+ check("function", "int *f()", {1: "f", 2: "1fv"})
# tests derived from issue #1753 (skip to keep sanity)
- check("function", "f(int (&array)[10])", {2:"1fRA10_i", 3:"1fRAL10E_i"})
- check("function", "void f(int (&array)[10])", {2:"1fRA10_i", 3:"1fRAL10E_i"})
- check("function", "void f(float *q(double))", {2:"1fFPfdE"})
- check("function", "void f(float *(*q)(double))", {2:"1fPFPfdE"})
- check("function", "void f(float (*q)(double))", {2:"1fPFfdE"})
- check("function", "int (*f(double d))(float)", {1:"f__double", 2:"1fd"})
- check("function", "int (*f(bool b))[5]", {1:"f__b", 2:"1fb"})
+ check("function", "f(int (&array)[10])", {2: "1fRA10_i", 3: "1fRAL10E_i"})
+ check("function", "void f(int (&array)[10])", {2: "1fRA10_i", 3: "1fRAL10E_i"})
+ check("function", "void f(float *q(double))", {2: "1fFPfdE"})
+ check("function", "void f(float *(*q)(double))", {2: "1fPFPfdE"})
+ check("function", "void f(float (*q)(double))", {2: "1fPFfdE"})
+ check("function", "int (*f(double d))(float)", {1: "f__double", 2: "1fd"})
+ check("function", "int (*f(bool b))[5]", {1: "f__b", 2: "1fb"})
check("function", "int (*A::f(double d) const)(float)",
- {1:"A::f__doubleC", 2:"NK1A1fEd"})
+ {1: "A::f__doubleC", 2: "NK1A1fEd"})
check("function", "void f(std::shared_ptr ptr)",
- {2:"1fNSt10shared_ptrIFidEEE"})
- check("function", "void f(int *const p)", {1:"f__iPC", 2:"1fPCi"})
- check("function", "void f(int *volatile const p)", {1:"f__iPVC", 2:"1fPVCi"})
+ {2: "1fNSt10shared_ptrIFidEEE"})
+ check("function", "void f(int *const p)", {1: "f__iPC", 2: "1fPCi"})
+ check("function", "void f(int *volatile const p)", {1: "f__iPVC", 2: "1fPVCi"})
- check('function', 'extern int f()', {1:'f', 2:'1fv'})
+ check('function', 'extern int f()', {1: 'f', 2: '1fv'})
- check('function', 'decltype(auto) f()', {1: 'f', 2:"1fv"})
+ check('function', 'decltype(auto) f()', {1: 'f', 2: "1fv"})
# TODO: make tests for functions in a template, e.g., Test
# such that the id generation for function type types is correct.
check('function', 'friend std::ostream &f(std::ostream&, int)',
- {1:'f__osR.i', 2:'1fRNSt7ostreamEi'})
+ {1: 'f__osR.i', 2: '1fRNSt7ostreamEi'})
# from breathe#223
- check('function', 'void f(struct E e)', {1:'f__E', 2:'1f1E'})
- check('function', 'void f(class E e)', {1:'f__E', 2:'1f1E'})
- check('function', 'void f(typename E e)', {1:'f__E', 2:'1f1E'})
- check('function', 'void f(enum E e)', {1:'f__E', 2:'1f1E'})
- check('function', 'void f(union E e)', {1:'f__E', 2:'1f1E'})
+ check('function', 'void f(struct E e)', {1: 'f__E', 2: '1f1E'})
+ check('function', 'void f(class E e)', {1: 'f__E', 2: '1f1E'})
+ check('function', 'void f(typename E e)', {1: 'f__E', 2: '1f1E'})
+ check('function', 'void f(enum E e)', {1: 'f__E', 2: '1f1E'})
+ check('function', 'void f(union E e)', {1: 'f__E', 2: '1f1E'})
# pointer to member (function)
- check('function', 'void f(int C::*)', {2:'1fM1Ci'})
- check('function', 'void f(int C::* p)', {2:'1fM1Ci'})
- check('function', 'void f(int ::C::* p)', {2:'1fM1Ci'})
- check('function', 'void f(int C::* const)', {2:'1fKM1Ci'})
- check('function', 'void f(int C::* const&)', {2:'1fRKM1Ci'})
- check('function', 'void f(int C::* volatile)', {2:'1fVM1Ci'})
- check('function', 'void f(int C::* const volatile)', {2:'1fVKM1Ci'},
+ check('function', 'void f(int C::*)', {2: '1fM1Ci'})
+ check('function', 'void f(int C::* p)', {2: '1fM1Ci'})
+ check('function', 'void f(int ::C::* p)', {2: '1fM1Ci'})
+ check('function', 'void f(int C::* const)', {2: '1fKM1Ci'})
+ check('function', 'void f(int C::* const&)', {2: '1fRKM1Ci'})
+ check('function', 'void f(int C::* volatile)', {2: '1fVM1Ci'})
+ check('function', 'void f(int C::* const volatile)', {2: '1fVKM1Ci'},
output='void f(int C::* volatile const)')
- check('function', 'void f(int C::* volatile const)', {2:'1fVKM1Ci'})
- check('function', 'void f(int (C::*)(float, double))', {2:'1fM1CFifdE'})
- check('function', 'void f(int (C::* p)(float, double))', {2:'1fM1CFifdE'})
- check('function', 'void f(int (::C::* p)(float, double))', {2:'1fM1CFifdE'})
- check('function', 'void f(void (C::*)() const &)', {2:'1fM1CKRFvvE'})
- check('function', 'int C::* f(int, double)', {2:'1fid'})
- check('function', 'void f(int C::* *)', {2:'1fPM1Ci'})
+ check('function', 'void f(int C::* volatile const)', {2: '1fVKM1Ci'})
+ check('function', 'void f(int (C::*)(float, double))', {2: '1fM1CFifdE'})
+ check('function', 'void f(int (C::* p)(float, double))', {2: '1fM1CFifdE'})
+ check('function', 'void f(int (::C::* p)(float, double))', {2: '1fM1CFifdE'})
+ check('function', 'void f(void (C::*)() const &)', {2: '1fM1CKRFvvE'})
+ check('function', 'int C::* f(int, double)', {2: '1fid'})
+ check('function', 'void f(int C::* *)', {2: '1fPM1Ci'})
def test_operators():
check('function', 'void operator new [ ] ()',
- {1:"new-array-operator", 2:"nav"}, output='void operator new[]()')
+ {1: "new-array-operator", 2: "nav"}, output='void operator new[]()')
check('function', 'void operator delete ()',
- {1:"delete-operator", 2:"dlv"}, output='void operator delete()')
+ {1: "delete-operator", 2: "dlv"}, output='void operator delete()')
check('function', 'operator bool() const',
- {1:"castto-b-operatorC", 2:"NKcvbEv"}, output='operator bool() const')
+ {1: "castto-b-operatorC", 2: "NKcvbEv"}, output='operator bool() const')
check('function', 'void operator * ()',
- {1:"mul-operator", 2:"mlv"}, output='void operator*()')
+ {1: "mul-operator", 2: "mlv"}, output='void operator*()')
check('function', 'void operator - ()',
- {1:"sub-operator", 2:"miv"}, output='void operator-()')
+ {1: "sub-operator", 2: "miv"}, output='void operator-()')
check('function', 'void operator + ()',
- {1:"add-operator", 2:"plv"}, output='void operator+()')
+ {1: "add-operator", 2: "plv"}, output='void operator+()')
check('function', 'void operator = ()',
- {1:"assign-operator", 2:"aSv"}, output='void operator=()')
+ {1: "assign-operator", 2: "aSv"}, output='void operator=()')
check('function', 'void operator / ()',
- {1:"div-operator", 2:"dvv"}, output='void operator/()')
+ {1: "div-operator", 2: "dvv"}, output='void operator/()')
check('function', 'void operator % ()',
- {1:"mod-operator", 2:"rmv"}, output='void operator%()')
+ {1: "mod-operator", 2: "rmv"}, output='void operator%()')
check('function', 'void operator ! ()',
- {1:"not-operator", 2:"ntv"}, output='void operator!()')
+ {1: "not-operator", 2: "ntv"}, output='void operator!()')
check('function', 'void operator "" _udl()',
- {2:'li4_udlv'}, output='void operator""_udl()')
+ {2: 'li4_udlv'}, output='void operator""_udl()')
def test_class_definitions():
- check('class', 'public A', {1:"A", 2:"1A"}, output='A')
- check('class', 'private A', {1:"A", 2:"1A"})
- check('class', 'A final', {1:'A', 2:'1A'})
+ check('class', 'public A', {1: "A", 2: "1A"}, output='A')
+ check('class', 'private A', {1: "A", 2: "1A"})
+ check('class', 'A final', {1: 'A', 2: '1A'})
# test bases
- check('class', 'A', {1:"A", 2:"1A"})
- check('class', 'A::B::C', {1:"A::B::C", 2:"N1A1B1CE"})
- check('class', 'A : B', {1:"A", 2:"1A"})
- check('class', 'A : private B', {1:"A", 2:"1A"}, output='A : B')
- check('class', 'A : public B', {1:"A", 2:"1A"})
- check('class', 'A : B, C', {1:"A", 2:"1A"})
- check('class', 'A : B, protected C, D', {1:"A", 2:"1A"})
- check('class', 'A : virtual private B', {1:'A', 2:'1A'}, output='A : virtual B')
- check('class', 'A : B, virtual C', {1:'A', 2:'1A'})
- check('class', 'A : public virtual B', {1:'A', 2:'1A'})
- check('class', 'A : B, C...', {1:'A', 2:'1A'})
- check('class', 'A : B..., C', {1:'A', 2:'1A'})
+ check('class', 'A', {1: "A", 2: "1A"})
+ check('class', 'A::B::C', {1: "A::B::C", 2: "N1A1B1CE"})
+ check('class', 'A : B', {1: "A", 2: "1A"})
+ check('class', 'A : private B', {1: "A", 2: "1A"}, output='A : B')
+ check('class', 'A : public B', {1: "A", 2: "1A"})
+ check('class', 'A : B, C', {1: "A", 2: "1A"})
+ check('class', 'A : B, protected C, D', {1: "A", 2: "1A"})
+ check('class', 'A : virtual private B', {1: 'A', 2: '1A'}, output='A : virtual B')
+ check('class', 'A : B, virtual C', {1: 'A', 2: '1A'})
+ check('class', 'A : public virtual B', {1: 'A', 2: '1A'})
+ check('class', 'A : B, C...', {1: 'A', 2: '1A'})
+ check('class', 'A : B..., C', {1: 'A', 2: '1A'})
# from #4094
- check('class', 'template> has_var', {2:'I00E7has_var'})
- check('class', 'template has_var>', {2:'I0E7has_varI1TNSt6void_tIDTadN1T3varEEEEE'})
+ check('class', 'template> has_var', {2: 'I00E7has_var'})
+ check('class', 'template has_var>',
+ {2: 'I0E7has_varI1TNSt6void_tIDTadN1T3varEEEEE'})
def test_enum_definitions():
- check('enum', 'A', {2:"1A"})
- check('enum', 'A : std::underlying_type::type', {2:"1A"})
- check('enum', 'A : unsigned int', {2:"1A"})
- check('enum', 'public A', {2:"1A"}, output='A')
- check('enum', 'private A', {2:"1A"})
+ check('enum', 'A', {2: "1A"})
+ check('enum', 'A : std::underlying_type::type', {2: "1A"})
+ check('enum', 'A : unsigned int', {2: "1A"})
+ check('enum', 'public A', {2: "1A"}, output='A')
+ check('enum', 'private A', {2: "1A"})
- check('enumerator', 'A', {2:"1A"})
- check('enumerator', 'A = std::numeric_limits::max()', {2:"1A"})
+ check('enumerator', 'A', {2: "1A"})
+ check('enumerator', 'A = std::numeric_limits::max()', {2: "1A"})
def test_templates():
- check('class', "A", {2:"IE1AI1TE"}, output="template<> A")
+ check('class', "A", {2: "IE1AI1TE"}, output="template<> A")
# first just check which objects support templating
- check('class', "template<> A", {2:"IE1A"})
- check('function', "template<> void A()", {2:"IE1Av"})
- check('member', "template<> A a", {2:"IE1a"})
- check('type', "template<> a = A", {2:"IE1a"})
+ check('class', "template<> A", {2: "IE1A"})
+ check('function', "template<> void A()", {2: "IE1Av"})
+ check('member', "template<> A a", {2: "IE1a"})
+ check('type', "template<> a = A", {2: "IE1a"})
with pytest.raises(DefinitionError):
parse('enum', "template<> A")
with pytest.raises(DefinitionError):
parse('enumerator', "template<> A")
# then all the real tests
- check('class', "template A", {2:"I00E1A"})
- check('type', "template<> a", {2:"IE1a"})
+ check('class', "template A", {2: "I00E1A"})
+ check('type', "template<> a", {2: "IE1a"})
- check('class', "template A", {2:"I0E1A"})
- check('class', "template A", {2:"I0E1A"})
- check('class', "template A", {2:"IDpE1A"})
- check('class', "template A", {2:"IDpE1A"})
- check('class', "template A", {2:"I0E1A"})
- check('class', "template A", {2:"I0E1A"})
+ check('class', "template A", {2: "I0E1A"})
+ check('class', "template A", {2: "I0E1A"})
+ check('class', "template A", {2: "IDpE1A"})
+ check('class', "template A", {2: "IDpE1A"})
+ check('class', "template A", {2: "I0E1A"})
+ check('class', "template A", {2: "I0E1A"})
- check('class', "template typename T> A", {2:"II0E0E1A"})
+ check('class', "template typename T> A", {2: "II0E0E1A"})
check('class', "template typename> A", {2: "II0E0E1A"})
- check('class', "template typename ...T> A", {2:"II0EDpE1A"})
+ check('class', "template typename ...T> A", {2: "II0EDpE1A"})
check('class', "template typename...> A", {2: "II0EDpE1A"})
- check('class', "template A", {2:"I_iE1A"})
- check('class', "template A", {2:"I_iE1A"})
- check('class', "template A", {2:"I_DpiE1A"})
- check('class', "template A", {2:"I_iE1A"})
- check('class', "template A", {2:"I_iE1A"})
+ check('class', "template A", {2: "I_iE1A"})
+ check('class', "template A", {2: "I_iE1A"})
+ check('class', "template A", {2: "I_DpiE1A"})
+ check('class', "template A", {2: "I_iE1A"})
+ check('class', "template A", {2: "I_iE1A"})
- check('class', "template<> A>", {2:"IE1AIN2NS1BIEEE"})
+ check('class', "template<> A>", {2: "IE1AIN2NS1BIEEE"})
# from #2058
check('function',
@@ -527,8 +528,8 @@ def test_templates():
"inline std::basic_ostream &operator<<("
"std::basic_ostream &os, "
"const c_string_view_base &str)",
- {2:"I00ElsRNSt13basic_ostreamI4Char6TraitsEE"
- "RK18c_string_view_baseIK4Char6TraitsE"})
+ {2: "I00ElsRNSt13basic_ostreamI4Char6TraitsEE"
+ "RK18c_string_view_baseIK4Char6TraitsE"})
# template introductions
with pytest.raises(DefinitionError):
@@ -536,42 +537,42 @@ def test_templates():
with pytest.raises(DefinitionError):
parse('enumerator', 'abc::ns::foo{id_0, id_1, id_2} A')
check('class', 'abc::ns::foo{id_0, id_1, id_2} xyz::bar',
- {2:'I000EXN3abc2ns3fooEI4id_04id_14id_2EEN3xyz3barE'})
+ {2: 'I000EXN3abc2ns3fooEI4id_04id_14id_2EEN3xyz3barE'})
check('class', 'abc::ns::foo{id_0, id_1, ...id_2} xyz::bar',
- {2:'I00DpEXN3abc2ns3fooEI4id_04id_1sp4id_2EEN3xyz3barE'})
+ {2: 'I00DpEXN3abc2ns3fooEI4id_04id_1sp4id_2EEN3xyz3barE'})
check('class', 'abc::ns::foo{id_0, id_1, id_2} xyz::bar',
- {2:'I000EXN3abc2ns3fooEI4id_04id_14id_2EEN3xyz3barI4id_04id_14id_2EE'})
+ {2: 'I000EXN3abc2ns3fooEI4id_04id_14id_2EEN3xyz3barI4id_04id_14id_2EE'})
check('class', 'abc::ns::foo{id_0, id_1, ...id_2} xyz::bar',
- {2:'I00DpEXN3abc2ns3fooEI4id_04id_1sp4id_2EEN3xyz3barI4id_04id_1Dp4id_2EE'})
+ {2: 'I00DpEXN3abc2ns3fooEI4id_04id_1sp4id_2EEN3xyz3barI4id_04id_1Dp4id_2EE'})
- check('class', 'template<> Concept{U} A::B', {2:'IEI0EX7ConceptI1UEEN1AIiE1BE'})
+ check('class', 'template<> Concept{U} A::B', {2: 'IEI0EX7ConceptI1UEEN1AIiE1BE'})
check('type', 'abc::ns::foo{id_0, id_1, id_2} xyz::bar = ghi::qux',
- {2:'I000EXN3abc2ns3fooEI4id_04id_14id_2EEN3xyz3barE'})
+ {2: 'I000EXN3abc2ns3fooEI4id_04id_14id_2EEN3xyz3barE'})
check('type', 'abc::ns::foo{id_0, id_1, ...id_2} xyz::bar = ghi::qux',
- {2:'I00DpEXN3abc2ns3fooEI4id_04id_1sp4id_2EEN3xyz3barE'})
+ {2: 'I00DpEXN3abc2ns3fooEI4id_04id_1sp4id_2EEN3xyz3barE'})
check('function', 'abc::ns::foo{id_0, id_1, id_2} void xyz::bar()',
- {2:'I000EXN3abc2ns3fooEI4id_04id_14id_2EEN3xyz3barEv'})
+ {2: 'I000EXN3abc2ns3fooEI4id_04id_14id_2EEN3xyz3barEv'})
check('function', 'abc::ns::foo{id_0, id_1, ...id_2} void xyz::bar()',
- {2:'I00DpEXN3abc2ns3fooEI4id_04id_1sp4id_2EEN3xyz3barEv'})
+ {2: 'I00DpEXN3abc2ns3fooEI4id_04id_1sp4id_2EEN3xyz3barEv'})
check('member', 'abc::ns::foo{id_0, id_1, id_2} ghi::qux xyz::bar',
- {2:'I000EXN3abc2ns3fooEI4id_04id_14id_2EEN3xyz3barE'})
+ {2: 'I000EXN3abc2ns3fooEI4id_04id_14id_2EEN3xyz3barE'})
check('member', 'abc::ns::foo{id_0, id_1, ...id_2} ghi::qux xyz::bar',
- {2:'I00DpEXN3abc2ns3fooEI4id_04id_1sp4id_2EEN3xyz3barE'})
- check('concept', 'Iterator{T, U} Another', {2:'I00EX8IteratorI1T1UEE7Another'})
+ {2: 'I00DpEXN3abc2ns3fooEI4id_04id_1sp4id_2EEN3xyz3barE'})
+ check('concept', 'Iterator{T, U} Another', {2: 'I00EX8IteratorI1T1UEE7Another'})
check('concept', 'template Numerics = (... && Numeric)',
- {2:'IDpE8Numerics'})
+ {2: 'IDpE8Numerics'})
# explicit specializations of members
- check('member', 'template<> int A::a', {2:'IEN1AIiE1aE'})
+ check('member', 'template<> int A::a', {2: 'IEN1AIiE1aE'})
check('member', 'template int A::a', {2: 'IEN1AIiE1aE'},
output='template<> int A::a') # same as above
- check('member', 'template<> template<> int A::B::b', {2:'IEIEN1AIiE1BIiE1bE'})
+ check('member', 'template<> template<> int A::B::b', {2: 'IEIEN1AIiE1BIiE1bE'})
check('member', 'template int A::B::b', {2: 'IEIEN1AIiE1BIiE1bE'},
output='template<> template<> int A::B::b') # same as above
# defaulted constrained type parameters
- check('type', 'template A', {2:'I_1CE1A'})
+ check('type', 'template A', {2: 'I_1CE1A'})
def test_template_args():
@@ -579,33 +580,32 @@ def test_template_args():
check('function',
"template "
"void allow(F *f, typename func::type tt)",
- {2:"I0E5allowP1FN4funcI1F1BXG != 1EE4typeE",
- 3:"I0E5allowP1FN4funcI1F1BXne1GL1EEE4typeE"})
+ {2: "I0E5allowP1FN4funcI1F1BXG != 1EE4typeE",
+ 3: "I0E5allowP1FN4funcI1F1BXne1GL1EEE4typeE"})
# from #3542
check('type', "template "
"enable_if_not_array_t = std::enable_if_t::value, int>",
- {2:"I0E21enable_if_not_array_t"})
-
+ {2: "I0E21enable_if_not_array_t"})
def test_attributes():
# style: C++
- check('member', '[[]] int f', {1:'f__i', 2:'1f'})
- check('member', '[ [ ] ] int f', {1:'f__i', 2:'1f'},
+ check('member', '[[]] int f', {1: 'f__i', 2: '1f'})
+ check('member', '[ [ ] ] int f', {1: 'f__i', 2: '1f'},
# this will fail when the proper grammar is implemented
output='[[ ]] int f')
- check('member', '[[a]] int f', {1:'f__i', 2:'1f'})
+ check('member', '[[a]] int f', {1: 'f__i', 2: '1f'})
# style: GNU
- check('member', '__attribute__(()) int f', {1:'f__i', 2:'1f'})
- check('member', '__attribute__((a)) int f', {1:'f__i', 2:'1f'})
- check('member', '__attribute__((a, b)) int f', {1:'f__i', 2:'1f'})
+ check('member', '__attribute__(()) int f', {1: 'f__i', 2: '1f'})
+ check('member', '__attribute__((a)) int f', {1: 'f__i', 2: '1f'})
+ check('member', '__attribute__((a, b)) int f', {1: 'f__i', 2: '1f'})
# style: user-defined id
- check('member', 'id_attr int f', {1:'f__i', 2:'1f'})
+ check('member', 'id_attr int f', {1: 'f__i', 2: '1f'})
# style: user-defined paren
- check('member', 'paren_attr() int f', {1:'f__i', 2:'1f'})
- check('member', 'paren_attr(a) int f', {1:'f__i', 2:'1f'})
- check('member', 'paren_attr("") int f', {1:'f__i', 2:'1f'})
- check('member', 'paren_attr(()[{}][]{}) int f', {1:'f__i', 2:'1f'})
+ check('member', 'paren_attr() int f', {1: 'f__i', 2: '1f'})
+ check('member', 'paren_attr(a) int f', {1: 'f__i', 2: '1f'})
+ check('member', 'paren_attr("") int f', {1: 'f__i', 2: '1f'})
+ check('member', 'paren_attr(()[{}][]{}) int f', {1: 'f__i', 2: '1f'})
with pytest.raises(DefinitionError):
parse('member', 'paren_attr(() int f')
with pytest.raises(DefinitionError):
@@ -621,7 +621,7 @@ def test_attributes():
# position: decl specs
check('function', 'static inline __attribute__(()) void f()',
- {1:'f', 2:'1fv'},
+ {1: 'f', 2: '1fv'},
output='__attribute__(()) static inline void f()')
diff --git a/tests/test_environment.py b/tests/test_environment.py
index 611d34577..64089b7c8 100644
--- a/tests/test_environment.py
+++ b/tests/test_environment.py
@@ -22,7 +22,7 @@ def setup_module(rootdir, sphinx_test_tempdir):
global app, env
srcdir = sphinx_test_tempdir / 'root-envtest'
if not srcdir.exists():
- (rootdir/'test-root').copytree(srcdir)
+ (rootdir / 'test-root').copytree(srcdir)
app = SphinxTestApp(srcdir=srcdir)
env = app.env
yield
diff --git a/tests/test_ext_autosummary.py b/tests/test_ext_autosummary.py
index b59f0cbc8..b0b34f8f1 100644
--- a/tests/test_ext_autosummary.py
+++ b/tests/test_ext_autosummary.py
@@ -163,7 +163,8 @@ def test_import_by_name():
assert parent is sphinx.ext.autosummary
assert modname == 'sphinx.ext.autosummary'
- prefixed_name, obj, parent, modname = import_by_name('sphinx.ext.autosummary.Autosummary.get_items')
+ prefixed_name, obj, parent, modname = \
+ import_by_name('sphinx.ext.autosummary.Autosummary.get_items')
assert prefixed_name == 'sphinx.ext.autosummary.Autosummary.get_items'
assert obj == sphinx.ext.autosummary.Autosummary.get_items
assert parent is sphinx.ext.autosummary.Autosummary
diff --git a/tests/test_ext_graphviz.py b/tests/test_ext_graphviz.py
index 1d2a3ab2f..118e6abe2 100644
--- a/tests/test_ext_graphviz.py
+++ b/tests/test_ext_graphviz.py
@@ -40,6 +40,7 @@ def test_graphviz_png_html(app, status, warning):
r'}\" />\n')
assert re.search(html, content, re.S)
+
@pytest.mark.sphinx('html', testroot='ext-graphviz',
confoverrides={'graphviz_output_format': 'svg'})
@pytest.mark.usefixtures('if_graphviz_found')
@@ -80,6 +81,7 @@ def test_graphviz_svg_html(app, status, warning):
r'')
assert re.search(html, content, re.S)
+
@pytest.mark.sphinx('latex', testroot='ext-graphviz')
@pytest.mark.usefixtures('if_graphviz_found')
def test_graphviz_latex(app, status, warning):
diff --git a/tests/test_ext_intersphinx.py b/tests/test_ext_intersphinx.py
index 594aa81b8..c1e1dae93 100644
--- a/tests/test_ext_intersphinx.py
+++ b/tests/test_ext_intersphinx.py
@@ -240,7 +240,6 @@ def test_missing_reference_cppdomain(tempdir, app, status, warning):
' title="(in foo v2.0)">bartype' in html)
-
def test_missing_reference_jsdomain(tempdir, app, status, warning):
inv_file = tempdir / 'inventory'
inv_file.write_bytes(inventory_v2)
diff --git a/tests/test_ext_todo.py b/tests/test_ext_todo.py
index 4f01a07ab..19225bea8 100644
--- a/tests/test_ext_todo.py
+++ b/tests/test_ext_todo.py
@@ -85,6 +85,7 @@ def test_todo_not_included(app, status, warning):
assert len(todos) == 2
assert set(todo[1].astext() for todo in todos) == set(['todo in foo', 'todo in bar'])
+
@pytest.mark.sphinx('latex', testroot='ext-todo', freshenv=True,
confoverrides={'todo_include_todos': True, 'todo_emit_warnings': True})
def test_todo_valid_link(app, status, warning):
@@ -107,8 +108,7 @@ def test_todo_valid_link(app, status, warning):
target = m[0]
# Look for the targets of this link.
- labels = [m for m in re.findall(r'\\label\{([^}]*)}', content)
- if m == target]
+ labels = [m for m in re.findall(r'\\label\{([^}]*)}', content) if m == target]
# If everything is correct we should have exactly one target.
assert len(labels) == 1
diff --git a/tests/test_intl.py b/tests/test_intl.py
index 6b72438bd..fd2bcd5b5 100644
--- a/tests/test_intl.py
+++ b/tests/test_intl.py
@@ -222,6 +222,7 @@ def test_text_inconsistency_warnings(app, warning):
u'.*/refs_inconsistency.txt:\\d+: WARNING: citation not found: ref3')
assert_re_search(expected_citation_warning_expr, warnings)
+
@sphinx_intl
@pytest.mark.sphinx('text')
@pytest.mark.test_params(shared_result='test_intl_basic')
diff --git a/tests/test_quickstart.py b/tests/test_quickstart.py
index f69a0a58e..160e2df32 100644
--- a/tests/test_quickstart.py
+++ b/tests/test_quickstart.py
@@ -96,7 +96,6 @@ def test_do_prompt_inputstrip():
def test_do_prompt_with_nonascii():
- d = {}
answers = {
'Q1': u'\u30c9\u30a4\u30c4',
}
diff --git a/tests/test_util.py b/tests/test_util.py
index aae54eaf0..db1a28869 100644
--- a/tests/test_util.py
+++ b/tests/test_util.py
@@ -95,7 +95,6 @@ def test_parselinenos():
parselinenos('3-1', 10)
-
def test_xmlname_check():
checker = xmlname_checker()
assert checker.match('id-pub')
diff --git a/tests/test_util_images.py b/tests/test_util_images.py
index 6f67dcc82..fbee12a61 100644
--- a/tests/test_util_images.py
+++ b/tests/test_util_images.py
@@ -44,22 +44,22 @@ def test_guess_mimetype(testroot):
assert guess_mimetype('IMG.PNG') == 'image/png'
# guess by content
- assert guess_mimetype(content=(testroot/GIF_FILENAME).bytes()) == 'image/gif'
- assert guess_mimetype(content=(testroot/PNG_FILENAME).bytes()) == 'image/png'
- assert guess_mimetype(content=(testroot/PDF_FILENAME).bytes()) is None
- assert guess_mimetype(content=(testroot/TXT_FILENAME).bytes()) is None
- assert guess_mimetype(content=(testroot/TXT_FILENAME).bytes(),
+ assert guess_mimetype(content=(testroot / GIF_FILENAME).bytes()) == 'image/gif'
+ assert guess_mimetype(content=(testroot / PNG_FILENAME).bytes()) == 'image/png'
+ assert guess_mimetype(content=(testroot / PDF_FILENAME).bytes()) is None
+ assert guess_mimetype(content=(testroot / TXT_FILENAME).bytes()) is None
+ assert guess_mimetype(content=(testroot / TXT_FILENAME).bytes(),
default='text/plain') == 'text/plain'
# the priority of params: filename > content > default
assert guess_mimetype('img.png',
- content=(testroot/GIF_FILENAME).bytes(),
+ content=(testroot / GIF_FILENAME).bytes(),
default='text/plain') == 'image/png'
assert guess_mimetype('no_extension',
- content=(testroot/GIF_FILENAME).bytes(),
+ content=(testroot / GIF_FILENAME).bytes(),
default='text/plain') == 'image/gif'
assert guess_mimetype('no_extension',
- content=(testroot/TXT_FILENAME).bytes(),
+ content=(testroot / TXT_FILENAME).bytes(),
default='text/plain') == 'text/plain'
diff --git a/tests/test_util_inspect.py b/tests/test_util_inspect.py
index 63e04ee76..e5a9ed730 100644
--- a/tests/test_util_inspect.py
+++ b/tests/test_util_inspect.py
@@ -113,7 +113,6 @@ def test_getargspec_bound_methods():
assert expected_bound == inspect.getargspec(wrapped_bound_method)
-
def test_Signature():
# literals
with pytest.raises(TypeError):
diff --git a/tests/test_versioning.py b/tests/test_versioning.py
index b73c00fa6..2832a12e4 100644
--- a/tests/test_versioning.py
+++ b/tests/test_versioning.py
@@ -28,7 +28,7 @@ def setup_module(rootdir, sphinx_test_tempdir):
global app, original, original_uids
srcdir = sphinx_test_tempdir / 'test-versioning'
if not srcdir.exists():
- (rootdir/'test-versioning').copytree(srcdir)
+ (rootdir / 'test-versioning').copytree(srcdir)
app = SphinxTestApp(srcdir=srcdir)
app.builder.env.app = app
app.connect('doctree-resolved', on_doctree_resolved)