[e988c2]: / tests / unit / utils / test_string_utils.py

Download this file

33 lines (27 with data), 691 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import pytest
from ehrql.utils.string_utils import strip_indent
@pytest.mark.parametrize(
"s,expected",
[
(
"Should\nbe\nuntouched",
"Should\nbe\nuntouched",
),
(
"""
Leading newline and indent should be stripped:
But nested indent retained
Like this.
""",
(
"Leading newline and indent should be stripped:\n"
"\n"
" But nested indent retained\n"
"\n"
"Like this."
),
),
],
)
def test_strip_indent(s, expected):
assert strip_indent(s) == expected