Skip to content

Commit 899a25c

Browse files
authored
fix: Add equality check to UserData model (#562)
This is needed for Apify SDK tests
1 parent 3bac69b commit 899a25c

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

src/crawlee/_request.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,15 @@ def __iter__(self) -> Iterator[str]: # type: ignore
9292
def __len__(self) -> int:
9393
return len(self.__pydantic_extra__)
9494

95+
def __eq__(self, other: object) -> bool:
96+
if isinstance(other, BaseModel):
97+
return super().__eq__(other)
98+
99+
if isinstance(other, dict):
100+
return self.model_dump() == other
101+
102+
return NotImplemented
103+
95104

96105
user_data_adapter = TypeAdapter(UserData)
97106

0 commit comments

Comments
 (0)