|
1 | 1 | from __future__ import annotations |
2 | | -import pytest |
3 | | -from iniconfig import IniConfig, ParseError, __all__ as ALL |
4 | | -from iniconfig._parse import _ParsedLine as PL |
5 | | -from iniconfig import iscommentline |
6 | | -from textwrap import dedent |
| 2 | + |
7 | 3 | from pathlib import Path |
| 4 | +from textwrap import dedent |
8 | 5 |
|
| 6 | +import pytest |
| 7 | + |
| 8 | +from iniconfig import IniConfig |
| 9 | +from iniconfig import ParseError |
| 10 | +from iniconfig import __all__ as ALL |
| 11 | +from iniconfig import iscommentline |
| 12 | +from iniconfig._parse import _ParsedLine as PL |
9 | 13 |
|
10 | 14 | check_tokens: dict[str, tuple[str, list[PL]]] = { |
11 | 15 | "section": ("[section]", [PL(0, "section", None, None)]), |
|
44 | 48 |
|
45 | 49 | @pytest.fixture(params=sorted(check_tokens)) |
46 | 50 | def input_expected(request: pytest.FixtureRequest) -> tuple[str, list[PL]]: |
47 | | - |
48 | 51 | return check_tokens[request.param] |
49 | 52 |
|
50 | 53 |
|
@@ -214,12 +217,12 @@ def test_config_iter() -> None: |
214 | 217 | """ |
215 | 218 | ), |
216 | 219 | ) |
217 | | - l = list(config) |
218 | | - assert len(l) == 2 |
219 | | - assert l[0].name == "section1" |
220 | | - assert l[0]["value"] == "1" |
221 | | - assert l[1].name == "section2" |
222 | | - assert l[1]["value"] == "2" |
| 220 | + sections = list(config) |
| 221 | + assert len(sections) == 2 |
| 222 | + assert sections[0].name == "section1" |
| 223 | + assert sections[0]["value"] == "1" |
| 224 | + assert sections[1].name == "section2" |
| 225 | + assert sections[1]["value"] == "2" |
223 | 226 |
|
224 | 227 |
|
225 | 228 | def test_config_contains() -> None: |
@@ -251,8 +254,8 @@ def test_iter_file_order() -> None: |
251 | 254 | b = 2 |
252 | 255 | """, |
253 | 256 | ) |
254 | | - l = list(config) |
255 | | - secnames = [x.name for x in l] |
| 257 | + sections_list = list(config) |
| 258 | + secnames = [x.name for x in sections_list] |
256 | 259 | assert secnames == ["section2", "section"] |
257 | 260 | assert list(config["section2"]) == ["value", "value2"] |
258 | 261 | assert list(config["section"]) == ["a", "b"] |
|
0 commit comments