Skip to content

Commit adb12d1

Browse files
committed
feat: removed cli option + test
1 parent 46f938b commit adb12d1

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

pytest_icdiff.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,6 @@ def pytest_addoption(parser):
5656
action="store_true",
5757
help="pytest-icdiff: strip any trailing carriage return at the end of an input line",
5858
)
59-
parser.addoption(
60-
"--icdiff-multiline-string",
61-
default=False,
62-
action="store_true",
63-
help="pytest-icdiff: proper differences for multiline strings",
64-
)
6559

6660

6761
def pytest_assertrepr_compare(config, op, left, right):
@@ -82,11 +76,7 @@ def pytest_assertrepr_compare(config, op, left, right):
8276
half_cols = COLS / 2 - MARGINS
8377
TABSIZE = int(config.getoption("--icdiff-tabsize") or 2)
8478

85-
if (
86-
config.getoption("--icdiff-multiline-string")
87-
and isinstance(left, str)
88-
and isinstance(right, str)
89-
):
79+
if isinstance(left, str) and isinstance(right, str):
9080
pretty_left = left.splitlines()
9181
pretty_right = right.splitlines()
9282
else:

tests/test_pytest_icdiff.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,19 @@ def test_one():
229229
assert comparison_line.count("hell") < 15
230230

231231

232+
def test_mutliline_strings_have_no_escaped_newlines(testdir):
233+
testdir.makepyfile(
234+
"""
235+
def test_one():
236+
one = "a\nb\nc\nd\ne\nf"
237+
two = "a\nb\nc\nd\ne\nf\ng"
238+
assert one == two"""
239+
)
240+
output = testdir.runpytest("-vv", "--color=yes").stdout.str()
241+
assert "\\n" not in output
242+
assert "\n" in output
243+
244+
232245
def test_columns_are_calculated_outside_hook(testdir):
233246
"""
234247
ok for some reason if you get the TerminalWriter width

0 commit comments

Comments
 (0)