-
-
Notifications
You must be signed in to change notification settings - Fork 12
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
Feature request: add a .thenDoNothing()
method to AnswerSelector
?
#69
Comments
Interesting. Afaik we currently have:
Omitting But besides that, |
I was thinking about functions not meaning to return any value :) Java's mockito has that shortcut for functions returning But I didn't know that you could just specify no Ultimately that's syntactic sugar, of course, so it's your call :) |
Oh, didn't realize that |
That's not what I meant; I meant to just omit |
Ohwell, I don't think it would be of any use really, now that I know the trick of not specifying Also, I'm too much influenced by Java... One thing I am starting to fully realise since I first posted this request is that python has no Sorry for the noise :) |
OK, I thought I had closed this issue... Anyway, as said in my previous comment, no need for that after all |
Well, I am on the Python discord and I've been asked this question about this code ( def test_add_updates_deque(self):
sample = 1.0
mean_value = MeanValue()
values = mock(deque)
when(values).appendleft(sample) # <--- This line
mean_value.values = values
mean_value.add(sample)
verify(values, times = 1).appendleft(sample) The guy who asked me about this line is pretty experienced in Python (much more so than I am) and he didn't get the hang of what this line did. The way I explained it to him is as such:
The "which is more explicit" is of course my opinion only, of course; but can we just have that method defined which just returns |
Well, The main problem with
This one also reads fine, imo:
But since
probably works as well. The constructor |
The original mockito in Java has that and it's very convenient; can this be implemented in python mockito as well?
I'm a beginner in python but AFAICS this can be implemented as such:
The text was updated successfully, but these errors were encountered: