Skip to content

Commit

Permalink
chore: remove extraneous parentheses in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
epenet committed Nov 12, 2024
1 parent 39d2bba commit 01c3928
Show file tree
Hide file tree
Showing 14 changed files with 36 additions and 36 deletions.
8 changes: 4 additions & 4 deletions tests/integration/test_custom_comparator.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def generate_snapshots(testdir, testcases_initial):
@pytest.mark.xfail(strict=False)
def test_generated_snapshots(generate_snapshots):
result = generate_snapshots[0]
result.stdout.re_match_lines((r"1 snapshot generated\."))
result.stdout.re_match_lines(r"1 snapshot generated\.")
assert "snapshots unused" not in result.stdout.str()
assert result.ret == 0

Expand All @@ -66,7 +66,7 @@ def test_passed_custom(snapshot_custom):
"""
)
result = testdir.runpytest("-v", *plugin_args_fails_xdist)
result.stdout.re_match_lines((r"test_file.py::test_passed_custom PASSED"))
result.stdout.re_match_lines(r"test_file.py::test_passed_custom PASSED")
assert result.ret == 0


Expand All @@ -75,7 +75,7 @@ def test_failed_snapshots(generate_snapshots):
testdir = generate_snapshots[1]
testdir.makepyfile(test_file=generate_snapshots[2]["failed"])
result = testdir.runpytest("-v")
result.stdout.re_match_lines((r"1 snapshot failed\."))
result.stdout.re_match_lines(r"1 snapshot failed\.")
assert result.ret == 1


Expand All @@ -84,5 +84,5 @@ def test_updated_snapshots(generate_snapshots, plugin_args_fails_xdist):
_, testdir, initial = generate_snapshots
testdir.makepyfile(test_file=initial["failed"])
result = testdir.runpytest("-v", "--snapshot-update", *plugin_args_fails_xdist)
result.stdout.re_match_lines((r"1 snapshot updated\."))
result.stdout.re_match_lines(r"1 snapshot updated\.")
assert result.ret == 0
6 changes: 3 additions & 3 deletions tests/integration/test_pytest_extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def test_example(snapshot):
testdir.makeconftest(conftest)
testdir.makepyfile(test_file=testcase)
result = testdir.runpytest("test_file.py", "-v", "--snapshot-update", *plugin_args)
result.stdout.re_match_lines((r".*test_file.py::CUSTOM.*"))
result.stdout.re_match_lines(r".*test_file.py::CUSTOM.*")
assert result.ret == 0


Expand Down Expand Up @@ -63,13 +63,13 @@ def test_example(snapshot):
result = testdir.runpytest(
"-v", "test_file_no.py", "--snapshot-update", *plugin_args_fails_xdist
)
result.stdout.re_match_lines((r".*test_file_no.py.*"))
result.stdout.re_match_lines(r".*test_file_no.py.*")
assert "snapshot report" not in result.stdout.str()
assert "test_file_yes" not in result.stdout.str()
assert result.ret == 0

result = testdir.runpytest(
"-v", "test_file_yes.py", "--snapshot-update", *plugin_args_fails_xdist
)
result.stdout.re_match_lines((r".*test_file_yes.py.*", r".*snapshot report.*"))
result.stdout.re_match_lines(r".*test_file_yes.py.*", r".*snapshot report.*")
assert result.ret == 0
8 changes: 4 additions & 4 deletions tests/integration/test_single_file_multiple_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def test_dot_in_filename(snapshot):
test_file: Path = testdir.makepyfile(test_file=testcase)

result = testdir.runpytest("-v", "--snapshot-update", *plugin_args_fails_xdist)
result.stdout.re_match_lines((r"1 snapshot generated\."))
result.stdout.re_match_lines(r"1 snapshot generated\.")
assert "snapshots unused" not in result.stdout.str()
assert result.ret == 0

Expand All @@ -35,7 +35,7 @@ def test_dot_in_filename(snapshot):
assert snapshot_file.exists()

result = testdir.runpytest("-v", *plugin_args_fails_xdist)
result.stdout.re_match_lines((r"1 snapshot passed\."))
result.stdout.re_match_lines(r"1 snapshot passed\.")
assert "snapshots unused" not in result.stdout.str()
assert result.ret == 0

Expand All @@ -61,7 +61,7 @@ def test_foo(self, snapshot):
test_file: Path = testdir.makepyfile(test_file=testcase)

result = testdir.runpytest("-v", "--snapshot-update", *plugin_args_fails_xdist)
result.stdout.re_match_lines((r"1 snapshot generated\."))
result.stdout.re_match_lines(r"1 snapshot generated\.")
assert "deleted" not in result.stdout.str()
assert result.ret == 0

Expand All @@ -71,6 +71,6 @@ def test_foo(self, snapshot):
assert snapshot_file.exists()

result = testdir.runpytest("-v", *plugin_args_fails_xdist)
result.stdout.re_match_lines((r"1 snapshot passed\."))
result.stdout.re_match_lines(r"1 snapshot passed\.")
assert "snapshots unused" not in result.stdout.str()
assert result.ret == 0
2 changes: 1 addition & 1 deletion tests/integration/test_snapshot_option_extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def test_snapshot_default_extension_option_success(testfile):
"--snapshot-default-extension",
"syrupy.extensions.single_file.SingleFileSnapshotExtension",
)
result.stdout.re_match_lines((r"1 snapshot generated\."))
result.stdout.re_match_lines(r"1 snapshot generated\.")
assert Path(
testfile.tmpdir, "__snapshots__", "test_file", "test_default.raw"
).exists()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def test_snapshot_default_extension_option_success(testfile):
"--snapshot-default-extension",
"extension_file.MySingleFileExtension",
)
result.stdout.re_match_lines((r"1 snapshot generated\."))
result.stdout.re_match_lines(r"1 snapshot generated\.")
assert Path(
testfile.path, "__snapshots__", "test_file", "test_default.raw"
).exists()
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_snapshot_option_include_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def run_testfiles_with_update_impl(**testfiles):
}
)
result = testdir.runpytest("-v", "--snapshot-update")
result.stdout.re_match_lines((r"[0-9]+ snapshots generated\."))
result.stdout.re_match_lines(r"[0-9]+ snapshots generated\.")
return testdir

return run_testfiles_with_update_impl
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_snapshot_option_name.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def run_testcases(testdir, testcases):
"-v",
"--snapshot-update",
)
result.stdout.re_match_lines((r"2 snapshots generated\."))
result.stdout.re_match_lines(r"2 snapshots generated\.")
return testdir, testcases


Expand Down
14 changes: 7 additions & 7 deletions tests/integration/test_snapshot_option_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def run_testcases(testdir, testcases_initial):
sys.path.append(str(testdir.tmpdir))
testdir.makepyfile(**testcases_initial)
result = testdir.runpytest("-v", "--snapshot-update")
result.stdout.re_match_lines((r"10 snapshots generated."))
result.stdout.re_match_lines(r"10 snapshots generated.")
assert "Can not relate snapshot name" not in result.stdout.str()

return result, testdir, testcases_initial
Expand Down Expand Up @@ -189,7 +189,7 @@ def test_update_success_shows_snapshot_report(
testdir = run_testcases[1]
testdir.makepyfile(**testcases_updated)
result = testdir.runpytest("-v", "--snapshot-update", *plugin_args_fails_xdist)
result.stdout.re_match_lines((r"5 snapshots passed\. 5 snapshots updated\."))
result.stdout.re_match_lines(r"5 snapshots passed\. 5 snapshots updated\.")
assert result.ret == 0


Expand Down Expand Up @@ -242,7 +242,7 @@ def test_used(snapshot, actual):
result = testdir.runpytest(
"-v", "--snapshot-update", *plugin_args_fails_xdist, "-k", "test_used[2]"
)
result.stdout.re_match_lines((r"1 snapshot updated\."))
result.stdout.re_match_lines(r"1 snapshot updated\.")
assert "Deleted" not in result.stdout.str()
snapshot_path = [testdir.tmpdir, "__snapshots__"]
assert Path(*snapshot_path, "test_used.ambr").exists()
Expand Down Expand Up @@ -300,7 +300,7 @@ def test_case_2(self, snapshot):
result = testdir.runpytest(
"test_content.py", "-v", *plugin_args_fails_xdist, "-k", "test_case_2"
)
result.stdout.re_match_lines((r"1 snapshot passed\."))
result.stdout.re_match_lines(r"1 snapshot passed\.")
assert "snaphot unused" not in result.stdout.str()


Expand All @@ -324,7 +324,7 @@ def test_case_2(snapshot):
result = testdir.runpytest(
"test_content.py", "-v", *plugin_args_fails_xdist, "-k", "test_case_2"
)
result.stdout.re_match_lines((r"1 snapshot passed\."))
result.stdout.re_match_lines(r"1 snapshot passed\.")
assert "snaphot unused" not in result.stdout.str()


Expand All @@ -338,7 +338,7 @@ def test_update_targets_only_selected_module_tests_nodes(
result = testdir.runpytest(
"-v", f"{testfile}::test_used", "--snapshot-update", *plugin_args_fails_xdist
)
result.stdout.re_match_lines((r"3 snapshots passed\."))
result.stdout.re_match_lines(r"3 snapshots passed\.")
assert "unused" not in result.stdout.str()
assert "updated" not in result.stdout.str()
assert "deleted" not in result.stdout.str()
Expand All @@ -359,7 +359,7 @@ def test_update_targets_only_selected_module_tests_nodes_pyargs(
"--pyargs",
"test_used::test_used",
)
result.stdout.re_match_lines((r"3 snapshots passed\."))
result.stdout.re_match_lines(r"3 snapshots passed\.")
assert "unused" not in result.stdout.str()
assert "updated" not in result.stdout.str()
assert "deleted" not in result.stdout.str()
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_snapshot_option_warn_unused.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def run_testcases(testdir, testcases):
pyfile_content = "\n\n".join(testcases.values())
testdir.makepyfile(test_file=pyfile_content)
result = testdir.runpytest("-v", "--snapshot-update")
result.stdout.re_match_lines((r"2 snapshots generated\."))
result.stdout.re_match_lines(r"2 snapshots generated\.")
return testdir, testcases


Expand Down
4 changes: 2 additions & 2 deletions tests/integration/test_snapshot_outside_directory.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def generate_snapshots(testdir, testcases):

def test_generated_snapshots(generate_snapshots):
result = generate_snapshots[0]
result.stdout.re_match_lines((r"2 snapshots generated\."))
result.stdout.re_match_lines(r"2 snapshots generated\.")
assert "snapshots unused" not in result.stdout.str()
assert result.ret == 0

Expand All @@ -61,7 +61,7 @@ def test_unmatched_snapshots(generate_snapshots, plugin_args_fails_xdist):
_, testdir, testcases = generate_snapshots
testdir.makepyfile(test_file=testcases["one"])
result = testdir.runpytest("-v", *plugin_args_fails_xdist)
result.stdout.re_match_lines((r"1 snapshot passed. 1 snapshot unused\."))
result.stdout.re_match_lines(r"1 snapshot passed. 1 snapshot unused\.")
assert result.ret == 1


Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_snapshot_similar_names_default.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def run_testcases(testdir, testcases):
test_1=pyfile_content, test_2=pyfile_content, test_1_with_suffix=pyfile_content
)
result = testdir.runpytest("-v", "--snapshot-update")
result.stdout.re_match_lines((r"9 snapshots generated\."))
result.stdout.re_match_lines(r"9 snapshots generated\.")
return testdir, testcases


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def run_testcases(testdir, testcases):
"--snapshot-default-extension",
"syrupy.extensions.single_file.SingleFileSnapshotExtension",
)
result.stdout.re_match_lines((r"9 snapshots generated\."))
result.stdout.re_match_lines(r"9 snapshots generated\.")
return testdir, testcases


Expand Down
8 changes: 4 additions & 4 deletions tests/integration/test_snapshot_use_extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,13 @@ def test_unsaved_snapshots(testdir, testcases_initial):
def test_failed_snapshots(testdir, testcases_initial, plugin_args_fails_xdist):
testdir.makepyfile(test_file=testcases_initial["failed"])
result = testdir.runpytest("-v", "--snapshot-update", *plugin_args_fails_xdist)
result.stdout.re_match_lines((r"2 snapshots failed\."))
result.stdout.re_match_lines(r"2 snapshots failed\.")
assert result.ret == 1


def test_generated_snapshots(generate_snapshots):
result = generate_snapshots[0]
result.stdout.re_match_lines((r"4 snapshots generated\."))
result.stdout.re_match_lines(r"4 snapshots generated\.")
assert "snapshots unused" not in result.stdout.str()
assert result.ret == 0

Expand All @@ -124,7 +124,7 @@ def test_unmatched_snapshots(
testdir = generate_snapshots[1]
testdir.makepyfile(test_file=testcases_updated["passed"])
result = testdir.runpytest("-v", *plugin_args_fails_xdist)
result.stdout.re_match_lines((r"1 snapshot failed\. 2 snapshots unused\."))
result.stdout.re_match_lines(r"1 snapshot failed\. 2 snapshots unused\.")
assert result.ret == 1


Expand All @@ -134,7 +134,7 @@ def test_updated_snapshots(
testdir = generate_snapshots[1]
testdir.makepyfile(test_file=testcases_updated["passed"])
result = testdir.runpytest("-v", "--snapshot-update", *plugin_args_fails_xdist)
result.stdout.re_match_lines((r"1 snapshot updated\. 2 unused snapshots deleted\."))
result.stdout.re_match_lines(r"1 snapshot updated\. 2 unused snapshots deleted\.")
assert result.ret == 0


Expand Down
10 changes: 5 additions & 5 deletions tests/integration/test_xfail.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def test_a(snapshot):
)
)
result = testdir.runpytest("-v", *plugin_args)
result.stdout.no_re_match_line((r".*snapshot failed*"))
result.stdout.no_re_match_line(r".*snapshot failed*")
assert result.ret == 0


Expand All @@ -33,8 +33,8 @@ def test_b(snapshot):
)
)
result = testdir.runpytest("-v", *plugin_args_fails_xdist)
result.stdout.re_match_lines((r".*1 snapshot failed*"))
result.stdout.re_match_lines((r".*1 snapshot xfailed*"))
result.stdout.re_match_lines(r".*1 snapshot failed*")
result.stdout.re_match_lines(r".*1 snapshot xfailed*")
assert result.ret == 1


Expand All @@ -51,6 +51,6 @@ def test_a(snapshot):
)
)
result = testdir.runpytest("-v", *plugin_args_fails_xdist)
result.stdout.re_match_lines((r".*1 snapshot failed*"))
result.stdout.no_re_match_line((r".*1 snapshot xfailed*"))
result.stdout.re_match_lines(r".*1 snapshot failed*")
result.stdout.no_re_match_line(r".*1 snapshot xfailed*")
assert result.ret == 1

0 comments on commit 01c3928

Please sign in to comment.