Skip to content

Commit 4144f95

Browse files
committed
refactor: simplify some strange string formatting
1 parent 6c5ef77 commit 4144f95

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

tests/test_data.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ def test_read_write_arcs(self):
584584
assert_arcs3_data(covdata2)
585585

586586
def test_read_errors(self):
587-
msg = r"Couldn't .* '.*[/\\]{0}': \S+"
587+
msg = r"Couldn't .* '.*[/\\]{}': \S+"
588588

589589
self.make_file("xyzzy.dat", "xyzzy")
590590
with pytest.raises(CoverageException, match=msg.format("xyzzy.dat")):
@@ -602,15 +602,15 @@ def test_read_sql_errors(self):
602602
with sqlite3.connect("wrong_schema.db") as con:
603603
con.execute("create table coverage_schema (version integer)")
604604
con.execute("insert into coverage_schema (version) values (99)")
605-
msg = r"Couldn't .* '.*[/\\]{}': wrong schema: 99 instead of \d+".format("wrong_schema.db")
605+
msg = r"Couldn't .* '.*[/\\]wrong_schema.db': wrong schema: 99 instead of \d+"
606606
with pytest.raises(CoverageException, match=msg):
607607
covdata = DebugCoverageData("wrong_schema.db")
608608
covdata.read()
609609
assert not covdata
610610

611611
with sqlite3.connect("no_schema.db") as con:
612612
con.execute("create table foobar (baz text)")
613-
msg = r"Couldn't .* '.*[/\\]{}': \S+".format("no_schema.db")
613+
msg = r"Couldn't .* '.*[/\\]no_schema.db': \S+"
614614
with pytest.raises(CoverageException, match=msg):
615615
covdata = DebugCoverageData("no_schema.db")
616616
covdata.read()

tests/test_process.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1654,9 +1654,9 @@ def run_in_venv(cmd):
16541654
"""
16551655
words = cmd.split()
16561656
if env.WINDOWS:
1657-
words[0] = r"{}\Scripts\{}.exe".format("venv", words[0])
1657+
words[0] = fr"venv\Scripts\{words[0]}.exe"
16581658
else:
1659-
words[0] = "{}/bin/{}".format("venv", words[0])
1659+
words[0] = fr"venv/bin/{words[0]}"
16601660
status, output = run_command(" ".join(words))
16611661
assert status == 0
16621662
return output

0 commit comments

Comments
 (0)