-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add documentation for messages with assert in their name #5960
Add documentation for messages with assert in their name #5960
Conversation
Co-authored-by: Vladyslav Krylasov <vladyslav.krylasov@gmail.com>
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.
The example are a bit silly here as it's hard to tell what te code should be. It should probably be "nothing" because the assert is useless ? What about # nothing, the assert was always true
def test(param): | ||
if param: | ||
assertion_string = "There is an AssertionError" | ||
else: | ||
assertion_string = "" | ||
|
||
assert assertion_string |
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.
def test(param): | |
if param: | |
assertion_string = "There is an AssertionError" | |
else: | |
assertion_string = "" | |
assert assertion_string | |
from random import random | |
def a_function_that_could_fail_the_assert(): | |
if random() > 0.5: | |
return "something" | |
return "" | |
assert a_function_that_could_fail_the_assert() |
I think the point is that asserting on a string litteral never fail.
Yeah I'm going to change it to say something like that. |
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
CONTRIBUTORS.txt
if you are a new contributor.Type of Changes
Description
Code examples based on pylint-errors and my own work.
Ref. #5953.
These are a bit silly, but oh well... At least it shows how to avoid them.