1
0
mirror of https://github.com/JoelBender/bacpypes synced 2025-09-28 22:15:23 +08:00

Most minimial change to Enumerated.is_valid which will throw exception

when value is invalid
This commit is contained in:
Robert C. Buchanan 2024-03-11 10:30:06 -05:00
parent a5be2ad5ac
commit b405ecd508

View File

@ -1255,6 +1255,7 @@ class Enumerated(Atomic):
"""Return True if arg is valid value for the class. If the string
value is wrong for the enumeration, the encoding will fail.
"""
cls(arg)
return (isinstance(arg, int) and (arg >= 0)) or \
isinstance(arg, str)