summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test_application.py2
-rw-r--r--tests/test_builder.py4
-rw-r--r--tests/test_catalogs.py10
-rw-r--r--tests/test_environment.py13
-rw-r--r--tests/test_environment_toctree.py8
-rw-r--r--tests/test_ext_coverage.py2
-rw-r--r--tests/test_ext_inheritance_diagram.py2
-rw-r--r--tests/test_ext_napoleon_docstring.py2
-rw-r--r--tests/test_ext_todo.py12
-rw-r--r--tests/test_intl.py3
-rw-r--r--tests/test_util_i18n.py24
-rw-r--r--tests/test_util_inspect.py2
12 files changed, 41 insertions, 43 deletions
diff --git a/tests/test_application.py b/tests/test_application.py
index 08c13c5cf..f10592b51 100644
--- a/tests/test_application.py
+++ b/tests/test_application.py
@@ -64,7 +64,7 @@ def test_extension_in_blacklist(app, status, warning):
@pytest.mark.filterwarnings('ignore:The config variable "source_parsers"')
@pytest.mark.filterwarnings('ignore:app.add_source_parser\\(\\) does not support suffix')
def test_add_source_parser(app, status, warning):
- assert set(app.config.source_suffix) == set(['.rst', '.md', '.test'])
+ assert set(app.config.source_suffix) == {'.rst', '.md', '.test'}
# .rst; only in :confval:`source_suffix`
assert '.rst' not in app.registry.get_source_parsers()
diff --git a/tests/test_builder.py b/tests/test_builder.py
index 35197a8ef..fa64f0c1f 100644
--- a/tests/test_builder.py
+++ b/tests/test_builder.py
@@ -28,7 +28,7 @@ def test_incremental_reading(app):
# second reading
updated = app.builder.read()
- assert set(updated) == set(['index', 'new'])
+ assert set(updated) == {'index', 'new'}
assert 'autodoc' not in app.env.all_docs
assert 'autodoc' not in app.env.found_docs
@@ -44,4 +44,4 @@ def test_incremental_reading_for_missing_files(app):
# "index" is listed up to updated because it contains references
# to nonexisting downloadable or image files
- assert set(updated) == set(['index'])
+ assert set(updated) == {'index'}
diff --git a/tests/test_catalogs.py b/tests/test_catalogs.py
index f5fffa9d6..1a14d46e6 100644
--- a/tests/test_catalogs.py
+++ b/tests/test_catalogs.py
@@ -43,10 +43,10 @@ def test_compile_all_catalogs(app, status, warning):
locale_dir = app.srcdir / 'locale'
catalog_dir = locale_dir / app.config.language / 'LC_MESSAGES'
- expect = set([
+ expect = {
x.replace('.po', '.mo')
for x in find_files(catalog_dir, '.po')
- ])
+ }
actual = set(find_files(catalog_dir, '.mo'))
assert actual # not empty
assert actual == expect
@@ -67,7 +67,7 @@ def test_compile_specific_catalogs(app, status, warning):
actual_on_boot = get_actual() # sphinx.mo might be included
app.builder.compile_specific_catalogs([app.srcdir / 'admonitions.txt'])
actual = get_actual() - actual_on_boot
- assert actual == set(['admonitions.mo'])
+ assert actual == {'admonitions.mo'}
@pytest.mark.usefixtures('setup_test')
@@ -80,10 +80,10 @@ def test_compile_update_catalogs(app, status, warning):
locale_dir = app.srcdir / 'locale'
catalog_dir = locale_dir / app.config.language / 'LC_MESSAGES'
- expect = set([
+ expect = {
x.replace('.po', '.mo')
for x in find_files(catalog_dir, '.po')
- ])
+ }
actual = set(find_files(catalog_dir, '.mo'))
assert actual # not empty
assert actual == expect
diff --git a/tests/test_environment.py b/tests/test_environment.py
index df0aa20b0..15562536f 100644
--- a/tests/test_environment.py
+++ b/tests/test_environment.py
@@ -25,21 +25,20 @@ def test_images(app):
htmlbuilder.imgpath = 'dummy'
htmlbuilder.post_process_images(tree)
assert set(htmlbuilder.images.keys()) == \
- set(['subdir/img.png', 'img.png', 'subdir/simg.png', 'svgimg.svg',
- 'img.foo.png'])
+ {'subdir/img.png', 'img.png', 'subdir/simg.png', 'svgimg.svg', 'img.foo.png'}
assert set(htmlbuilder.images.values()) == \
- set(['img.png', 'img1.png', 'simg.png', 'svgimg.svg', 'img.foo.png'])
+ {'img.png', 'img1.png', 'simg.png', 'svgimg.svg', 'img.foo.png'}
latexbuilder = LaTeXBuilder(app)
latexbuilder.set_environment(app.env)
latexbuilder.init()
latexbuilder.post_process_images(tree)
assert set(latexbuilder.images.keys()) == \
- set(['subdir/img.png', 'subdir/simg.png', 'img.png', 'img.pdf',
- 'svgimg.pdf', 'img.foo.png'])
+ {'subdir/img.png', 'subdir/simg.png', 'img.png', 'img.pdf',
+ 'svgimg.pdf', 'img.foo.png'}
assert set(latexbuilder.images.values()) == \
- set(['img.pdf', 'img.png', 'img1.png', 'simg.png',
- 'svgimg.pdf', 'img.foo.png'])
+ {'img.pdf', 'img.png', 'img1.png', 'simg.png',
+ 'svgimg.pdf', 'img.foo.png'}
@pytest.mark.sphinx('dummy')
diff --git a/tests/test_environment_toctree.py b/tests/test_environment_toctree.py
index c490dcedf..9d880d92c 100644
--- a/tests/test_environment_toctree.py
+++ b/tests/test_environment_toctree.py
@@ -75,11 +75,11 @@ def test_process_doc(app):
# other collections
assert app.env.toc_num_entries['index'] == 6
assert app.env.toctree_includes['index'] == ['foo', 'bar', 'baz']
- assert app.env.files_to_rebuild['foo'] == set(['index'])
- assert app.env.files_to_rebuild['bar'] == set(['index'])
- assert app.env.files_to_rebuild['baz'] == set(['index'])
+ assert app.env.files_to_rebuild['foo'] == {'index'}
+ assert app.env.files_to_rebuild['bar'] == {'index'}
+ assert app.env.files_to_rebuild['baz'] == {'index'}
assert app.env.glob_toctrees == set()
- assert app.env.numbered_toctrees == set(['index'])
+ assert app.env.numbered_toctrees == {'index'}
# qux has no section title
assert len(app.env.tocs['qux']) == 0
diff --git a/tests/test_ext_coverage.py b/tests/test_ext_coverage.py
index d02d65feb..73181909d 100644
--- a/tests/test_ext_coverage.py
+++ b/tests/test_ext_coverage.py
@@ -37,7 +37,7 @@ def test_build(app, status, warning):
undoc_py, undoc_c = pickle.loads((app.outdir / 'undoc.pickle').bytes())
assert len(undoc_c) == 1
# the key is the full path to the header file, which isn't testable
- assert list(undoc_c.values())[0] == set([('function', 'Py_SphinxTest')])
+ assert list(undoc_c.values())[0] == {('function', 'Py_SphinxTest')}
assert 'autodoc_target' in undoc_py
assert 'funcs' in undoc_py['autodoc_target']
diff --git a/tests/test_ext_inheritance_diagram.py b/tests/test_ext_inheritance_diagram.py
index 9e5d3e60f..03b5bb689 100644
--- a/tests/test_ext_inheritance_diagram.py
+++ b/tests/test_ext_inheritance_diagram.py
@@ -121,7 +121,7 @@ def test_import_classes(rootdir):
# all of classes in the module
classes = import_classes('sphinx.application', None)
- assert set(classes) == set([Sphinx, TemplateBridge])
+ assert set(classes) == {Sphinx, TemplateBridge}
# specified class in the module
classes = import_classes('sphinx.application.Sphinx', None)
diff --git a/tests/test_ext_napoleon_docstring.py b/tests/test_ext_napoleon_docstring.py
index fa75062b3..86ded7d89 100644
--- a/tests/test_ext_napoleon_docstring.py
+++ b/tests/test_ext_napoleon_docstring.py
@@ -36,7 +36,7 @@ class NamedtupleSubclass(namedtuple('NamedtupleSubclass', ('attr1', 'attr2'))):
__slots__ = ()
def __new__(cls, attr1, attr2=None):
- return super(NamedtupleSubclass, cls).__new__(cls, attr1, attr2)
+ return super().__new__(cls, attr1, attr2)
class BaseDocstringTest(TestCase):
diff --git a/tests/test_ext_todo.py b/tests/test_ext_todo.py
index 2ce7ac95e..3fca33f6f 100644
--- a/tests/test_ext_todo.py
+++ b/tests/test_ext_todo.py
@@ -54,9 +54,9 @@ def test_todo(app, status, warning):
# check handled event
assert len(todos) == 3
- assert set(todo[1].astext() for todo in todos) == {'todo in foo',
- 'todo in bar',
- 'todo in param field'}
+ assert {todo[1].astext() for todo in todos} == {'todo in foo',
+ 'todo in bar',
+ 'todo in param field'}
@pytest.mark.sphinx('html', testroot='ext-todo', freshenv=True,
@@ -92,9 +92,9 @@ def test_todo_not_included(app, status, warning):
# check handled event
assert len(todos) == 3
- assert set(todo[1].astext() for todo in todos) == {'todo in foo',
- 'todo in bar',
- 'todo in param field'}
+ assert {todo[1].astext() for todo in todos} == {'todo in foo',
+ 'todo in bar',
+ 'todo in param field'}
@pytest.mark.sphinx('latex', testroot='ext-todo', freshenv=True,
diff --git a/tests/test_intl.py b/tests/test_intl.py
index 002851f07..ddb22ef9f 100644
--- a/tests/test_intl.py
+++ b/tests/test_intl.py
@@ -818,8 +818,7 @@ def test_xml_footnote_backlinks(app):
para0 = secs[0].findall('paragraph')
refs0 = para0[0].findall('footnote_reference')
- refid2id = dict([
- (r.attrib.get('refid'), r.attrib.get('ids')) for r in refs0])
+ refid2id = {r.attrib.get('refid'): r.attrib.get('ids') for r in refs0}
footnote0 = secs[0].findall('footnote')
for footnote in footnote0:
diff --git a/tests/test_util_i18n.py b/tests/test_util_i18n.py
index 5208689e8..4737d465c 100644
--- a/tests/test_util_i18n.py
+++ b/tests/test_util_i18n.py
@@ -70,13 +70,13 @@ def test_get_catalogs_for_xx(tempdir):
(tempdir / 'loc1' / 'xx' / 'LC_ALL' / 'test7.po').write_text('#')
catalogs = i18n.find_catalog_source_files([tempdir / 'loc1'], 'xx', force_all=False)
- domains = set(c.domain for c in catalogs)
- assert domains == set([
+ domains = {c.domain for c in catalogs}
+ assert domains == {
'test1',
'test2',
'sub/test4',
'sub/test5',
- ])
+ }
def test_get_catalogs_for_en(tempdir):
@@ -86,8 +86,8 @@ def test_get_catalogs_for_en(tempdir):
(tempdir / 'loc1' / 'en' / 'LC_MESSAGES' / 'en_dom.po').write_text('#')
catalogs = i18n.find_catalog_source_files([tempdir / 'loc1'], 'en', force_all=False)
- domains = set(c.domain for c in catalogs)
- assert domains == set(['en_dom'])
+ domains = {c.domain for c in catalogs}
+ assert domains == {'en_dom'}
def test_get_catalogs_with_non_existent_locale(tempdir):
@@ -121,13 +121,13 @@ def test_get_catalogs_for_xx_without_outdated(tempdir):
assert not catalogs
catalogs = i18n.find_catalog_source_files([tempdir / 'loc1'], 'xx', force_all=True)
- domains = set(c.domain for c in catalogs)
- assert domains == set([
+ domains = {c.domain for c in catalogs}
+ assert domains == {
'test1',
'test2',
'sub/test4',
'sub/test5',
- ])
+ }
def test_get_catalogs_from_multiple_locale_dirs(tempdir):
@@ -152,8 +152,8 @@ def test_get_catalogs_with_compact(tempdir):
(tempdir / 'loc1' / 'xx' / 'LC_MESSAGES' / 'sub' / 'test4.po').write_text('#')
catalogs = i18n.find_catalog_source_files([tempdir / 'loc1'], 'xx', gettext_compact=True)
- domains = set(c.domain for c in catalogs)
- assert domains == set(['test1', 'test2', 'sub/test3', 'sub/test4'])
+ domains = {c.domain for c in catalogs}
+ assert domains == {'test1', 'test2', 'sub/test3', 'sub/test4'}
def test_get_catalogs_excluded(tempdir):
@@ -163,8 +163,8 @@ def test_get_catalogs_excluded(tempdir):
catalogs = i18n.find_catalog_source_files(
[tempdir / 'loc1'], 'en', force_all=False, excluded=lambda path: '.git' in path)
- domains = set(c.domain for c in catalogs)
- assert domains == set(['en_dom'])
+ domains = {c.domain for c in catalogs}
+ assert domains == {'en_dom'}
def test_format_date():
diff --git a/tests/test_util_inspect.py b/tests/test_util_inspect.py
index 6cb2a4b1b..ba2bb7501 100644
--- a/tests/test_util_inspect.py
+++ b/tests/test_util_inspect.py
@@ -352,7 +352,7 @@ def test_set_sorting():
def test_set_sorting_fallback():
- set_ = set((None, 1))
+ set_ = {None, 1}
description = inspect.object_description(set_)
assert description in ("{1, None}", "{None, 1}")