summaryrefslogtreecommitdiff
path: root/pylint/test/functional/unneeded_not.py
blob: 882a23820c8688f6e2a7045559b0c2232e64f97c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
"""Check exceeding negations in boolean expressions trigger warnings"""

# pylint: disable=singleton-comparison

def unneeded_not():
    """This is not ok
    """
    bool_var = True
    someint = 2
    if not not bool_var:  # [unneeded-not]
        pass
    if not someint == 1:  # [unneeded-not]
        pass
    if not someint != 1:  # [unneeded-not]
        pass
    if not someint < 1:  # [unneeded-not]
        pass
    if not someint > 1:  # [unneeded-not]
        pass
    if not someint <= 1:  # [unneeded-not]
        pass
    if not someint >= 1:  # [unneeded-not]
        pass
    if not not someint:  # [unneeded-not]
        pass
    if not bool_var == True:  # [unneeded-not]
        pass
    if not bool_var == False:  # [unneeded-not]
        pass
    if not bool_var != True:  # [unneeded-not]
        pass
    if not True == True:  # [unneeded-not]
        pass


def not_checked():
    """This is ok"""
    bool_var = True
    someint = 2
    if not(bool_var == False and someint == 1):
        pass