def test_hash_method_preserved() -> None:
    """https://github.com/pydantic/pydantic/issues/2383"""

    @dataclasses.dataclass
    class A:
        s: str

        def __hash__(self):
            return 123

    class B(pydantic.BaseModel):
        a: A

    a = A('')
    b = B(a=a)

    assert hash(a) == 123
    assert hash(b.a) == 123
https://github.com/pydantic/pydantic/issues/2383
tests/test_dataclasses.py