mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
Python: add failing test for comparison using 'is' and enum members.
This commit is contained in:
@@ -24,7 +24,7 @@
|
||||
|
||||
|
||||
|
||||
#ODASA-4519
|
||||
|
||||
#OK as we are using identity tests for unique objects
|
||||
V2 = "v2"
|
||||
V3 = "v3"
|
||||
@@ -85,3 +85,21 @@ def both_sides_known(zero_based="auto", query_id=False):
|
||||
if zero_based is False: # False positive here
|
||||
pass
|
||||
|
||||
#Avoid depending on enum back port for Python 2 tests:
|
||||
class Enum(object):
|
||||
pass
|
||||
|
||||
class MyEnum(Enum):
|
||||
|
||||
memberA = None
|
||||
memberB = 10
|
||||
memberC = ("Hello", "World")
|
||||
|
||||
def comp_enum(x):
|
||||
if x is MyEnum.memberA:
|
||||
return
|
||||
if x is MyEnum.memberB:
|
||||
return
|
||||
if x is MyEnum.memberC:
|
||||
return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user