Eric V. Smith <e...@trueblade.com> added the comment:
I'm not sure why dataclasses would be different here: >>> import dataclasses >>> import unittest.mock >>> @dataclasses.dataclass ... class Foo: ... name: str ... baz: float ... bar: int = 12 ... >>> import inspect >>> inspect.signature(Foo) <Signature (name: str, baz: float, bar: int = 12) -> None> >>> Foo is just a normal class with a normal __init__. This is no different than if you don't use dataclasses: >>> class Bar: ... def __init__(self, name: str, baz: float, bar: int = 12) -> None: ... pass ... >>> Bar() Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: __init__() missing 2 required positional arguments: 'name' and 'baz' >>> inspect.signature(Bar) <Signature (name: str, baz: float, bar: int = 12) -> None> >>> BarMock = unittest.mock.Mock(Bar) >>> barMock = BarMock() ---------- nosy: +eric.smith _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue36580> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com