Python: add failing test for comparison using 'is' and enum members.

This commit is contained in:
Mark Shannon
2019-01-28 12:04:04 +00:00
parent ccfb1c229a
commit 5da209f876

View File

@@ -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