Skip to content

Commit 87a7aa9

Browse files
committed
tests: fix type annotation in test_pyproject
Fix failing mypy check by using correct type annotatation in tests. The `Container` ABC does not include `items()`. ``` tests/test_pyproject.py:48: error: "Container[Any]" has no attribute "items" [attr-defined] ``` Signed-off-by: Christian Heimes <cheimes@redhat.com>
1 parent fd77c23 commit 87a7aa9

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

tests/test_pyproject.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def test_pyproject_no_toml(
4444
fixer.run()
4545
with tmp_path.joinpath("pyproject.toml").open(encoding="utf-8") as f:
4646
doc = tomlkit.load(f)
47-
assert isinstance(doc["build-system"], typing.Container)
47+
assert isinstance(doc["build-system"], typing.Mapping)
4848
assert dict(doc["build-system"].items()) == {
4949
"requires": ["setuptools>=68.0.0"],
5050
}
@@ -70,7 +70,7 @@ def test_pyproject_with_toml(
7070
fixer.run()
7171
with tmp_path.joinpath("pyproject.toml").open(encoding="utf-8") as f:
7272
doc = tomlkit.load(f)
73-
assert isinstance(doc["build-system"], typing.Container)
73+
assert isinstance(doc["build-system"], typing.Mapping)
7474
assert dict(doc["build-system"].items()) == {
7575
"build-backend": "maturin",
7676
"requires": [
@@ -94,7 +94,7 @@ def test_pyproject_fix(
9494
pyproject.apply_project_override(testdata_context, req, tmp_path)
9595

9696
doc = tomlkit.loads(pyproject_toml.read_text())
97-
assert isinstance(doc["build-system"], typing.Container)
97+
assert isinstance(doc["build-system"], typing.Mapping)
9898
assert dict(doc["build-system"].items()) == {
9999
"requires": [
100100
"setuptools>=68.0.0",
@@ -130,7 +130,7 @@ def test_pyproject_preserve_multiple_requires(tmp_path: pathlib.Path) -> None:
130130
fixer.run()
131131
with tmp_path.joinpath("pyproject.toml").open(encoding="utf-8") as f:
132132
doc = tomlkit.load(f)
133-
assert isinstance(doc["build-system"], typing.Container)
133+
assert isinstance(doc["build-system"], typing.Mapping)
134134
# PyprojectFix parses requirements using packaging.requirements.Requirement and then casts
135135
# to str, this may change white spaces in markers, let's do it here as well
136136
assert dict(doc["build-system"].items())["requires"] == [
@@ -163,7 +163,7 @@ def test_pyproject_override_multiple_requires(tmp_path: pathlib.Path) -> None:
163163
fixer.run()
164164
with tmp_path.joinpath("pyproject.toml").open(encoding="utf-8") as f:
165165
doc = tomlkit.load(f)
166-
assert isinstance(doc["build-system"], typing.Container)
166+
assert isinstance(doc["build-system"], typing.Mapping)
167167
# PyprojectFix parses requirements using packaging.requirements.Requirement and then casts
168168
# to str, this may change white spaces in markers, let's do it here as well
169169
assert dict(doc["build-system"].items())["requires"] == [

0 commit comments

Comments
 (0)