Skip to content

Commit

Permalink
replace itertools.chain.from_iterable
Browse files Browse the repository at this point in the history
  • Loading branch information
blueyed committed Feb 15, 2020
1 parent 2e81042 commit 2ba59a1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions doc/en/example/assertion/failure_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ def test_eq_text(self):
assert "spam" == "eggs"

def test_eq_similar_text(self):
x = "foo\n1 bar\n"
assert x == "foo\n1 bar"
assert "foo 1 bar" == "foo 2 bar"

def test_eq_multiline_text(self):
assert "foo\nspam\nbar" == "foo\neggs\nbar"
Expand Down
2 changes: 1 addition & 1 deletion src/_pytest/assertion/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def _diff_text(left: str, right: str, verbose: int = 0) -> List[str]:

if any(
wcwidth(ch) <= 0
for ch in itertools.chain.from_iterable(x for x in left_lines + right_lines)
for ch in [ch for lines in left_lines + right_lines for ch in lines]
):
left_lines = [repr(x) for x in left_lines]
right_lines = [repr(x) for x in right_lines]
Expand Down

0 comments on commit 2ba59a1

Please sign in to comment.