summaryrefslogtreecommitdiff
path: root/docutils/test
diff options
context:
space:
mode:
authormilde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2022-01-29 16:28:17 +0000
committermilde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2022-01-29 16:28:17 +0000
commitd79d962ed7046a7fc6a53bdfe472d68f273f3b68 (patch)
tree1f2d820f66283f8905b947ca14c734dcf26a4973 /docutils/test
parentfbf6ed81005614eb13e3db1c6c53f565cb22ef44 (diff)
downloaddocutils-d79d962ed7046a7fc6a53bdfe472d68f273f3b68.tar.gz
Fix code indentation
Check conformance to our coding policies with flake8. Fix the following problems: E111 indentation is not a multiple of four E114 indentation is not a multiple of four (comment) E115 expected an indented block (comment) E116 unexpected indentation (comment) E117 over-indented E121 continuation line under-indented for hanging indent E122 continuation line missing indentation or outdented E124 closing bracked does not match visual indentaion E127 continuation line over-indented for visual indent E128 continuation line under-indented for visual indent E131 continuation line unaligned for hanging indent git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@8994 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'docutils/test')
-rw-r--r--docutils/test/functional/tests/dangerous.py3
-rw-r--r--docutils/test/functional/tests/pep_html.py3
-rwxr-xr-xdocutils/test/functional/tests/standalone_rst_s5_html_1.py3
-rw-r--r--docutils/test/package_unittest.py4
-rw-r--r--docutils/test/test__init__.py2
-rwxr-xr-xdocutils/test/test_dependencies.py10
-rwxr-xr-xdocutils/test/test_io.py8
-rwxr-xr-xdocutils/test/test_nodes.py59
-rwxr-xr-xdocutils/test/test_parsers/test_rst/test_directives/test_block_quotes.py6
-rwxr-xr-xdocutils/test/test_publisher.py19
-rwxr-xr-xdocutils/test/test_settings.py13
-rwxr-xr-xdocutils/test/test_statemachine.py32
-rwxr-xr-xdocutils/test/test_traversals.py6
-rwxr-xr-xdocutils/test/test_utils.py12
-rwxr-xr-xdocutils/test/test_viewlist.py4
-rwxr-xr-xdocutils/test/test_writers/test_docutils_xml.py3
-rwxr-xr-xdocutils/test/test_writers/test_html4css1_misc.py109
-rwxr-xr-xdocutils/test/test_writers/test_html4css1_template.py2
-rw-r--r--docutils/test/test_writers/test_html5_polyglot_misc.py110
-rw-r--r--docutils/test/test_writers/test_html5_polyglot_parts.py8
-rwxr-xr-xdocutils/test/test_writers/test_latex2e.py21
-rw-r--r--docutils/test/test_writers/test_latex2e_misc.py4
-rwxr-xr-xdocutils/test/test_writers/test_odt.py31
23 files changed, 231 insertions, 241 deletions
diff --git a/docutils/test/functional/tests/dangerous.py b/docutils/test/functional/tests/dangerous.py
index 352785673..84f467163 100644
--- a/docutils/test/functional/tests/dangerous.py
+++ b/docutils/test/functional/tests/dangerous.py
@@ -11,5 +11,4 @@ writer_name = "html"
settings_overrides['file_insertion_enabled'] = False
settings_overrides['raw_enabled'] = False
# local copy of default stylesheet:
-settings_overrides['stylesheet_path'] = (
- 'functional/input/data/html4css1.css')
+settings_overrides['stylesheet_path'] = 'functional/input/data/html4css1.css'
diff --git a/docutils/test/functional/tests/pep_html.py b/docutils/test/functional/tests/pep_html.py
index 6cd28e3c4..09c796292 100644
--- a/docutils/test/functional/tests/pep_html.py
+++ b/docutils/test/functional/tests/pep_html.py
@@ -13,5 +13,4 @@ settings_overrides['pep_home'] = "http://www.python.org/peps"
settings_overrides['no_random'] = 1
settings_overrides['cloak_email_addresses'] = 1
# local copy of default stylesheet:
-settings_overrides['stylesheet_path'] = (
- 'functional/input/data/html4css1.css')
+settings_overrides['stylesheet_path'] = 'functional/input/data/html4css1.css'
diff --git a/docutils/test/functional/tests/standalone_rst_s5_html_1.py b/docutils/test/functional/tests/standalone_rst_s5_html_1.py
index 3a31bf19e..b4552e6e7 100755
--- a/docutils/test/functional/tests/standalone_rst_s5_html_1.py
+++ b/docutils/test/functional/tests/standalone_rst_s5_html_1.py
@@ -11,8 +11,7 @@ writer_name = 's5_html'
# Settings:
settings_overrides['theme'] = 'small-black'
# local copy of default stylesheet:
-settings_overrides['stylesheet_path'] = (
- 'functional/input/data/html4css1.css')
+settings_overrides['stylesheet_path'] = 'functional/input/data/html4css1.css'
# Extra functional tests.
diff --git a/docutils/test/package_unittest.py b/docutils/test/package_unittest.py
index 1d02f304c..2a8db1070 100644
--- a/docutils/test/package_unittest.py
+++ b/docutils/test/package_unittest.py
@@ -88,8 +88,8 @@ def loadTestModules(path, name='', packages=None):
if filename.endswith('.py'):
fullpath = fullpath[len(path)+1:]
testModules.append(path2mod(fullpath))
- elif packages and os.path.isdir(fullpath) and \
- os.path.isfile(os.path.join(fullpath, '__init__.py')):
+ elif (packages and os.path.isdir(fullpath) and
+ os.path.isfile(os.path.join(fullpath, '__init__.py'))):
paths.append(fullpath)
# Import modules and add their tests to the suite.
sys.path.insert(0, path)
diff --git a/docutils/test/test__init__.py b/docutils/test/test__init__.py
index f40dac19b..fadfd5de2 100644
--- a/docutils/test/test__init__.py
+++ b/docutils/test/test__init__.py
@@ -96,7 +96,7 @@ class VersionInfoTests(unittest.TestCase):
VersionInfo(0, 2, 0, 'beta', 0, False),
VersionInfo(0, 2, 0, 'beta', 0, True),
VersionInfo(0, 2, 0, 'final', 0, True),
- ]
+ ]
# transform to version strings
versions = [docutils.utils.version_identifier(vinfo)
for vinfo in versioninfos]
diff --git a/docutils/test/test_dependencies.py b/docutils/test/test_dependencies.py
index 08b02764b..f3a866da9 100755
--- a/docutils/test/test_dependencies.py
+++ b/docutils/test/test_dependencies.py
@@ -23,7 +23,7 @@ paths = {'include': 'data/include.txt', # included rst file
'scaled-image': '../docs/user/rst/images/biohazard.png',
'figure-image': '../docs/user/rst/images/title.png',
'stylesheet': 'data/stylesheet.txt',
- }
+ }
# avoid latex writer future warnings:
latex_settings_overwrites = {'legacy_column_widths': False,
@@ -101,19 +101,19 @@ class RecordDependenciesTests(unittest.TestCase):
so['embed_stylesheet'] = False
record = self.get_record(writer_name='html', settings_overrides=so)
self.assertTrue(stylesheet not in record,
- '%r should not be in %r' % (stylesheet, record))
+ '%r should not be in %r' % (stylesheet, record))
record = self.get_record(writer_name='latex', settings_overrides=so)
self.assertTrue(stylesheet not in record,
- '%r should not be in %r' % (stylesheet, record))
+ '%r should not be in %r' % (stylesheet, record))
so['embed_stylesheet'] = True
record = self.get_record(writer_name='html', settings_overrides=so)
self.assertTrue(stylesheet in record,
- '%r should be in %r' % (stylesheet, record))
+ '%r should be in %r' % (stylesheet, record))
so['embed_stylesheet'] = True
record = self.get_record(writer_name='latex', settings_overrides=so)
self.assertTrue(stylesheet in record,
- '%r should be in %r' % (stylesheet, record))
+ '%r should be in %r' % (stylesheet, record))
if __name__ == '__main__':
diff --git a/docutils/test/test_io.py b/docutils/test/test_io.py
index d20995dea..7c21b4b24 100755
--- a/docutils/test/test_io.py
+++ b/docutils/test/test_io.py
@@ -205,19 +205,19 @@ class OutputTests(unittest.TestCase):
fo = io.FileOutput(destination=self.mock_stdout)
fo.write(self.bdata)
self.assertEqual(self.mock_stdout.buffer.getvalue(),
- self.bdata)
+ self.bdata)
def test_encoding_clash_resolved(self):
fo = io.FileOutput(destination=self.mock_stdout,
- encoding='latin1', autoclose=False)
+ encoding='latin1', autoclose=False)
fo.write(self.udata)
self.assertEqual(self.mock_stdout.buffer.getvalue(),
- self.udata.encode('latin1'))
+ self.udata.encode('latin1'))
def test_encoding_clash_nonresolvable(self):
del self.mock_stdout.buffer
fo = io.FileOutput(destination=self.mock_stdout,
- encoding='latin1', autoclose=False)
+ encoding='latin1', autoclose=False)
self.assertRaises(ValueError, fo.write, self.udata)
diff --git a/docutils/test/test_nodes.py b/docutils/test/test_nodes.py
index e477760fd..605ffa2d9 100755
--- a/docutils/test/test_nodes.py
+++ b/docutils/test/test_nodes.py
@@ -29,7 +29,7 @@ class TextTests(unittest.TestCase):
def test_repr(self):
self.assertEqual(repr(self.text), r"<#text: 'Line 1.\nLine 2.'>")
self.assertEqual(self.text.shortrepr(),
- r"<#text: 'Line 1.\nLine 2.'>")
+ r"<#text: 'Line 1.\nLine 2.'>")
self.assertEqual(repr(self.unicode_text), "<#text: 'Möhren'>")
def test_str(self):
@@ -61,10 +61,10 @@ class TextTests(unittest.TestCase):
def test_longrepr(self):
self.assertEqual(repr(self.longtext), r"<#text: 'Mary had a "
- r"little lamb whose fleece was white as snow "
- r"and everwh ...'>")
+ r"little lamb whose fleece was white as snow "
+ r"and everwh ...'>")
self.assertEqual(self.longtext.shortrepr(),
- r"<#text: 'Mary had a lit ...'>")
+ r"<#text: 'Mary had a lit ...'>")
def test_Text_rawsource_deprection_warning(self):
with warnings.catch_warnings(record=True) as wng:
@@ -115,13 +115,13 @@ class ElementTests(unittest.TestCase):
element['attr'] = '1'
self.assertEqual(repr(element), r"<Element: <#text: 'text\nmore'>>")
self.assertEqual(str(element),
- '<Element attr="1">text\nmore</Element>')
+ '<Element attr="1">text\nmore</Element>')
dom = element.asdom()
self.assertEqual(dom.toxml(),
- '<Element attr="1">text\nmore</Element>')
+ '<Element attr="1">text\nmore</Element>')
dom.unlink()
self.assertEqual(element.pformat(),
- '<Element attr="1">\n text\n more\n')
+ '<Element attr="1">\n text\n more\n')
def test_clear(self):
element = nodes.Element()
@@ -148,7 +148,7 @@ class ElementTests(unittest.TestCase):
element['ids'].append('someid')
self.assertEqual(element['ids'], ['someid'])
self.assertEqual(element.non_default_attributes(),
- {'ids': ['someid']})
+ {'ids': ['someid']})
self.assertTrue(element.is_not_default('ids'))
def test_update_basic_atts(self):
@@ -325,8 +325,9 @@ class MiscTests(unittest.TestCase):
node_class_names = []
for x in dir(nodes):
c = getattr(nodes, x)
- if isinstance(c, type) and \
- issubclass(c, nodes.Node) and len(c.__bases__) > 1:
+ if (isinstance(c, type)
+ and issubclass(c, nodes.Node)
+ and len(c.__bases__) > 1):
node_class_names.append(x)
node_class_names.sort()
nodes.node_class_names.sort()
@@ -336,7 +337,7 @@ class MiscTests(unittest.TestCase):
('a.b.c', 'a-b-c'), (' - a - b - c - ', 'a-b-c'), (' - ', ''),
('\u2020\u2066', ''), ('a \xa7 b \u2020 c', 'a-b-c'),
('1', ''), ('1abc', 'abc'),
- ]
+ ]
ids_unicode_all = [
('\u00f8 o with stroke', 'o-o-with-stroke'),
('\u0111 d with stroke', 'd-d-with-stroke'),
@@ -344,7 +345,7 @@ class MiscTests(unittest.TestCase):
('\u0131 dotless i', 'i-dotless-i'),
('\u0142 l with stroke', 'l-l-with-stroke'),
('\u0167 t with stroke', 't-t-with-stroke'),
- # From Latin Extended-B
+ # From Latin Extended-B
('\u0180 b with stroke', 'b-b-with-stroke'),
('\u0183 b with topbar', 'b-b-with-topbar'),
('\u0188 c with hook', 'c-c-with-hook'),
@@ -372,7 +373,7 @@ class MiscTests(unittest.TestCase):
('\u024b q with hook tail', 'q-q-with-hook-tail'),
('\u024d r with stroke', 'r-r-with-stroke'),
('\u024f y with stroke', 'y-y-with-stroke'),
- # From Latin-1 Supplements
+ # From Latin-1 Supplements
('\u00e0: a with grave', 'a-a-with-grave'),
('\u00e1 a with acute', 'a-a-with-acute'),
('\u00e2 a with circumflex', 'a-a-with-circumflex'),
@@ -400,7 +401,7 @@ class MiscTests(unittest.TestCase):
('\u00fc u with diaeresis', 'u-u-with-diaeresis'),
('\u00fd y with acute', 'y-y-with-acute'),
('\u00ff y with diaeresis', 'y-y-with-diaeresis'),
- # From Latin Extended-A
+ # From Latin Extended-A
('\u0101 a with macron', 'a-a-with-macron'),
('\u0103 a with breve', 'a-a-with-breve'),
('\u0105 a with ogonek', 'a-a-with-ogonek'),
@@ -456,7 +457,7 @@ class MiscTests(unittest.TestCase):
('\u017a z with acute', 'z-z-with-acute'),
('\u017c z with dot above', 'z-z-with-dot-above'),
('\u017e z with caron', 'z-z-with-caron'),
- # From Latin Extended-B
+ # From Latin Extended-B
('\u01a1 o with horn', 'o-o-with-horn'),
('\u01b0 u with horn', 'u-u-with-horn'),
('\u01c6 dz with caron', 'dz-dz-with-caron'),
@@ -493,7 +494,7 @@ class MiscTests(unittest.TestCase):
('\u0229 e with cedilla', 'e-e-with-cedilla'),
('\u022f o with dot above', 'o-o-with-dot-above'),
('\u0233 y with macron', 'y-y-with-macron'),
- # digraphs From Latin-1 Supplements
+ # digraphs From Latin-1 Supplements
('\u00df: ligature sz', 'sz-ligature-sz'),
('\u00e6 ae', 'ae-ae'),
('\u0153 ligature oe', 'oe-ligature-oe'),
@@ -520,31 +521,31 @@ class MiscTests(unittest.TestCase):
e += nodes.Element()
e += nodes.Element()
self.assertEqual(list(e.findall()),
- [e, e[0], e[0][0], e[0][1], e[0][1][0], e[1], e[2]])
+ [e, e[0], e[0][0], e[0][1], e[0][1][0], e[1], e[2]])
self.assertEqual(list(e.findall(include_self=False)),
- [e[0], e[0][0], e[0][1], e[0][1][0], e[1], e[2]])
+ [e[0], e[0][0], e[0][1], e[0][1][0], e[1], e[2]])
self.assertEqual(list(e.findall(descend=False)),
- [e])
+ [e])
self.assertEqual(list(e[0].findall(descend=False, ascend=True)),
- [e[0], e[1], e[2]])
+ [e[0], e[1], e[2]])
self.assertEqual(list(e[0][0].findall(descend=False, ascend=True)),
- [e[0][0], e[0][1], e[1], e[2]])
+ [e[0][0], e[0][1], e[1], e[2]])
self.assertEqual(list(e[0][0].findall(descend=False, siblings=True)),
- [e[0][0], e[0][1]])
+ [e[0][0], e[0][1]])
self.testlist = e[0:2]
self.assertEqual(list(e.findall(condition=self.not_in_testlist)),
- [e, e[0][0], e[0][1], e[0][1][0], e[2]])
+ [e, e[0][0], e[0][1], e[0][1][0], e[2]])
# Return siblings despite siblings=False because ascend is true.
self.assertEqual(list(e[1].findall(ascend=True, siblings=False)),
- [e[1], e[2]])
+ [e[1], e[2]])
self.assertEqual(list(e[0].findall()),
- [e[0], e[0][0], e[0][1], e[0][1][0]])
+ [e[0], e[0][0], e[0][1], e[0][1][0]])
self.testlist = [e[0][0], e[0][1]]
self.assertEqual(list(e[0].findall(condition=self.not_in_testlist)),
- [e[0], e[0][1][0]])
+ [e[0], e[0][1][0]])
self.testlist.append(e[0][1][0])
self.assertEqual(list(e[0].findall(condition=self.not_in_testlist)),
- [e[0]])
+ [e[0]])
self.assertEqual(list(e.findall(nodes.TextElement)), [e[0][1]])
def test_next_node(self):
@@ -565,7 +566,7 @@ class MiscTests(unittest.TestCase):
(e[2], None)]
for node, next_node in compare:
self.assertEqual(node.next_node(self.not_in_testlist, ascend=True),
- next_node)
+ next_node)
self.assertEqual(e[0][0].next_node(ascend=True), e[0][1])
self.assertEqual(e[2].next_node(), None)
@@ -645,7 +646,7 @@ class SetIdTests(unittest.TestCase):
nodes.section(), # Name empty
nodes.section(names=['Test']), # duplicate id
nodes.footnote(names=['2019-10-30']), # id empty
- ]
+ ]
def test_set_id_default(self):
# Default prefixes.
diff --git a/docutils/test/test_parsers/test_rst/test_directives/test_block_quotes.py b/docutils/test/test_parsers/test_rst/test_directives/test_block_quotes.py
index 6298c7d16..efc7e0508 100755
--- a/docutils/test/test_parsers/test_rst/test_directives/test_block_quotes.py
+++ b/docutils/test/test_parsers/test_rst/test_directives/test_block_quotes.py
@@ -61,9 +61,9 @@ generic_tests = [
totest = {}
for block_quote_type in ('epigraph', 'highlights', 'pull-quote'):
- totest[block_quote_type] = [
- [text % {'type': block_quote_type} for text in pair]
- for pair in generic_tests]
+ totest[block_quote_type] = [
+ [text % {'type': block_quote_type} for text in pair]
+ for pair in generic_tests]
if __name__ == '__main__':
diff --git a/docutils/test/test_publisher.py b/docutils/test/test_publisher.py
index 5d4a01969..f00fc7344 100755
--- a/docutils/test/test_publisher.py
+++ b/docutils/test/test_publisher.py
@@ -38,10 +38,11 @@ pseudoxml_output = b"""\
<paragraph>
Unknown target name: "nonexistent".
"""
-exposed_pseudoxml_output = (b"""\
-<document ids="test-document" internal:refnames="{"""
-+ u_prefix
-+ b"""\'nonexistent\': [<reference: <#text: \'nonexistent\'>>]}" names="test\\ document" source="<string>" title="Test Document">
+exposed_pseudoxml_output = (
+ b'<document ids="test-document" internal:refnames="{'
+ + u_prefix
+ + b"""\
+\'nonexistent\': [<reference: <#text: \'nonexistent\'>>]}" names="test\\ document" source="<string>" title="Test Document">
<title>
Test Document
<paragraph>
@@ -66,7 +67,7 @@ class PublisherTests(DocutilsTestSupport.StandardTestCase):
# pass IOErrors to calling application if `traceback` is True
try:
core.publish_cmdline(argv=['nonexisting/path'],
- settings_overrides={'traceback': True})
+ settings_overrides={'traceback': True})
except IOError as e:
self.assertTrue(isinstance(e, io.InputError))
@@ -75,7 +76,7 @@ class PublisherTests(DocutilsTestSupport.StandardTestCase):
# pass IOErrors to calling application if `traceback` is True
try:
core.publish_cmdline(argv=['data/include.txt', 'nonexisting/path'],
- settings_overrides={'traceback': True})
+ settings_overrides={'traceback': True})
except IOError as e:
self.assertTrue(isinstance(e, io.OutputError))
@@ -120,9 +121,9 @@ class PublishDoctreeTestCase(DocutilsTestSupport.StandardTestCase, docutils.Sett
# Test publishing parts using document as the source.
parts = core.publish_parts(
- reader_name='doctree', source_class=io.DocTreeInput,
- source=doctree, source_path='test', writer_name='html',
- settings_spec=self)
+ reader_name='doctree', source_class=io.DocTreeInput,
+ source=doctree, source_path='test', writer_name='html',
+ settings_spec=self)
self.assertTrue(isinstance(parts, dict))
def test_publish_pickle(self):
diff --git a/docutils/test/test_settings.py b/docutils/test/test_settings.py
index fff9025e7..17ec55930 100755
--- a/docutils/test/test_settings.py
+++ b/docutils/test/test_settings.py
@@ -40,7 +40,8 @@ class ConfigFileTests(unittest.TestCase):
'source_link': True,
'stylesheet': None,
'stylesheet_path': ['stylesheets/pep.css'],
- 'template': fixpath('data/pep-html-template')},
+ 'template': fixpath('data/pep-html-template'),
+ },
'one': {'datestamp': '%Y-%m-%d %H:%M UTC',
'generator': True,
'no_random': True,
@@ -55,14 +56,15 @@ class ConfigFileTests(unittest.TestCase):
'trim_footnote_reference_space': True,
'output_encoding': 'ascii',
'output_encoding_error_handler': 'xmlcharrefreplace',
- },
+ },
'two': {'footnote_references': 'superscript',
'generator': False,
'record_dependencies': utils.DependencyList(),
'stylesheet': None,
'stylesheet_path': ['test.css'],
'trim_footnote_reference_space': None,
- 'output_encoding_error_handler': 'namereplace'},
+ 'output_encoding_error_handler': 'namereplace',
+ },
'two_html5': {
# use defaults from html5_polyglot writer component
# ignore settings in [html4css1 writer] section,
@@ -77,7 +79,8 @@ class ConfigFileTests(unittest.TestCase):
'list': {'expose_internals': ['a', 'b', 'c', 'd', 'e'],
'strip_classes': ['spam', 'pan', 'fun', 'parrot'],
'strip_elements_with_classes': ['sugar', 'flour', 'milk',
- 'safran']},
+ 'safran']
+ },
'list2': {'expose_internals': ['a', 'b', 'c', 'd', 'e', 'f'],
'strip_classes': ['spam', 'pan', 'fun', 'parrot',
'ham', 'eggs'],
@@ -85,7 +88,7 @@ class ConfigFileTests(unittest.TestCase):
'safran', 'eggs', 'salt'],
'stylesheet': ['style2.css'],
'stylesheet_path': None,
- },
+ },
'error': {'error_encoding': 'ascii',
'error_encoding_error_handler': 'strict'},
'error2': {'error_encoding': 'latin1'},
diff --git a/docutils/test/test_statemachine.py b/docutils/test/test_statemachine.py
index 8c498d4dc..3532590a6 100755
--- a/docutils/test/test_statemachine.py
+++ b/docutils/test/test_statemachine.py
@@ -81,7 +81,7 @@ class MockState(statemachine.StateWS):
def bullet(self, match, context, next_state):
if self.debug: print('bullet%s' % self.level, file=sys.stderr)
context, next_state, result \
- = self.known_indent(match, context, next_state)
+ = self.known_indent(match, context, next_state)
return [], next_state, ['bullet%s' % self.level] + result
def text(self, match, context, next_state):
@@ -90,8 +90,8 @@ class MockState(statemachine.StateWS):
def literalblock(self):
indented, indent, offset, good = self.state_machine.get_indented()
- if self.debug: print('literalblock%s(%s)' % (self.level,
- indent), file=sys.stderr)
+ if self.debug: print('literalblock%s(%s)' % (self.level, indent),
+ file=sys.stderr)
return ['literalblock%s(%s)' % (self.level, indent)]
def eof(self, context):
@@ -125,9 +125,9 @@ class EmptySMTests(unittest.TestCase):
self.assertRaises(statemachine.UnknownStateError, self.sm.get_state,
'unknownState')
self.assertTrue(isinstance(self.sm.get_state('State'),
- statemachine.State))
+ statemachine.State))
self.assertTrue(isinstance(self.sm.get_state('StateWS'),
- statemachine.State))
+ statemachine.State))
self.assertEqual(self.sm.current_state, 'StateWS')
@@ -176,7 +176,7 @@ class SMWSTests(unittest.TestCase):
self.assertEqual(indent, lbindent)
self.assertEqual(indented, literalblock)
self.assertEqual(offset, (len(para1) + len(item1) + len(item2)
- - len(literalblock)))
+ - len(literalblock)))
self.assertTrue(good)
def test_get_text_block(self):
@@ -246,10 +246,10 @@ class EmptyStateTests(unittest.TestCase):
def test_make_transition(self):
dummy = re.compile('dummy')
self.assertEqual(self.state.make_transition('nop', 'bogus'),
- (dummy, self.state.nop, 'bogus'))
+ (dummy, self.state.nop, 'bogus'))
self.assertEqual(self.state.make_transition('nop'),
- (dummy, self.state.nop,
- self.state.__class__.__name__))
+ (dummy, self.state.nop,
+ self.state.__class__.__name__))
self.assertRaises(statemachine.TransitionPatternNotFound,
self.state.make_transition, 'None')
self.assertRaises(statemachine.TransitionMethodNotFound,
@@ -258,13 +258,13 @@ class EmptyStateTests(unittest.TestCase):
def test_make_transitions(self):
dummy = re.compile('dummy')
self.assertEqual(self.state.make_transitions(('nop', ['nop2'],
- ('nop3', 'bogus'))),
- (['nop', 'nop2', 'nop3'],
- {'nop': (dummy, self.state.nop,
+ ('nop3', 'bogus'))),
+ (['nop', 'nop2', 'nop3'],
+ {'nop': (dummy, self.state.nop,
+ self.state.__class__.__name__),
+ 'nop2': (dummy, self.state.nop2,
self.state.__class__.__name__),
- 'nop2': (dummy, self.state.nop2,
- self.state.__class__.__name__),
- 'nop3': (dummy, self.state.nop3, 'bogus')}))
+ 'nop3': (dummy, self.state.nop3, 'bogus')}))
class MiscTests(unittest.TestCase):
@@ -274,7 +274,7 @@ class MiscTests(unittest.TestCase):
" I'm fine thanks."]
def test_string2lines(self):
self.assertEqual(statemachine.string2lines(self.s2l_string),
- self.s2l_expected)
+ self.s2l_expected)
if __name__ == '__main__':
diff --git a/docutils/test/test_traversals.py b/docutils/test/test_traversals.py
index f21ef3591..45934364f 100755
--- a/docutils/test/test_traversals.py
+++ b/docutils/test/test_traversals.py
@@ -66,9 +66,9 @@ class StopTraversalTests(unittest.TestCase, docutils.SettingsSpec):
self.assertTrue(isinstance(doctree, nodes.document))
parts = docutils.core.publish_parts(
- reader_name='doctree', source_class=docutils.io.DocTreeInput,
- source=doctree, source_path='test',
- writer=AttentiveWriter())
+ reader_name='doctree', source_class=docutils.io.DocTreeInput,
+ source=doctree, source_path='test',
+ writer=AttentiveWriter())
if __name__ == '__main__':
diff --git a/docutils/test/test_utils.py b/docutils/test/test_utils.py
index 17304bbd6..31c4ec7a7 100755
--- a/docutils/test/test_utils.py
+++ b/docutils/test/test_utils.py
@@ -34,7 +34,7 @@ class ReporterTests(unittest.TestCase):
debug output
""")
self.assertEqual(self.stream.getvalue(),
- 'test data:: (DEBUG/0) debug output\n')
+ 'test data:: (DEBUG/0) debug output\n')
def test_level1(self):
sw = self.reporter.system_message(1, 'a little reminder')
@@ -53,7 +53,7 @@ class ReporterTests(unittest.TestCase):
a warning
""")
self.assertEqual(self.stream.getvalue(),
- 'test data:: (WARNING/2) a warning\n')
+ 'test data:: (WARNING/2) a warning\n')
def test_level3(self):
sw = self.reporter.system_message(3, 'an error')
@@ -63,13 +63,13 @@ class ReporterTests(unittest.TestCase):
an error
""")
self.assertEqual(self.stream.getvalue(),
- 'test data:: (ERROR/3) an error\n')
+ 'test data:: (ERROR/3) an error\n')
def test_level4(self):
self.assertRaises(utils.SystemMessage, self.reporter.system_message, 4,
'a severe error, raises an exception')
self.assertEqual(self.stream.getvalue(), 'test data:: (SEVERE/4) '
- 'a severe error, raises an exception\n')
+ 'a severe error, raises an exception\n')
def test_unicode_message(self):
@@ -166,8 +166,8 @@ class NameValueTests(unittest.TestCase):
output = utils.extract_name_value(
"""att1=val1 att2=val2 att3="value number '3'" att4=val4""")
self.assertEqual(output, [('att1', 'val1'), ('att2', 'val2'),
- ('att3', "value number '3'"),
- ('att4', 'val4')])
+ ('att3', "value number '3'"),
+ ('att4', 'val4')])
class ExtensionOptionTests(unittest.TestCase):
diff --git a/docutils/test/test_viewlist.py b/docutils/test/test_viewlist.py
index 90f5e8f06..3c70f3a7e 100755
--- a/docutils/test/test_viewlist.py
+++ b/docutils/test/test_viewlist.py
@@ -202,11 +202,11 @@ Unindented text.
def test_get_indented(self):
self.assertEqual(self.a.get_indented(),
- ([], 0, 0))
+ ([], 0, 0))
block = statemachine.StringList(
statemachine.string2lines(self.indented_string))
self.assertEqual(block.get_indented(),
- ([s[6:] for s in block], 6, 1))
+ ([s[6:] for s in block], 6, 1))
if __name__ == '__main__':
diff --git a/docutils/test/test_writers/test_docutils_xml.py b/docutils/test/test_writers/test_docutils_xml.py
index 524df6105..c6f8bb434 100755
--- a/docutils/test/test_writers/test_docutils_xml.py
+++ b/docutils/test/test_writers/test_docutils_xml.py
@@ -184,7 +184,8 @@ class DocutilsXMLTestCase(DocutilsTestSupport.StandardTestCase):
+ invalid_raw_xml).encode('latin1', 'xmlcharrefreplace')
self.assertEqual(result, expected)
warnings.seek(0)
- self.assertEqual(warnings.readlines(),
+ self.assertEqual(
+ warnings.readlines(),
['<string>:5: '
'(WARNING/2) Invalid raw XML in column 2, line offset 3:\n',
'<root>\n',
diff --git a/docutils/test/test_writers/test_html4css1_misc.py b/docutils/test/test_writers/test_html4css1_misc.py
index 69b1f2509..76e6a351d 100755
--- a/docutils/test/test_writers/test_html4css1_misc.py
+++ b/docutils/test/test_writers/test_html4css1_misc.py
@@ -10,7 +10,9 @@ Miscellaneous HTML writer tests.
import os
-from .__init__ import DocutilsTestSupport
+if __name__ == '__main__':
+ import __init__
+from test_writers import DocutilsTestSupport
from docutils import core
@@ -22,7 +24,8 @@ class EncodingTestCase(DocutilsTestSupport.StandardTestCase):
settings_overrides={
'output_encoding': 'latin1',
'stylesheet': '',
- '_disable_config': True,}
+ '_disable_config': True,
+ }
result = core.publish_string(
'EUR = \u20ac', writer_name='html4css1',
settings_overrides=settings_overrides)
@@ -32,10 +35,10 @@ class EncodingTestCase(DocutilsTestSupport.StandardTestCase):
class MovingArgsTestCase(DocutilsTestSupport.StandardTestCase):
- settings_overrides={'stylesheet_path': '',
- # 'embed_stylesheet': False,
- '_disable_config': True,
- }
+ mys = {'stylesheet_path': '',
+ # 'embed_stylesheet': False,
+ '_disable_config': True,
+ }
def test_definition_list_item_classes(self):
# Do not drop class arguments for the definition list item.
@@ -50,7 +53,7 @@ second term:
second def
"""
result = core.publish_string(data, writer_name='html4css1',
- settings_overrides=self.settings_overrides)
+ settings_overrides=self.mys)
self.assertIn(b'<dt class="for the second item">second term:</dt>',
result)
@@ -67,7 +70,7 @@ second term:
second def
"""
result = core.publish_string(data, writer_name='html4css1',
- settings_overrides=self.settings_overrides)
+ settings_overrides=self.mys)
self.assertIn(b'<dt id="second-item">second term:</dt>',
result)
@@ -77,61 +80,61 @@ class SettingsTestCase(DocutilsTestSupport.StandardTestCase):
def test_default_stylesheet(self):
# default style sheet, embedded
- mysettings = {'_disable_config': True,}
+ mys = {'_disable_config': True,}
styles = core.publish_parts(self.data, writer_name='html4css1',
- settings_overrides=mysettings)['stylesheet']
+ settings_overrides=mys)['stylesheet']
self.assertIn('Default cascading style sheet '
'for the HTML output of Docutils.', styles)
def test_default_stylesheet_linked(self):
# default style sheet, linked
- mysettings = {'_disable_config': True,
- 'embed_stylesheet': False}
+ mys = {'_disable_config': True,
+ 'embed_stylesheet': False}
styles = core.publish_parts(self.data, writer_name='html4css1',
- settings_overrides=mysettings)['stylesheet']
+ settings_overrides=mys)['stylesheet']
self.assertIn('docutils/writers/html4css1/html4css1.css', styles)
def test_math_stylesheet_linked(self):
# default + math style sheet, linked
- mysettings = {'_disable_config': True,
- 'embed_stylesheet': False,
- 'stylesheet_path': 'html4css1.css, math.css'}
+ mys = {'_disable_config': True,
+ 'embed_stylesheet': False,
+ 'stylesheet_path': 'html4css1.css, math.css'}
styles = core.publish_parts(self.data, writer_name='html4css1',
- settings_overrides=mysettings)['stylesheet']
+ settings_overrides=mys)['stylesheet']
self.assertIn('docutils/writers/html4css1/html4css1.css', styles)
self.assertIn('docutils/writers/html5_polyglot/math.css', styles)
def test_custom_stylesheet_linked(self):
# default + custom style sheet, linked
- mysettings = {'_disable_config': True,
- 'embed_stylesheet': False,
- 'stylesheet_path': 'html4css1.css, '
- 'data/ham.css'}
+ mys = {'_disable_config': True,
+ 'embed_stylesheet': False,
+ 'stylesheet_path': 'html4css1.css, '
+ 'data/ham.css'}
styles = core.publish_parts(self.data, writer_name='html4css1',
- settings_overrides=mysettings)['stylesheet']
+ settings_overrides=mys)['stylesheet']
self.assertIn('docutils/writers/html4css1/html4css1.css', styles)
self.assertIn('href="data/ham.css"', styles)
def test_custom_stylesheet_dir(self):
- mysettings = {'_disable_config': True,
- 'embed_stylesheet': False,
- 'stylesheet_dirs': ('../docutils/writers/html4css1/',
- 'data'),
- 'stylesheet_path': 'html4css1.css, ham.css'}
+ mys = {'_disable_config': True,
+ 'embed_stylesheet': False,
+ 'stylesheet_dirs': ('../docutils/writers/html4css1/',
+ 'data'),
+ 'stylesheet_path': 'html4css1.css, ham.css'}
styles = core.publish_parts(self.data, writer_name='html4css1',
- settings_overrides=mysettings)['stylesheet']
+ settings_overrides=mys)['stylesheet']
if os.path.isdir('../docutils/writers/html4css1/'):
self.assertIn('docutils/writers/html4css1/html4css1.css', styles)
self.assertIn('href="data/ham.css"', styles)
def test_custom_stylesheet_dir_embedded(self):
- mysettings = {'_disable_config': True,
- 'embed_stylesheet': True,
- 'stylesheet_dirs': ('../docutils/writers/html4css1/',
- 'data'),
- 'stylesheet_path': 'ham.css'}
+ mys = {'_disable_config': True,
+ 'embed_stylesheet': True,
+ 'stylesheet_dirs': ('../docutils/writers/html4css1/',
+ 'data'),
+ 'stylesheet_path': 'ham.css'}
styles = core.publish_parts(self.data, writer_name='html4css1',
- settings_overrides=mysettings)['stylesheet']
+ settings_overrides=mys)['stylesheet']
self.assertIn('dl.docutils dd {\n margin-bottom: 0.5em }', styles)
@@ -148,45 +151,45 @@ class MathTestCase(DocutilsTestSupport.StandardTestCase):
def test_math_output_default(self):
# HTML with math.css stylesheet (since 0.11)
- mysettings = {'_disable_config': True,}
+ mys = {'_disable_config': True,}
styles = core.publish_parts(self.data, writer_name='html4css1',
- settings_overrides=mysettings)['stylesheet']
+ settings_overrides=mys)['stylesheet']
self.assertIn('convert LaTeX equations to HTML output.', styles)
def test_math_output_mathjax(self):
# Explicitly specifying math_output=MathJax, case insensitively
# use default MathJax URL
- mysettings = {'_disable_config': True,
- 'report_level': 3,
- 'math_output': 'MathJax'}
+ mys = {'_disable_config': True,
+ 'report_level': 3,
+ 'math_output': 'MathJax'}
head = core.publish_parts(self.data, writer_name='html4css1',
- settings_overrides=mysettings)['head']
+ settings_overrides=mys)['head']
self.assertIn(self.mathjax_script % self.default_mathjax_url, head)
def test_math_output_mathjax_custom(self):
# Customizing MathJax URL
- mysettings = {'_disable_config': True,
- 'math_output':
- 'mathjax %s' % self.custom_mathjax_url}
+ mys = {'_disable_config': True,
+ 'math_output':
+ 'mathjax %s' % self.custom_mathjax_url}
head = core.publish_parts(self.data, writer_name='html4css1',
- settings_overrides=mysettings)['head']
+ settings_overrides=mys)['head']
self.assertIn(self.mathjax_script % self.custom_mathjax_url, head)
def test_math_output_html(self):
- mysettings = {'_disable_config': True,
- 'math_output': 'HTML'}
+ mys = {'_disable_config': True,
+ 'math_output': 'HTML'}
head = core.publish_parts(self.data, writer_name='html4css1',
- settings_overrides=mysettings)['head']
+ settings_overrides=mys)['head']
# There should be no MathJax script when math_output is not MathJax
self.assertNotIn('MathJax.js', head)
def test_math_output_html_stylesheet(self):
- mysettings = {'_disable_config': True,
- 'math_output': 'HTML math.css,custom/style.css',
- 'stylesheet_dirs': ('.', 'functional/input/data'),
- 'embed_stylesheet': False}
+ mys = {'_disable_config': True,
+ 'math_output': 'HTML math.css,custom/style.css',
+ 'stylesheet_dirs': ('.', 'functional/input/data'),
+ 'embed_stylesheet': False}
styles = core.publish_parts(self.data, writer_name='html4css1',
- settings_overrides=mysettings)['stylesheet']
+ settings_overrides=mys)['stylesheet']
self.assertEqual("""\
<link rel="stylesheet" href="functional/input/data/html4css1.css" type="text/css" />
<link rel="stylesheet" href="functional/input/data/math.css" type="text/css" />
@@ -194,8 +197,6 @@ class MathTestCase(DocutilsTestSupport.StandardTestCase):
""", styles)
def test_math_output_mathjax_no_math(self):
- mysettings = {'_disable_config': True,
- 'math_output': 'MathJax'}
# There should be no math script when text does not contain math
head = core.publish_parts('No math.', writer_name='html4css1')['head']
self.assertNotIn('MathJax', head)
diff --git a/docutils/test/test_writers/test_html4css1_template.py b/docutils/test/test_writers/test_html4css1_template.py
index 30fb1a169..6e91ad77b 100755
--- a/docutils/test/test_writers/test_html4css1_template.py
+++ b/docutils/test/test_writers/test_html4css1_template.py
@@ -240,7 +240,7 @@ html_body = """\
footer text
</div>"""
''' % {'version': DocutilsTestSupport.docutils.__version__,
- 'drive': drive_prefix,
+ 'drive': drive_prefix,
}]
]
diff --git a/docutils/test/test_writers/test_html5_polyglot_misc.py b/docutils/test/test_writers/test_html5_polyglot_misc.py
index 1c029743c..8bca18524 100644
--- a/docutils/test/test_writers/test_html5_polyglot_misc.py
+++ b/docutils/test/test_writers/test_html5_polyglot_misc.py
@@ -35,10 +35,10 @@ class EncodingTestCase(DocutilsTestSupport.StandardTestCase):
class MovingArgsTestCase(DocutilsTestSupport.StandardTestCase):
- settings_overrides={'stylesheet_path': '',
- # 'embed_stylesheet': False,
- '_disable_config': True,
- }
+ mys = {'stylesheet_path': '',
+ # 'embed_stylesheet': False,
+ '_disable_config': True,
+ }
def test_definition_list_item_classes(self):
# Do not drop class arguments for the definition list item.
@@ -53,7 +53,7 @@ second term:
second def
"""
result = core.publish_string(data, writer_name='html5_polyglot',
- settings_overrides=self.settings_overrides)
+ settings_overrides=self.mys)
self.assertIn(b'<dt class="for the second item">second term:</dt>',
result)
@@ -70,7 +70,7 @@ second term:
second def
"""
result = core.publish_string(data, writer_name='html5_polyglot',
- settings_overrides=self.settings_overrides)
+ settings_overrides=self.mys)
self.assertIn(b'<dt id="second-item">second term:</dt>',
result)
@@ -80,72 +80,72 @@ class SettingsTestCase(DocutilsTestSupport.StandardTestCase):
def test_default_stylesheet(self):
# default style sheet, embedded
- mysettings = {'_disable_config': True,}
+ mys = {'_disable_config': True,}
styles = core.publish_parts(self.data, writer_name='html5_polyglot',
- settings_overrides=mysettings)['stylesheet']
+ settings_overrides=mys)['stylesheet']
self.assertIn('Minimal style sheet '
'for the HTML output of Docutils.', styles)
def test_default_stylesheet_linked(self):
# default style sheet, linked
- mysettings = {'_disable_config': True,
- 'embed_stylesheet': False}
+ mys = {'_disable_config': True,
+ 'embed_stylesheet': False}
styles = core.publish_parts(self.data, writer_name='html5_polyglot',
- settings_overrides=mysettings)['stylesheet']
+ settings_overrides=mys)['stylesheet']
self.assertIn('docutils/writers/html5_polyglot/minimal.css', styles)
def test_math_stylesheet_linked(self):
# default + math style sheet, linked
- mysettings = {'_disable_config': True,
- 'embed_stylesheet': False,
- 'stylesheet_path': 'minimal.css, math.css'}
+ mys = {'_disable_config': True,
+ 'embed_stylesheet': False,
+ 'stylesheet_path': 'minimal.css, math.css'}
styles = core.publish_parts(self.data, writer_name='html5_polyglot',
- settings_overrides=mysettings)['stylesheet']
+ settings_overrides=mys)['stylesheet']
self.assertIn('docutils/writers/html5_polyglot/minimal.css', styles)
self.assertIn('docutils/writers/html5_polyglot/math.css', styles)
def test_custom_stylesheet_linked(self):
# default + custom style sheet, linked
- mysettings = {'_disable_config': True,
- 'embed_stylesheet': False,
- 'stylesheet_path': 'minimal.css, '
- 'data/ham.css'}
+ mys = {'_disable_config': True,
+ 'embed_stylesheet': False,
+ 'stylesheet_path': 'minimal.css, '
+ 'data/ham.css'}
styles = core.publish_parts(self.data, writer_name='html5_polyglot',
- settings_overrides=mysettings)['stylesheet']
+ settings_overrides=mys)['stylesheet']
self.assertIn('docutils/writers/html5_polyglot/minimal.css', styles)
self.assertIn('href="data/ham.css"', styles)
def test_custom_stylesheet_dir(self):
- mysettings = {'_disable_config': True,
- 'embed_stylesheet': False,
- 'stylesheet_dirs': ('../docutils/writers/html5_polyglot/',
- 'data'),
- 'stylesheet_path': 'minimal.css, ham.css'}
+ mys = {'_disable_config': True,
+ 'embed_stylesheet': False,
+ 'stylesheet_dirs': ('../docutils/writers/html5_polyglot/',
+ 'data'),
+ 'stylesheet_path': 'minimal.css, ham.css'}
styles = core.publish_parts(self.data, writer_name='html5_polyglot',
- settings_overrides=mysettings)['stylesheet']
+ settings_overrides=mys)['stylesheet']
if os.path.isdir('../docutils/writers/html5_polyglot/'):
self.assertIn('docutils/writers/html5_polyglot/minimal.css', styles)
self.assertIn('href="data/ham.css"', styles)
def test_custom_stylesheet_dir_embedded(self):
- mysettings = {'_disable_config': True,
- 'embed_stylesheet': True,
- 'stylesheet_dirs': ('../docutils/writers/html5_polyglot/',
- 'data'),
- 'stylesheet_path': 'ham.css'}
+ mys = {'_disable_config': True,
+ 'embed_stylesheet': True,
+ 'stylesheet_dirs': ('../docutils/writers/html5_polyglot/',
+ 'data'),
+ 'stylesheet_path': 'ham.css'}
styles = core.publish_parts(self.data, writer_name='html5_polyglot',
- settings_overrides=mysettings)['stylesheet']
+ settings_overrides=mys)['stylesheet']
self.assertIn('dl.docutils dd {\n margin-bottom: 0.5em }', styles)
def test_future_warnings(self):
"""Warn about changing defaults."""
- mysettings={'_disable_config': True,
- 'embed_images': False,
- }
+ mys={'_disable_config': True,
+ 'embed_images': False,
+ }
with warnings.catch_warnings(record=True) as wng:
warnings.simplefilter("always")
core.publish_string('warnings test', writer_name='html5',
- settings_overrides=mysettings)
+ settings_overrides=mys)
self.assertEqual(len(wng), 1, "Expected FutureWarning.")
assert issubclass(wng[0].category, FutureWarning)
@@ -163,45 +163,45 @@ class MathTestCase(DocutilsTestSupport.StandardTestCase):
def test_math_output_default(self):
# HTML with math.css stylesheet (since 0.11)
- mysettings = {'_disable_config': True,}
+ mys = {'_disable_config': True,}
styles = core.publish_parts(self.data, writer_name='html5_polyglot',
- settings_overrides=mysettings)['stylesheet']
+ settings_overrides=mys)['stylesheet']
self.assertIn('convert LaTeX equations to HTML output.', styles)
def test_math_output_mathjax(self):
# Explicitly specifying math_output=MathJax, case insensitively
# use default MathJax URL
- mysettings = {'_disable_config': True,
- 'report_level': 3,
- 'math_output': 'MathJax'}
+ mys = {'_disable_config': True,
+ 'report_level': 3,
+ 'math_output': 'MathJax'}
head = core.publish_parts(self.data, writer_name='html5_polyglot',
- settings_overrides=mysettings)['head']
+ settings_overrides=mys)['head']
self.assertIn(self.mathjax_script % self.default_mathjax_url, head)
def test_math_output_mathjax_custom(self):
# Customizing MathJax URL
- mysettings = {'_disable_config': True,
- 'math_output':
- 'mathjax %s' % self.custom_mathjax_url}
+ mys = {'_disable_config': True,
+ 'math_output':
+ 'mathjax %s' % self.custom_mathjax_url}
head = core.publish_parts(self.data, writer_name='html5_polyglot',
- settings_overrides=mysettings)['head']
+ settings_overrides=mys)['head']
self.assertIn(self.mathjax_script % self.custom_mathjax_url, head)
def test_math_output_html(self):
- mysettings = {'_disable_config': True,
- 'math_output': 'HTML'}
+ mys = {'_disable_config': True,
+ 'math_output': 'HTML'}
head = core.publish_parts(self.data, writer_name='html5_polyglot',
- settings_overrides=mysettings)['head']
+ settings_overrides=mys)['head']
# There should be no MathJax script when math_output is not MathJax
self.assertNotIn('MathJax.js', head)
def test_math_output_html_stylesheet(self):
- mysettings = {'_disable_config': True,
- 'math_output': 'HTML math.css,custom/style.css',
- 'stylesheet_dirs': ('.', 'functional/input/data'),
- 'embed_stylesheet': False}
+ mys = {'_disable_config': True,
+ 'math_output': 'HTML math.css,custom/style.css',
+ 'stylesheet_dirs': ('.', 'functional/input/data'),
+ 'embed_stylesheet': False}
styles = core.publish_parts(self.data, writer_name='html5_polyglot',
- settings_overrides=mysettings)['stylesheet']
+ settings_overrides=mys)['stylesheet']
self.assertEqual("""\
<link rel="stylesheet" href="functional/input/data/minimal.css" type="text/css" />
<link rel="stylesheet" href="functional/input/data/plain.css" type="text/css" />
@@ -210,8 +210,6 @@ class MathTestCase(DocutilsTestSupport.StandardTestCase):
""", styles)
def test_math_output_mathjax_no_math(self):
- mysettings = {'_disable_config': True,
- 'math_output': 'MathJax'}
# There should be no math script when text does not contain math
head = core.publish_parts('No math.', writer_name='html5_polyglot')['head']
self.assertNotIn('MathJax', head)
diff --git a/docutils/test/test_writers/test_html5_polyglot_parts.py b/docutils/test/test_writers/test_html5_polyglot_parts.py
index bbcbac59d..b36254a39 100644
--- a/docutils/test/test_writers/test_html5_polyglot_parts.py
+++ b/docutils/test/test_writers/test_html5_polyglot_parts.py
@@ -28,10 +28,10 @@ class Html5WriterPublishPartsTestCase(HtmlWriterPublishPartsTestCase):
settings_default_overrides['section_self_link'] = True
standard_content_type_template = '<meta charset="%s"/>\n'
- standard_generator_template = ('<meta name="generator"'
- ' content="Docutils %s: https://docutils.sourceforge.io/" />\n')
- standard_viewport_template = ('<meta name="viewport"'
- ' content="width=device-width, initial-scale=1" />\n')
+ standard_generator_template = '<meta name="generator"' \
+ ' content="Docutils %s: https://docutils.sourceforge.io/" />\n'
+ standard_viewport_template = '<meta name="viewport"' \
+ ' content="width=device-width, initial-scale=1" />\n'
standard_html_meta_value = (standard_content_type_template
+ standard_viewport_template
diff --git a/docutils/test/test_writers/test_latex2e.py b/docutils/test/test_writers/test_latex2e.py
index 75c852803..1277faf7e 100755
--- a/docutils/test/test_writers/test_latex2e.py
+++ b/docutils/test/test_writers/test_latex2e.py
@@ -16,10 +16,10 @@ from test_transforms import DocutilsTestSupport # before importing docutils!
def suite():
settings = {'use_latex_toc': False,
- # avoid latex writer future warnings:
- 'use_latex_citations': False,
- 'legacy_column_widths': True,
- }
+ # avoid latex writer future warnings:
+ 'use_latex_citations': False,
+ 'legacy_column_widths': True,
+ }
s = DocutilsTestSupport.PublishTestSuite('latex', suite_settings=settings)
s.generateTests(totest)
settings['use_latex_toc'] = True
@@ -112,14 +112,12 @@ head_booktabs = head_template.substitute(
+ '\\usepackage{booktabs}\n' + parts['longtable']))
head_textcomp = head_template.substitute(
- dict(parts, requirements = parts['requirements'] +
-r"""\usepackage{textcomp} % text symbol macros
-"""))
+ dict(parts, requirements=parts['requirements']
+ + '\\usepackage{textcomp} % text symbol macros\n'))
head_alltt = head_template.substitute(
- dict(parts, requirements = parts['requirements'] +
-r"""\usepackage{alltt}
-"""))
+ dict(parts, requirements = parts['requirements']
+ + '\\usepackage{alltt}\n'))
totest = {}
@@ -1054,8 +1052,7 @@ head_template.substitute(
\csname \DocutilsClassFunctionName \endcsname}%
{\csname end\DocutilsClassFunctionName \endcsname}%
\fi
-"""
- )
+""")
) + r"""
\begin{DUclass}{compound}
Compound paragraph
diff --git a/docutils/test/test_writers/test_latex2e_misc.py b/docutils/test/test_writers/test_latex2e_misc.py
index c4ce200b2..aff34cd4f 100644
--- a/docutils/test/test_writers/test_latex2e_misc.py
+++ b/docutils/test/test_writers/test_latex2e_misc.py
@@ -48,8 +48,8 @@ class TocTestCase(DocutilsTestSupport.StandardTestCase):
doctree = core.publish_doctree(contents_test_input,
settings_overrides=mysettings)
result = core.publish_from_doctree(doctree,
- writer_name='latex',
- settings_overrides=mysettings)
+ writer_name='latex',
+ settings_overrides=mysettings)
self.assertNotIn(r'\item \hyperref[foo]{foo}', result)
# self.assertIn(r'\tableofcontents', result)
diff --git a/docutils/test/test_writers/test_odt.py b/docutils/test/test_writers/test_odt.py
index 5484d98cd..0e263d2d2 100755
--- a/docutils/test/test_writers/test_odt.py
+++ b/docutils/test/test_writers/test_odt.py
@@ -51,7 +51,7 @@ EXPECTED_PATH = 'functional/expected/'
class DocutilsOdtTestCase(DocutilsTestSupport.StandardTestCase):
def process_test(self, input_filename, expected_filename,
- save_output_name=None, settings_overrides=None):
+ save_output_name=None, settings_overrides=None):
# Test that xmlcharrefreplace is the default output encoding
# error handler.
input_file = open(INPUT_PATH + input_filename, 'rb')
@@ -129,27 +129,22 @@ class DocutilsOdtTestCase(DocutilsTestSupport.StandardTestCase):
def test_odt_basic(self):
self.process_test('odt_basic.txt', 'odt_basic.odt',
- save_output_name='odt_basic.odt'
- )
+ save_output_name='odt_basic.odt')
def test_odt_nested_class(self):
self.process_test('odt_nested_class.txt',
'odt_nested_class.odt',
- save_output_name='odt_nested_class.odt'
- )
+ save_output_name='odt_nested_class.odt')
self.process_test('odt_unnested_class.txt',
'odt_unnested_class.odt',
- save_output_name='odt_unnested_class.odt'
- )
+ save_output_name='odt_unnested_class.odt')
self.process_test('odt_no_class.txt',
'odt_no_class.odt',
- save_output_name='odt_no_class.odt'
- )
+ save_output_name='odt_no_class.odt')
def test_odt_tables1(self):
self.process_test('odt_tables1.txt', 'odt_tables1.odt',
- save_output_name='odt_tables1.odt'
- )
+ save_output_name='odt_tables1.odt')
def test_odt_custom_headfoot(self):
settings_overrides = {
@@ -158,14 +153,12 @@ class DocutilsOdtTestCase(DocutilsTestSupport.StandardTestCase):
'language_code': 'en-US',
}
self.process_test('odt_custom_headfoot.txt', 'odt_custom_headfoot.odt',
- settings_overrides=settings_overrides,
- save_output_name='odt_custom_headfoot.odt'
- )
+ settings_overrides=settings_overrides,
+ save_output_name='odt_custom_headfoot.odt')
def test_odt_header_footer(self):
self.process_test('odt_header_footer.txt', 'odt_header_footer.odt',
- save_output_name='odt_header_footer.odt'
- )
+ save_output_name='odt_header_footer.odt')
def test_odt_literal_block(self):
self.process_test('odt_literal_block.txt', 'odt_literal_block.odt')
@@ -178,12 +171,10 @@ class DocutilsOdtTestCase(DocutilsTestSupport.StandardTestCase):
def test_odt_footnotes(self):
self.process_test('odt_footnotes.txt', 'odt_footnotes.odt',
- save_output_name='odt_footnotes.odt'
- )
+ save_output_name='odt_footnotes.odt')
def test_odt_raw(self):
self.process_test('odt_raw.txt', 'odt_raw.odt',
- save_output_name='odt_raw.odt'
- )
+ save_output_name='odt_raw.odt')
#
# Template for new tests.