0
from enum import IntEnum
from typing import List
class EnumClass(IntEnum):
   A = 1
   B = 2

   @staticmethod
   def listofconditions() -> 'List[EnumClass]':
      return [EnumClass.A.numerator, \
              EnumClass.B.numerator]


if 1 in EnumClass.listofconditions:
    pass

yields:

[pylint]:E1135 Value 'EnumClass.listofconditions' doesn't support membership test

(I posted this for others Googling a solution to this cryptic message in order to makes sense of it. Solution to follow)

JGFMK
  • 8,425
  • 4
  • 58
  • 92
  • 1
    I think you mean `List[EnumClass]` for the return type hint. – chepner Jul 07 '18 at 21:52
  • It's not *that* cryptic an error message; you defined a method but didn't call it. – chepner Jul 07 '18 at 21:53
  • So why vote to close something when Googling 'Value doesn't support membership test' doesn't yield an answer. Never quite got that. – JGFMK Jul 07 '18 at 22:02
  • @chepner - so why doesn't message read more along the lines did you mean a method. It's the cryptic nature of the message that made me field this.. – JGFMK Jul 07 '18 at 22:04

1 Answers1

2

Change code to:

if 1 in EnumClass.listofconditions():
JGFMK
  • 8,425
  • 4
  • 58
  • 92