Skip to content

Commit

Permalink
[literal-comparison] Cleanup of identical/duplicated functional tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre-Sassoulas committed Aug 25, 2022
1 parent 19b4fda commit 1582e37
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 21 deletions.
12 changes: 0 additions & 12 deletions tests/functional/c/comparison_of_constants.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
# pylint: disable=missing-docstring, comparison-with-itself, invalid-name


if 2 is 2: # [literal-comparison, comparison-of-constants]
pass

while 2 == 2: # [comparison-of-constants]
pass

Expand All @@ -22,14 +18,6 @@

CONST = 24

if CONST is 0: # [literal-comparison]
pass

if CONST is 1: # [literal-comparison]
pass

if CONST is 42: # [literal-comparison]
pass

if 0 < CONST < 42:
pass
Expand Down
13 changes: 4 additions & 9 deletions tests/functional/c/comparison_of_constants.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
comparison-of-constants:4:3:4:9::"Comparison between constants: '2 is 2' has a constant value":HIGH
literal-comparison:4:3:4:9::In '2 is 2', use '==' when comparing constant literals not 'is' ('2 == 2'):HIGH
comparison-of-constants:7:6:7:12::"Comparison between constants: '2 == 2' has a constant value":HIGH
comparison-of-constants:10:6:10:11::"Comparison between constants: '2 > 2' has a constant value":HIGH
comparison-of-constants:20:3:20:15::"Comparison between constants: 'True == True' has a constant value":HIGH
singleton-comparison:20:3:20:15::Comparison 'True == True' should be 'True is True' if checking for the singleton value True, or 'True' if testing for truthiness:UNDEFINED
literal-comparison:25:3:25:13::In 'CONST is 0', use '==' when comparing constant literals not 'is' ('CONST == 0'):HIGH
literal-comparison:28:3:28:13::In 'CONST is 1', use '==' when comparing constant literals not 'is' ('CONST == 1'):HIGH
literal-comparison:31:3:31:14::In 'CONST is 42', use '==' when comparing constant literals not 'is' ('CONST == 42'):HIGH
comparison-of-constants:3:6:3:12::"Comparison between constants: '2 == 2' has a constant value":HIGH
comparison-of-constants:6:6:6:11::"Comparison between constants: '2 > 2' has a constant value":HIGH
comparison-of-constants:16:3:16:15::"Comparison between constants: 'True == True' has a constant value":HIGH
singleton-comparison:16:3:16:15::Comparison 'True == True' should be 'True is True' if checking for the singleton value True, or 'True' if testing for truthiness:UNDEFINED

0 comments on commit 1582e37

Please sign in to comment.