Skip to content

Commit

Permalink
pylint: Skip use-implicit-booleaness-not-comparison
Browse files Browse the repository at this point in the history
Pylint 2.12.0 introduced new checker:
> Used when Pylint detects that collection literal comparison is being
  used to check for emptiness; Use implicit booleaness insteadof a
  collection classes; empty collections are considered as false

Comparison of variable to equality to collection:
> Lexicographical comparison between built-in collections works as follows:
  For two collections to compare equal, they must be of the same type,
  have the same length, and each pair of corresponding elements must
  compare equal (for example, [1,2] == (1,2) is false because the type is
  not the same).
  Collections that support order comparison are ordered the same as their
  first unequal elements (for example, [1,2,x] <= [1,2,y] has the same
  value as x <= y). If a corresponding element does not exist, the shorter
  collection is ordered first (for example, [1,2] < [1,2,3] is true).

So, `assert value == {}` is not the same as `assert not value`.

Fixes: #244
Signed-off-by: Stanislav Levin <[email protected]>
  • Loading branch information
stanislavlevin authored and rcritten committed Mar 24, 2022
1 parent d58af59 commit eaa8ffd
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ disable=
use-dict-literal, # pylint 2.10.0 dict vs {}
use-list-literal, # pylint 2.10.0 list() vs []
unspecified-encoding, # pylint 2.10.0, ASCII or UTF8 and platform-specific
use-implicit-booleaness-not-comparison, # pylint 2.12.2, weak comparison

[REPORTS]

Expand Down

0 comments on commit eaa8ffd

Please sign in to comment.