-
-
Notifications
You must be signed in to change notification settings - Fork 771
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
Inconsistent newlines in %D replacement using spy.printf #1717
Comments
Thank you for your accurate bug report. I am sure it's an oversight that the formatting is inconsistent, and it's certainly an oversight that there are no unit tests for Would you like to contribute another pull request to amend that? |
I'd love to make a PR to fix this. But, which is the preferred version? With a starting newline or without? |
I don't have strong opinions about this, and welcome discussion if anyone has arguments for either solution. I'd prefer to always start with a newline, as that's the behaviour for the single call. I assume the single call is the more common usage, so people might have built integrations (like |
I concur with your preference. I'll make a PR that makes the multiple call format match the single call format. |
What did you expect to happen?
I expected the
%D
replacement forspy.printf
to have the same newline behavior regardless of the number of calls to the spy.What actually happens
When there's only one call to a spy and I use the
%D
replacement withspy.printf
, a newline is appended to the start of the replacement thanks to this statement which is always executed. However, when multiple calls have been made to the spy, a newline is not placed at the beginning of the replacement because of this conditional which only adds newlines before the "Call n:" label after the first iteration of the loop.How to reproduce
I this an oversight in formatting or is this an intentional decision? There don't seem to be any explicit unit tests for
%D
with the rest of theprintf
tests, but altering how%D
works causes tests like theassert.alwaysCalledWithMatch exception message
test to fail.The text was updated successfully, but these errors were encountered: