Detect tautological asserts
Bug #848467 reported by
Tristan Seligmann
This bug affects 3 people
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Pyflakes |
Fix Released
|
Wishlist
|
Unassigned | ||
pyflakes (Debian) |
Fix Released
|
Unknown
|
Bug Description
An assert of the form:
assert (x, 'blahblah')
is tautological, because a non-empty tuple always has a truth value of True. However, it is common to mistakenly construct an assert statement of this form when attempting to wrap it over multiple lines. Python 2.6+ already issues a SyntaxWarning about this, but it would be nice if Pyflakes detected it too.
Changed in pyflakes: | |
importance: | Undecided → Wishlist |
Changed in pyflakes (Debian): | |
status: | Unknown → New |
Changed in pyflakes (Debian): | |
status: | New → Confirmed |
Changed in pyflakes: | |
status: | Fix Committed → Fix Released |
Changed in pyflakes (Debian): | |
status: | Confirmed → Fix Released |
To post a comment you must log in.
Pull request for the specific problem raised here : https:/ /github. com/pyflakes/ pyflakes/ pull/51
I've also quickly hacked together detection of assertion of a static value. It is just a concept demo, in case anyone thinks it could be useful. It has cross-version issues, and could easily become more complete by adding more call names. /github. com/jayvdb/ pyflakes/ commit/ 25234773b174f0e b34fca3cd2e7342 90d7ab3a5e
https:/