diff --git a/typing_validation/validation_failure.py b/typing_validation/validation_failure.py index b1e4aa5..e44bb81 100644 --- a/typing_validation/validation_failure.py +++ b/typing_validation/validation_failure.py @@ -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]