PyCQA / pycodestyle

Simple Python style checker in one Python file

Home Page:https://pycodestyle.pycqa.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

E275 with assert(1 == 1)

barronh opened this issue · comments

With:

5.0.4 (mccabe: 0.7.0, pycodestyle: 2.9.1, pyflakes: 2.5.0) CPython 3.6.1 on Linux

flake8 returns E275 on assert statements that have == in them.

With

3.9.2 (mccabe: 0.6.1, pycodestyle: 2.7.0, pyflakes: 2.3.1) CPython 3.6.1 on Linux

It did not have this issue. I am unclear if this has already been addressed. I saw that it was incorrectly raised as an issue in flake8 23 days ago. Has it already been addressed here?

can you share the code ?

if the code is exactly:

assert(1 == 1)

then yes that is intentional and called out in the changelog

(note that assert / if / return / etc. are not functions but are statements)

commented

note that assert / if / return / etc. are not functions but are statements

Thanks !
Just to lift any doubt for other readers, it means that parentheses are irrelevant for assert, so just

assert 1 == 1

is indeed better.