-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose mock directly #335
Expose mock directly #335
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, mostly looks good, just one thing...
def assert_mock_put_called_with(signal: Signal, value: Any, wait=ANY, timeout=ANY): | ||
backend = _get_mock_signal_backend(signal) | ||
backend.put_mock.assert_called_with(value, wait=wait, timeout=timeout) | ||
def get_mock_put(signal: Signal) -> Mock: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should: I think this function should have a docstring since it's name is confusing ("put" is a noun here but it looks like a verb because it is almost everywhere else). Alternatively I'm happy with a rename if you can think of something better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree on the docstring point.
I also think the name is confusing (it getting the Mock put of a mock backend rather than the underlying SoftSignal
put).
Id say get_backend_put_mock
would be better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like having the word backend
exposed to the user as nothing else externally facing in this file mentions backend
, they all use mock_put
as a phrase so this should match them. Added the docstring though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree it's nicer to expose the mock directly, just the one thread from Callum's review above.
52cf941
to
2a31b33
Compare
2a31b33
to
80090f4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm! Cheers
085e770
to
03cc49c
Compare
Fixes #325
This is a little messier than
assert_mock_put_called_with
for the case where you just care about the value and not thekwargs
, but I think that in general it's nicer to supply theMock
as it's a well known object that developers can then just use as they wish.