Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test double escapes are skipped #2880

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
5 changes: 5 additions & 0 deletions codespell_lib/tests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ def test_basic(
with fname.open("w") as f: # overwrite the file
f.write("var = '\\nwe must check codespell likes escapes \\nin strings'\n")
assert cs.main(fname) == 0, "with string escape"
with fname.open("w") as f: # overwrite the file
f.write("var = '\\\\nwe must check codespell ignores double escapes \\\\nin strings'\n")
assert cs.main(fname) == 2, "with string escape"
# the four backslashes here become two on disk and one when output to a file,
# so these typos should be found
result = cs.main(fname, "--builtin", "foo", std=True)
assert isinstance(result, tuple)
code, _, stderr = result
Expand Down