summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2021-10-10 08:01:25 -0400
committerNed Batchelder <ned@nedbatchelder.com>2021-10-10 08:01:25 -0400
commitb97aaf2bc2703ac55a3fc1e048729bea8434c18c (patch)
tree64ef7e083576334fbf099a35460f54b9c3acf4a5
parentb5ddfd9ad9978211006588934bc25e93d2ba8023 (diff)
downloadpython-coveragepy-git-b97aaf2bc2703ac55a3fc1e048729bea8434c18c.tar.gz
style: prefer explicit string concatenation
-rw-r--r--coverage/cmdline.py60
-rw-r--r--coverage/execfile.py5
-rw-r--r--coverage/parser.py2
-rw-r--r--tests/test_arcs.py44
-rw-r--r--tests/test_concurrency.py6
-rw-r--r--tests/test_config.py16
-rw-r--r--tests/test_data.py4
-rw-r--r--tests/test_files.py4
-rw-r--r--tests/test_numbits.py12
-rw-r--r--tests/test_oddball.py6
-rw-r--r--tests/test_parser.py2
-rw-r--r--tests/test_process.py31
-rw-r--r--tests/test_templite.py64
-rw-r--r--tests/test_testing.py17
14 files changed, 133 insertions, 140 deletions
diff --git a/coverage/cmdline.py b/coverage/cmdline.py
index eae22f2f..1be155b8 100644
--- a/coverage/cmdline.py
+++ b/coverage/cmdline.py
@@ -45,7 +45,7 @@ class Opts:
'', '--concurrency', action='store', metavar="LIB",
choices=CONCURRENCY_CHOICES,
help=(
- "Properly measure code using a concurrency library. "
+ "Properly measure code using a concurrency library. " +
"Valid values are: {}."
).format(", ".join(CONCURRENCY_CHOICES)),
)
@@ -77,20 +77,20 @@ class Opts:
'', '--include', action='store',
metavar="PAT1,PAT2,...",
help=(
- "Include only files whose paths match one of these patterns. "
+ "Include only files whose paths match one of these patterns. " +
"Accepts shell-style wildcards, which must be quoted."
),
)
pylib = optparse.make_option(
'-L', '--pylib', action='store_true',
help=(
- "Measure coverage even inside the Python installed library, "
+ "Measure coverage even inside the Python installed library, " +
"which isn't done by default."
),
)
sort = optparse.make_option(
'--sort', action='store', metavar='COLUMN',
- help="Sort the report by the named column: name, stmts, miss, branch, brpart, or cover. "
+ help="Sort the report by the named column: name, stmts, miss, branch, brpart, or cover. " +
"Default is name."
)
show_missing = optparse.make_option(
@@ -117,7 +117,7 @@ class Opts:
'', '--omit', action='store',
metavar="PAT1,PAT2,...",
help=(
- "Omit files whose paths match one of these patterns. "
+ "Omit files whose paths match one of these patterns. " +
"Accepts shell-style wildcards, which must be quoted."
),
)
@@ -125,7 +125,7 @@ class Opts:
'', '--contexts', action='store',
metavar="REGEX1,REGEX2,...",
help=(
- "Only display data from lines covered in the given contexts. "
+ "Only display data from lines covered in the given contexts. " +
"Accepts Python regexes, which must be quoted."
),
)
@@ -146,30 +146,30 @@ class Opts:
parallel_mode = optparse.make_option(
'-p', '--parallel-mode', action='store_true',
help=(
- "Append the machine name, process id and random number to the "
- ".coverage data file name to simplify collecting data from "
+ "Append the machine name, process id and random number to the " +
+ ".coverage data file name to simplify collecting data from " +
"many processes."
),
)
module = optparse.make_option(
'-m', '--module', action='store_true',
help=(
- "<pyfile> is an importable Python module, not a script path, "
+ "<pyfile> is an importable Python module, not a script path, " +
"to be run as 'python -m' would run it."
),
)
precision = optparse.make_option(
'', '--precision', action='store', metavar='N', type=int,
help=(
- "Number of digits after the decimal point to display for "
+ "Number of digits after the decimal point to display for " +
"reported coverage percentages."
),
)
rcfile = optparse.make_option(
'', '--rcfile', action='store',
help=(
- "Specify configuration file. "
- "By default '.coveragerc', 'setup.cfg', 'tox.ini', and "
+ "Specify configuration file. " +
+ "By default '.coveragerc', 'setup.cfg', 'tox.ini', and " +
"'pyproject.toml' are tried. [env: COVERAGE_RCFILE]"
),
)
@@ -180,7 +180,7 @@ class Opts:
timid = optparse.make_option(
'', '--timid', action='store_true',
help=(
- "Use a simpler but slower trace method. Try this if you get "
+ "Use a simpler but slower trace method. Try this if you get " +
"seemingly impossible results!"
),
)
@@ -328,7 +328,7 @@ CMDS = {
] + GLOBAL_ARGS,
usage="[options] [modules]",
description=(
- "Make annotated copies of the given files, marking statements that are executed "
+ "Make annotated copies of the given files, marking statements that are executed " +
"with > and statements that are missed with !."
),
),
@@ -341,11 +341,11 @@ CMDS = {
] + GLOBAL_ARGS,
usage="[options] <path1> <path2> ... <pathN>",
description=(
- "Combine data from multiple coverage files collected "
- "with 'run -p'. The combined results are written to a single "
- "file representing the union of the data. The positional "
- "arguments are data files or directories containing data files. "
- "If no paths are provided, data files in the default data file's "
+ "Combine data from multiple coverage files collected " +
+ "with 'run -p'. The combined results are written to a single " +
+ "file representing the union of the data. The positional " +
+ "arguments are data files or directories containing data files. " +
+ "If no paths are provided, data files in the default data file's " +
"directory are combined."
),
),
@@ -354,12 +354,12 @@ CMDS = {
"debug", GLOBAL_ARGS,
usage="<topic>",
description=(
- "Display information about the internals of coverage.py, "
- "for diagnosing problems. "
- "Topics are: "
- "'data' to show a summary of the collected data; "
- "'sys' to show installation information; "
- "'config' to show the configuration; "
+ "Display information about the internals of coverage.py, " +
+ "for diagnosing problems. " +
+ "Topics are: " +
+ "'data' to show a summary of the collected data; " +
+ "'sys' to show installation information; " +
+ "'config' to show the configuration; " +
"'premain' to show what is calling coverage."
),
),
@@ -393,8 +393,8 @@ CMDS = {
] + GLOBAL_ARGS,
usage="[options] [modules]",
description=(
- "Create an HTML report of the coverage of the files. "
- "Each file gets its own page, with the source decorated to show "
+ "Create an HTML report of the coverage of the files. " +
+ "Each file gets its own page, with the source decorated to show " +
"executed, excluded, and missed lines."
),
),
@@ -732,9 +732,9 @@ class CoverageScript:
# they will be None if they have not been specified.
if getattr(options, opt_name) is not None:
show_help(
- "Options affecting multiprocessing must only be specified "
- "in a configuration file.\n"
- "Remove --{} from the command line.".format(opt_name)
+ "Options affecting multiprocessing must only be specified " +
+ "in a configuration file.\n" +
+ f"Remove --{opt_name} from the command line."
)
return ERR
diff --git a/coverage/execfile.py b/coverage/execfile.py
index f46955bc..539e368d 100644
--- a/coverage/execfile.py
+++ b/coverage/execfile.py
@@ -52,9 +52,8 @@ def find_module(modulename):
spec = importlib.util.find_spec(mod_main)
if not spec:
raise NoSource(
- "No module named %s; "
- "%r is a package and cannot be directly executed"
- % (mod_main, modulename)
+ f"No module named {mod_main}; " +
+ f"{modulename!r} is a package and cannot be directly executed"
)
pathname = spec.origin
packagename = spec.name
diff --git a/coverage/parser.py b/coverage/parser.py
index 5c467a7e..3be822d5 100644
--- a/coverage/parser.py
+++ b/coverage/parser.py
@@ -367,7 +367,7 @@ class ByteParser:
for attr in ['co_lnotab', 'co_firstlineno']:
if not hasattr(self.code, attr):
raise StopEverything( # pragma: only jython
- "This implementation of Python doesn't support code analysis.\n"
+ "This implementation of Python doesn't support code analysis.\n" +
"Run coverage.py under another Python for this command."
)
diff --git a/tests/test_arcs.py b/tests/test_arcs.py
index 5b7965aa..6cdc908e 100644
--- a/tests/test_arcs.py
+++ b/tests/test_arcs.py
@@ -517,8 +517,8 @@ class LoopArcTest(CoverageTest):
branches_3([0,1])
""",
arcz=
- ".1 18 8G GH H. "
- ".2 23 34 43 26 3. 6. "
+ ".1 18 8G GH H. " +
+ ".2 23 34 43 26 3. 6. " +
"-89 9A 9-8 AB BC CB B9 AE E9",
arcz_missing="26 6."
)
@@ -1077,18 +1077,18 @@ class ExceptionArcTest(CoverageTest):
def test_except_jump_finally(self):
if env.PYBEHAVIOR.finally_jumps_back:
arcz = (
- ".1 1Q QR RS ST TU U. "
- ".2 23 34 45 56 4O 6L "
- "78 89 9A AL LA AO 8B BC CD DL LD D4 BE EF FG GL LG G. EH HI IJ JL HL "
- "L4 LM "
+ ".1 1Q QR RS ST TU U. " +
+ ".2 23 34 45 56 4O 6L " +
+ "78 89 9A AL LA AO 8B BC CD DL LD D4 BE EF FG GL LG G. EH HI IJ JL HL " +
+ "L4 LM " +
"MN NO O."
)
else:
arcz = (
- ".1 1Q QR RS ST TU U. "
- ".2 23 34 45 56 4O 6L "
- "78 89 9A AL 8B BC CD DL BE EF FG GL EH HI IJ JL HL "
- "LO L4 L. LM "
+ ".1 1Q QR RS ST TU U. " +
+ ".2 23 34 45 56 4O 6L " +
+ "78 89 9A AL 8B BC CD DL BE EF FG GL EH HI IJ JL HL " +
+ "LO L4 L. LM " +
"MN NO O."
)
self.check_coverage("""\
@@ -1131,18 +1131,18 @@ class ExceptionArcTest(CoverageTest):
def test_else_jump_finally(self):
if env.PYBEHAVIOR.finally_jumps_back:
arcz = (
- ".1 1S ST TU UV VW W. "
- ".2 23 34 45 56 6A 78 8N 4Q "
- "AB BC CN NC CQ AD DE EF FN NF F4 DG GH HI IN NI I. GJ JK KL LN JN "
- "N4 NO "
+ ".1 1S ST TU UV VW W. " +
+ ".2 23 34 45 56 6A 78 8N 4Q " +
+ "AB BC CN NC CQ AD DE EF FN NF F4 DG GH HI IN NI I. GJ JK KL LN JN " +
+ "N4 NO " +
"OP PQ Q."
)
else:
arcz = (
- ".1 1S ST TU UV VW W. "
- ".2 23 34 45 56 6A 78 8N 4Q "
- "AB BC CN AD DE EF FN DG GH HI IN GJ JK KL LN JN "
- "N4 NQ N. NO "
+ ".1 1S ST TU UV VW W. " +
+ ".2 23 34 45 56 6A 78 8N 4Q " +
+ "AB BC CN AD DE EF FN DG GH HI IN GJ JK KL LN JN " +
+ "N4 NQ N. NO " +
"OP PQ Q."
)
self.check_coverage("""\
@@ -1280,9 +1280,7 @@ class YieldTest(CoverageTest):
next(gen)
print(gen.send(6))
""",
- arcz=
- ".1 17 78 89 9A AB B. "
- ".2 23 34 45 52 2.",
+ arcz=".1 17 78 89 9A AB B. .2 23 34 45 52 2.",
arcz_missing="2.",
)
assert self.stdout() == "20\n12\n"
@@ -1850,8 +1848,8 @@ class AsyncTest(CoverageTest):
loop.close() # G
""",
arcz=
- ".1 13 38 8E EF FG G. "
- "-34 45 56 6-3 "
+ ".1 13 38 8E EF FG G. " +
+ "-34 45 56 6-3 " +
"-89 9C C-8",
arcz_unpredicted="5-3 9-8",
)
diff --git a/tests/test_concurrency.py b/tests/test_concurrency.py
index 0b8d6a8b..696b12eb 100644
--- a/tests/test_concurrency.py
+++ b/tests/test_concurrency.py
@@ -187,15 +187,13 @@ def cant_trace_msg(concurrency, the_module):
# We don't even have the underlying module installed, we expect
# coverage to alert us to this fact.
expected_out = (
- "Couldn't trace with concurrency=%s, "
- "the module isn't installed.\n" % concurrency
+ f"Couldn't trace with concurrency={concurrency}, the module isn't installed.\n"
)
elif env.C_TRACER or concurrency == "thread" or concurrency == "":
expected_out = None
else:
expected_out = (
- "Can't support concurrency=%s with PyTracer, "
- "only threads are supported\n" % concurrency
+ f"Can't support concurrency={concurrency} with PyTracer, only threads are supported\n"
)
return expected_out
diff --git a/tests/test_config.py b/tests/test_config.py
index 9e126827..aec18bf2 100644
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -169,14 +169,14 @@ class ConfigTest(CoverageTest):
("timid = 1\n", r"no section headers"),
("[run\n", r"\[run"),
("[report]\nexclude_lines = foo(\n",
- r"Invalid \[report\].exclude_lines value 'foo\(': "
+ r"Invalid \[report\].exclude_lines value 'foo\(': " +
r"(unbalanced parenthesis|missing \))"),
("[report]\npartial_branches = foo[\n",
- r"Invalid \[report\].partial_branches value 'foo\[': "
+ r"Invalid \[report\].partial_branches value 'foo\[': " +
r"(unexpected end of regular expression|unterminated character set)"),
("[report]\npartial_branches_always = foo***\n",
- r"Invalid \[report\].partial_branches_always value "
- r"'foo\*\*\*': "
+ r"Invalid \[report\].partial_branches_always value " +
+ r"'foo\*\*\*': " +
r"multiple repeat"),
]
@@ -190,14 +190,14 @@ class ConfigTest(CoverageTest):
("[tool.coverage.run]\ntimid = \"maybe?\"\n", r"maybe[?]"),
("[tool.coverage.run\n", None),
('[tool.coverage.report]\nexclude_lines = ["foo("]\n',
- r"Invalid \[tool.coverage.report\].exclude_lines value u?'foo\(': "
+ r"Invalid \[tool.coverage.report\].exclude_lines value u?'foo\(': " +
r"(unbalanced parenthesis|missing \))"),
('[tool.coverage.report]\npartial_branches = ["foo["]\n',
- r"Invalid \[tool.coverage.report\].partial_branches value u?'foo\[': "
+ r"Invalid \[tool.coverage.report\].partial_branches value u?'foo\[': " +
r"(unexpected end of regular expression|unterminated character set)"),
('[tool.coverage.report]\npartial_branches_always = ["foo***"]\n',
- r"Invalid \[tool.coverage.report\].partial_branches_always value "
- r"u?'foo\*\*\*': "
+ r"Invalid \[tool.coverage.report\].partial_branches_always value " +
+ r"u?'foo\*\*\*': " +
r"multiple repeat"),
('[tool.coverage.run]\nconcurrency="foo"', "not a list"),
("[tool.coverage.report]\nprecision=1.23", "not an integer"),
diff --git a/tests/test_data.py b/tests/test_data.py
index 80cd9bc2..134eb55a 100644
--- a/tests/test_data.py
+++ b/tests/test_data.py
@@ -616,8 +616,8 @@ class CoverageDataFilesTest(DataTestHelpers, CoverageTest):
self.assert_line_counts(covdata2, SUMMARY_1)
assert re.search(
- r"^Erasing data file '.*\.coverage'\n"
- r"Creating data file '.*\.coverage'\n"
+ r"^Erasing data file '.*\.coverage'\n" +
+ r"Creating data file '.*\.coverage'\n" +
r"Opening data file '.*\.coverage'\n$",
debug.get_output()
)
diff --git a/tests/test_files.py b/tests/test_files.py
index d6005d36..e5dd83bd 100644
--- a/tests/test_files.py
+++ b/tests/test_files.py
@@ -93,8 +93,8 @@ def test_flat_rootname(original, flat):
@pytest.mark.parametrize(
- "patterns, case_insensitive, partial,"
- "matches,"
+ "patterns, case_insensitive, partial," +
+ "matches," +
"nomatches",
[
(
diff --git a/tests/test_numbits.py b/tests/test_numbits.py
index 3f69b4de..f7032de7 100644
--- a/tests/test_numbits.py
+++ b/tests/test_numbits.py
@@ -115,9 +115,9 @@ class NumbitsSqliteFunctionTest(CoverageTest):
def test_numbits_union(self):
res = self.cursor.execute(
- "select numbits_union("
- "(select numbits from data where id = 7),"
- "(select numbits from data where id = 9)"
+ "select numbits_union(" +
+ "(select numbits from data where id = 7)," +
+ "(select numbits from data where id = 9)" +
")"
)
expected = [
@@ -129,9 +129,9 @@ class NumbitsSqliteFunctionTest(CoverageTest):
def test_numbits_intersection(self):
res = self.cursor.execute(
- "select numbits_intersection("
- "(select numbits from data where id = 7),"
- "(select numbits from data where id = 9)"
+ "select numbits_intersection(" +
+ "(select numbits from data where id = 7)," +
+ "(select numbits from data where id = 9)" +
")"
)
answer = numbits_to_nums(list(res)[0][0])
diff --git a/tests/test_oddball.py b/tests/test_oddball.py
index a97fc190..c3082abb 100644
--- a/tests/test_oddball.py
+++ b/tests/test_oddball.py
@@ -484,9 +484,9 @@ class GettraceTest(CoverageTest):
out = self.stdout().replace(self.last_module_name, "coverage_test")
expected = (
- "call: coverage_test.py @ 12\n"
- "line: coverage_test.py @ 13\n"
- "line: coverage_test.py @ 14\n"
+ "call: coverage_test.py @ 12\n" +
+ "line: coverage_test.py @ 13\n" +
+ "line: coverage_test.py @ 14\n" +
"return: coverage_test.py @ 14\n"
)
assert expected == out
diff --git a/tests/test_parser.py b/tests/test_parser.py
index 1b4e8aca..82bf7616 100644
--- a/tests/test_parser.py
+++ b/tests/test_parser.py
@@ -120,7 +120,7 @@ class PythonParserTest(CoverageTest):
def test_indentation_error(self):
msg = (
- "Couldn't parse '<code>' as Python source: "
+ "Couldn't parse '<code>' as Python source: " +
"'unindent does not match any outer indentation level' at line 3"
)
with pytest.raises(NotPython, match=msg):
diff --git a/tests/test_process.py b/tests/test_process.py
index c41c57b7..1adb6cff 100644
--- a/tests/test_process.py
+++ b/tests/test_process.py
@@ -130,7 +130,7 @@ class ProcessTest(CoverageTest):
self.assert_exists(".coverage")
self.assert_exists(".coverage.bad")
warning_regex = (
- r"CoverageWarning: Couldn't use data file '.*\.coverage\.bad': "
+ r"CoverageWarning: Couldn't use data file '.*\.coverage\.bad': " +
r"file (is encrypted or )?is not a database"
)
assert re.search(warning_regex, out)
@@ -163,9 +163,8 @@ class ProcessTest(CoverageTest):
for n in "12":
self.assert_exists(f".coverage.bad{n}")
warning_regex = (
- r"CoverageWarning: Couldn't use data file '.*\.coverage.bad{}': "
+ fr"CoverageWarning: Couldn't use data file '.*\.coverage.bad{n}': " +
r"file (is encrypted or )?is not a database"
- .format(n)
)
assert re.search(warning_regex, out)
assert re.search(r"No usable data files", out)
@@ -725,9 +724,9 @@ class ProcessTest(CoverageTest):
assert "Goodbye!" in out
msg = (
- "CoverageWarning: "
- "Already imported a file that will be measured: {} "
- "(already-imported)").format(goodbye_path)
+ f"CoverageWarning: Already imported a file that will be measured: {goodbye_path} " +
+ "(already-imported)"
+ )
assert msg in out
@pytest.mark.expensive
@@ -1313,10 +1312,10 @@ class UnicodeFilePathsTest(CoverageTest):
assert ' name="h\xe2t.py"'.encode() in xml
report_expected = (
- "Name Stmts Miss Cover\n"
- "----------------------------\n"
- "h\xe2t.py 1 0 100%\n"
- "----------------------------\n"
+ "Name Stmts Miss Cover\n" +
+ "----------------------------\n" +
+ "h\xe2t.py 1 0 100%\n" +
+ "----------------------------\n" +
"TOTAL 1 0 100%\n"
)
@@ -1357,12 +1356,12 @@ class UnicodeFilePathsTest(CoverageTest):
}
report_expected = (
- "Name Stmts Miss Cover\n"
- "-----------------------------------\n"
- "\xe2%saccented.py 1 0 100%%\n"
- "-----------------------------------\n"
- "TOTAL 1 0 100%%\n"
- ) % os.sep
+ "Name Stmts Miss Cover\n" +
+ "-----------------------------------\n" +
+ f"\xe2{os.sep}accented.py 1 0 100%\n" +
+ "-----------------------------------\n" +
+ "TOTAL 1 0 100%\n"
+ )
out = self.run_command("coverage report")
assert out == report_expected
diff --git a/tests/test_templite.py b/tests/test_templite.py
index e4d83647..0f86690b 100644
--- a/tests/test_templite.py
+++ b/tests/test_templite.py
@@ -148,7 +148,7 @@ class TempliteTest(CoverageTest):
def test_multiple_loops(self):
self.try_render(
- "{% for n in nums %}{{n}}{% endfor %} and "
+ "{% for n in nums %}{{n}}{% endfor %} and " +
"{% for n in nums %}{{n}}{% endfor %}",
{'nums': [1,2,3]},
"123 and 123"
@@ -201,10 +201,10 @@ class TempliteTest(CoverageTest):
return self.it
obj = Complex(it={'x':"Hello", 'y': 0})
self.try_render(
- "@"
- "{% if obj.getit.x %}X{% endif %}"
- "{% if obj.getit.y %}Y{% endif %}"
- "{% if obj.getit.y|str %}S{% endif %}"
+ "@" +
+ "{% if obj.getit.x %}X{% endif %}" +
+ "{% if obj.getit.y %}Y{% endif %}" +
+ "{% if obj.getit.y|str %}S{% endif %}" +
"!",
{ 'obj': obj, 'str': str },
"@XS!"
@@ -229,10 +229,10 @@ class TempliteTest(CoverageTest):
def test_nested_loops(self):
self.try_render(
- "@"
- "{% for n in nums %}"
- "{% for a in abc %}{{a}}{{n}}{% endfor %}"
- "{% endfor %}"
+ "@" +
+ "{% for n in nums %}" +
+ "{% for a in abc %}{{a}}{{n}}{% endfor %}" +
+ "{% endfor %}" +
"!",
{'nums': [0,1,2], 'abc': ['a', 'b', 'c']},
"@a0b0c0a1b1c1a2b2c2!"
@@ -240,28 +240,28 @@ class TempliteTest(CoverageTest):
def test_whitespace_handling(self):
self.try_render(
- "@{% for n in nums %}\n"
- " {% for a in abc %}{{a}}{{n}}{% endfor %}\n"
+ "@{% for n in nums %}\n" +
+ " {% for a in abc %}{{a}}{{n}}{% endfor %}\n" +
"{% endfor %}!\n",
{'nums': [0, 1, 2], 'abc': ['a', 'b', 'c']},
"@\n a0b0c0\n\n a1b1c1\n\n a2b2c2\n!\n"
)
self.try_render(
- "@{% for n in nums -%}\n"
- " {% for a in abc -%}\n"
- " {# this disappears completely -#}\n"
- " {{a-}}\n"
- " {{n -}}\n"
- " {{n -}}\n"
- " {% endfor %}\n"
+ "@{% for n in nums -%}\n" +
+ " {% for a in abc -%}\n" +
+ " {# this disappears completely -#}\n" +
+ " {{a-}}\n" +
+ " {{n -}}\n" +
+ " {{n -}}\n" +
+ " {% endfor %}\n" +
"{% endfor %}!\n",
{'nums': [0, 1, 2], 'abc': ['a', 'b', 'c']},
"@a00b00c00\na11b11c11\na22b22c22\n!\n"
)
self.try_render(
- "@{% for n in nums -%}\n"
- " {{n -}}\n"
- " x\n"
+ "@{% for n in nums -%}\n" +
+ " {{n -}}\n" +
+ " x\n" +
"{% endfor %}!\n",
{'nums': [0, 1, 2]},
"@0x\n1x\n2x\n!\n"
@@ -270,17 +270,17 @@ class TempliteTest(CoverageTest):
def test_eat_whitespace(self):
self.try_render(
- "Hey!\n"
- "{% joined %}\n"
- "@{% for n in nums %}\n"
- " {% for a in abc %}\n"
- " {# this disappears completely #}\n"
- " X\n"
- " Y\n"
- " {{a}}\n"
- " {{n }}\n"
- " {% endfor %}\n"
- "{% endfor %}!\n"
+ "Hey!\n" +
+ "{% joined %}\n" +
+ "@{% for n in nums %}\n" +
+ " {% for a in abc %}\n" +
+ " {# this disappears completely #}\n" +
+ " X\n" +
+ " Y\n" +
+ " {{a}}\n" +
+ " {{n }}\n" +
+ " {% endfor %}\n" +
+ "{% endfor %}!\n" +
"{% endjoined %}\n",
{'nums': [0, 1, 2], 'abc': ['a', 'b', 'c']},
"Hey!\n@XYa0XYb0XYc0XYa1XYb1XYc1XYa2XYb2XYc2!\n"
diff --git a/tests/test_testing.py b/tests/test_testing.py
index 4699799e..eae18890 100644
--- a/tests/test_testing.py
+++ b/tests/test_testing.py
@@ -61,20 +61,19 @@ class CoverageTestTest(CoverageTest):
self.assert_file_count("afile.*", 1)
self.assert_file_count("*.q", 0)
msg = re.escape(
- "There should be 13 files matching 'a*.txt', but there are these: "
+ "There should be 13 files matching 'a*.txt', but there are these: " +
"['abcde.txt', 'afile.txt', 'axczz.txt']"
)
with pytest.raises(AssertionError, match=msg):
self.assert_file_count("a*.txt", 13)
msg = re.escape(
- "There should be 12 files matching '*c*.txt', but there are these: "
+ "There should be 12 files matching '*c*.txt', but there are these: " +
"['abcde.txt', 'axczz.txt']"
)
with pytest.raises(AssertionError, match=msg):
self.assert_file_count("*c*.txt", 12)
msg = re.escape(
- "There should be 11 files matching 'afile.*', but there are these: "
- "['afile.txt']"
+ "There should be 11 files matching 'afile.*', but there are these: ['afile.txt']"
)
with pytest.raises(AssertionError, match=msg):
self.assert_file_count("afile.*", 11)
@@ -374,11 +373,11 @@ class ArczTest(CoverageTest):
([(-1, 1), (1, 2), (2, -5)], "(-1, 1) # .1\n(1, 2) # 12\n(2, -5) # 2-5\n"),
([(-26, 10), (12, 11), (18, 29), (35, -10), (1, 33), (100, 7)],
(
- "(-26, 10) # -QA\n"
- "(12, 11) # CB\n"
- "(18, 29) # IT\n"
- "(35, -10) # Z-A\n"
- "(1, 33) # 1X\n"
+ "(-26, 10) # -QA\n" +
+ "(12, 11) # CB\n" +
+ "(18, 29) # IT\n" +
+ "(35, -10) # Z-A\n" +
+ "(1, 33) # 1X\n" +
"(100, 7) # ?7\n"
)
),