I have a function which should check if the incoming object is allowed or not.
Why this Function Failing For None Type.
def is_valid_object(obj):
allowed_types = [int, bool, None]
return type(obj) in allowed_types
Working for:
is_valid_object('i am string')
Expected False
=> Returns False
is_valid_object(10)
Expected True
=> Returns True
is_valid_object(False)
Expected True
=> Returns True
Why This Fails:
is_valid_object(None)
Expected True
=> Returns False