mirror of
https://github.com/openkmip/pykmip
synced 2025-12-16 00:04:26 +00:00
Adding test case for bug with unsigned Enumeration encoding
This change adds a test case that verifies a fix for a bug with how Enumerations were encoded as signed instead of unsigned integers. The validation check for Enumerations has also been updated to be more concise.
This commit is contained in:
@@ -415,10 +415,9 @@ class Enumeration(Integer):
|
||||
|
||||
def __validate(self):
|
||||
if self.enum is not None:
|
||||
if type(self.enum) is not self.ENUM_TYPE:
|
||||
msg = ErrorStrings.BAD_EXP_RECV
|
||||
raise TypeError(msg.format(Enumeration.__name__, 'value',
|
||||
Enum, type(self.enum)))
|
||||
if not isinstance(self.enum, Enum):
|
||||
raise TypeError("expected {0}, observed {1}".format(
|
||||
type(self.enum), Enum))
|
||||
|
||||
def __repr__(self):
|
||||
return "{0}(value={1})".format(type(self).__name__, self.enum)
|
||||
|
||||
Reference in New Issue
Block a user