-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
missing evaluated value in report when asserting a boolean attribute (using --assert=rewrite) #1503
Comments
This is caused by the _collapse_false function, which aims to trim away trivial explanations. For example this test: def test_false_value():
x = 0
assert bool(x) Full explanation, with def test_false_value():
x = 0
> assert bool(x)
E assert False
E + where False = bool(0) Trimmed explanation, with def test_false_value():
x = 0
> assert bool(x)
E assert bool(0) I'm having trouble recreating an example where useful information is trimmed away. |
Hi tomviner, Thanks for your reply. I wasn't aware of such behaviour and in my case I wasn't sure if my asserted value was a boolean or not. In fact if you take the following test:
The output isn't telling me if mo.a is False or if it's anything else that evalues to False (0 for instance). It turns out that the output is different if it is 0 but without knowing this, you can't tell... |
Fixes #1503 no longer collapse false explanations
Hi there,
First of all, thank you for the amazing work you've done on pytest! It is really cool!
When asserting a boolean attribute of an object, the actual value isn't printed in the output as it would be with other types (int, str, etc). I'm using latest pytest 2.9.1
Provides the following output (using with ---assert=rewrite):
And if run with ---assert=reinterp:
Thanks
The text was updated successfully, but these errors were encountered: