Replies: 1 comment 14 replies
-
Can you describe the problem you're seeing in more detail? You mentioned in the other thread that the ellipses make mypy unhappy. When I paste your code into a new document, add the missing import statements, and run mypy on it, I don't see any errors. Normally, you'd need to supply real default argument values rather than using an ellipsis, but type checkers generally allow you to use an ellipsis as a stand-in for the actual value when you're writing overloads or stubs. It's still a good idea to provide the actual default argument values because it allows language servers to show users these values when they call the function. For example, here's what I see when I start typing a call to It would be better if you supplied the actual default values. I presume they are zero by default? If so, replace the |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi All,
I eventually managed to release a
py.typed
version of testfixtures, but to do so I had to give up on a bunch of overloads which I thought helped document intended methods of use:simplistix/testfixtures@70283c2
I've tried to get my head around this a few times over the last few months:
I even ended up logging a
mypy
bug:...and as well as several attempts myself, LLMs have also been struggling, even once the underlying typing was sorted out:
At a high level, I'm essentially looking to revert simplistix/testfixtures@70283c2 but with functioning type annotations, essentially providing these three calling patterns for the factory:
...and then these overload patterns for the methods for manipulating the queue of upcoming mock datetimes:
...and similar across
mock_datetime
,mock_time
andmock_date
and the helper types they construct.Is Python typing just "not there yet" or am I missing something? Happy to be shown the way, ecstatic if someone feels inspired to throw up a PR 😅
Beta Was this translation helpful? Give feedback.
All reactions