Skip to content

Commit 34c85e0

Browse files
committed
Review feedback: use dedent in tests
1 parent b3de128 commit 34c85e0

File tree

1 file changed

+27
-21
lines changed

1 file changed

+27
-21
lines changed

tests/unit/test_req_dependency_group.py

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import errno
2+
import textwrap
23
from pathlib import Path
34
from typing import Any
45

@@ -13,10 +14,12 @@ def test_parse_simple_dependency_groups(
1314
) -> None:
1415
pyproject = tmp_path.joinpath("pyproject.toml")
1516
pyproject.write_text(
16-
"""\
17-
[dependency-groups]
18-
foo = ["bar"]
19-
"""
17+
textwrap.dedent(
18+
"""\
19+
[dependency-groups]
20+
foo = ["bar"]
21+
"""
22+
)
2023
)
2124
monkeypatch.chdir(tmp_path)
2225

@@ -31,11 +34,13 @@ def test_parse_cyclic_dependency_groups(
3134
) -> None:
3235
pyproject = tmp_path.joinpath("pyproject.toml")
3336
pyproject.write_text(
34-
"""\
35-
[dependency-groups]
36-
foo = [{include-group="bar"}]
37-
bar = [{include-group="foo"}]
38-
"""
37+
textwrap.dedent(
38+
"""\
39+
[dependency-groups]
40+
foo = [{include-group="bar"}]
41+
bar = [{include-group="foo"}]
42+
"""
43+
)
3944
)
4045
monkeypatch.chdir(tmp_path)
4146

@@ -54,10 +59,7 @@ def test_parse_with_no_dependency_groups_defined(
5459
tmp_path: Path, monkeypatch: pytest.MonkeyPatch
5560
) -> None:
5661
pyproject = tmp_path.joinpath("pyproject.toml")
57-
pyproject.write_text(
58-
"""\
59-
"""
60-
)
62+
pyproject.write_text("")
6163
monkeypatch.chdir(tmp_path)
6264

6365
with pytest.raises(
@@ -80,10 +82,12 @@ def test_parse_with_malformed_pyproject_file(
8082
) -> None:
8183
pyproject = tmp_path.joinpath("pyproject.toml")
8284
pyproject.write_text(
83-
"""\
84-
[dependency-groups # no closing bracket
85-
foo = ["bar"]
86-
"""
85+
textwrap.dedent(
86+
"""\
87+
[dependency-groups # no closing bracket
88+
foo = ["bar"]
89+
"""
90+
)
8791
)
8892
monkeypatch.chdir(tmp_path)
8993

@@ -96,10 +100,12 @@ def test_parse_gets_unexpected_oserror(
96100
) -> None:
97101
pyproject = tmp_path.joinpath("pyproject.toml")
98102
pyproject.write_text(
99-
"""\
100-
[dependency-groups]
101-
foo = ["bar"]
102-
"""
103+
textwrap.dedent(
104+
"""\
105+
[dependency-groups]
106+
foo = ["bar"]
107+
"""
108+
)
103109
)
104110
monkeypatch.chdir(tmp_path)
105111

0 commit comments

Comments
 (0)