Skip to content

Commit 0e4231d

Browse files
committed
style: mypy raise errors about unexpected arguments
- Refactor the Dict() class inside the mocks test file to allow any key-value pair to be passed to the model.
1 parent 42ca399 commit 0e4231d

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

tests/unit/mocks.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
from decimal import Decimal
2+
from typing import Any
23
from unittest.mock import AsyncMock, MagicMock
34

45
from aleph.sdk.chains.evm import EVMAccount
56
from aleph.sdk.conf import settings
6-
from pydantic import BaseModel
7+
from pydantic import BaseModel, ConfigDict
78

89
from aleph_client.commands.node import NodeInfo
910

@@ -30,8 +31,14 @@
3031

3132

3233
class Dict(BaseModel):
33-
class Config:
34-
extra = "allow"
34+
model_config = ConfigDict(extra="allow")
35+
36+
def __init__(self, **data: Any):
37+
"""Allow any key-value pair to be passed to the model."""
38+
super().__init__(**data)
39+
40+
def to_dict(self) -> dict[str, Any]:
41+
return self.model_dump()
3542

3643

3744
def create_test_account() -> EVMAccount:

0 commit comments

Comments
 (0)