Skip to content

Commit

Permalink
fixed a big with validation failure string line indentation (failed w…
Browse files Browse the repository at this point in the history
…hen object representations had newlines in them, e.g. numpy arrays)
  • Loading branch information
sg495 committed Jan 31, 2024
1 parent 8b18f58 commit 8a1920e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions typing_validation/validation_failure.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@


def _indent_lines(lines: Sequence[str], level: int = 1) -> list[str]:
"""Indent all given blocks of text (no newlines)."""
assert not any("\n" in line for line in lines)
"""Indent all given blocks of text."""
if any("\n" in line for line in lines):
lines = [l for line in lines for l in line.split("\n")]
ind = " " * 2 * level
return [ind + line for line in lines]

Expand Down

0 comments on commit 8a1920e

Please sign in to comment.