Fix typing

TypedDict is not a subclass of `dict`, but it is a subclass of `Mapping`. Go figure.
This commit is contained in:
Alessio Bogon 2024-12-08 12:33:46 +01:00
parent 0d1c46ba51
commit d4a5271533
No known key found for this signature in database
1 changed files with 2 additions and 2 deletions

View File

@ -4,7 +4,7 @@ import linecache
import re import re
import textwrap import textwrap
import typing import typing
from collections.abc import Sequence from collections.abc import Mapping, Sequence
from dataclasses import dataclass, field from dataclasses import dataclass, field
from typing import Any from typing import Any
@ -297,7 +297,7 @@ class GherkinDocument:
comments: list[Comment] comments: list[Comment]
@classmethod @classmethod
def from_dict(cls, data: dict[str, Any]) -> Self: def from_dict(cls, data: Mapping[str, Any]) -> Self:
return cls( return cls(
feature=Feature.from_dict(data["feature"]), feature=Feature.from_dict(data["feature"]),
comments=[Comment.from_dict(comment) for comment in data["comments"]], comments=[Comment.from_dict(comment) for comment in data["comments"]],