← Back to team overview

divmod-dev team mailing list archive

[Bug 848467] [NEW] Detect tautological asserts

 

Public bug reported:

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.

** Affects: pyflakes
     Importance: Wishlist
         Status: New

** Affects: pyflakes (Debian)
     Importance: Unknown
         Status: Unknown

** Bug watch added: Debian Bug tracker #641316
   http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=641316

** Also affects: pyflakes (Debian) via
   http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=641316
   Importance: Unknown
       Status: Unknown

** Changed in: pyflakes
   Importance: Undecided => Wishlist

-- 
You received this bug notification because you are a member of Divmod-
dev, which is the registrant for Pyflakes.
https://bugs.launchpad.net/bugs/848467

Title:
  Detect tautological asserts

Status in Pyflakes:
  New
Status in “pyflakes” package in Debian:
  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.

To manage notifications about this bug go to:
https://bugs.launchpad.net/pyflakes/+bug/848467/+subscriptions


Follow ups

References