Skip to content

Commit 483734f

Browse files
authored
Merge pull request #135 from altendky/mypy_for_tests
2 parents 6c61585 + d4dd768 commit 483734f

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

tests/cases/forward_reference.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,20 @@
1313

1414

1515
for module in [dataclasses, attr]:
16+
# Type ignores are just here for now instead of figuring out how to
17+
# handle these properly.
1618

17-
@module.dataclass
19+
@module.dataclass # type: ignore[attr-defined]
1820
class A:
1921
x: "B"
2022

21-
@module.dataclass
23+
@module.dataclass # type: ignore[attr-defined]
2224
class B:
2325
y: int
2426

2527
schema = desert.schema_class(A)()
2628
dumped = {"x": {"y": 1}}
27-
loaded = A((B(1)))
29+
loaded = A((B(1))) # type:ignore[call-arg]
2830

2931
assert schema.load(dumped) == loaded
3032
assert schema.dump(loaded) == dumped

tests/test_make.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,33 +42,33 @@ def dataclass_param(request):
4242

4343

4444
def _assert_load(
45-
schema: t.Type[marshmallow.Schema], loaded: t.Any, dumped: t.Dict[t.Any, t.Any]
45+
schema: marshmallow.Schema, loaded: t.Any, dumped: t.Dict[t.Any, t.Any]
4646
) -> None:
4747
assert schema.load(dumped) == loaded
4848

4949

5050
def _assert_dump(
51-
schema: t.Type[marshmallow.Schema], loaded: t.Any, dumped: t.Dict[t.Any, t.Any]
51+
schema: marshmallow.Schema, loaded: t.Any, dumped: t.Dict[t.Any, t.Any]
5252
) -> None:
5353
assert schema.dump(loaded) == dumped
5454

5555

5656
def _assert_dump_load(
57-
schema: t.Type[marshmallow.Schema], loaded: t.Any, dumped: t.Dict[t.Any, t.Any]
57+
schema: marshmallow.Schema, loaded: t.Any, dumped: t.Dict[t.Any, t.Any]
5858
) -> None:
5959
assert schema.loads(schema.dumps(loaded)) == loaded
6060

6161

6262
def _assert_load_dump(
63-
schema: t.Type[marshmallow.Schema], loaded: t.Any, dumped: t.Dict[t.Any, t.Any]
63+
schema: marshmallow.Schema, loaded: t.Any, dumped: t.Dict[t.Any, t.Any]
6464
) -> None:
6565
assert schema.dump(schema.load(dumped)) == dumped
6666

6767

6868
def fixture_from_dict(
6969
name: str,
7070
id_to_value: t.Mapping[
71-
str, t.Callable[[t.Type[marshmallow.Schema], t.Dict[t.Any, t.Any], t.Any], None]
71+
str, t.Callable[[marshmallow.Schema, t.Dict[t.Any, t.Any], t.Any], None]
7272
],
7373
):
7474
"""
@@ -434,7 +434,8 @@ class B:
434434

435435

436436
@pytest.mark.xfail(
437-
condition=sys.implementation.name == "pypy" and sys.pypy_version_info < (7, 2),
437+
# type ignored due to foss.heptapod.net/pypy/pypy/-/issues/3129
438+
condition=sys.implementation.name == "pypy" and sys.pypy_version_info < (7, 2), # type: ignore[attr-defined]
438439
reason="Forward references and string annotations are broken in PyPy3 < 7.2",
439440
strict=True,
440441
)

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ commands =
4444
check-manifest {toxinidir}
4545
black --check {toxinidir}
4646
isort --verbose --check-only --diff src tests setup.py
47-
mypy src/desert/
47+
mypy src/desert/ tests/
4848

4949
[testenv:spell]
5050
setenv =

0 commit comments

Comments
 (0)