Sort set in type exception
The values are stored in a set, therefore they are not sorted when used in the exception message. Later, the unit test might fail because it checks for the exact message expected, and that may depends on the order Python decided to return the set. Let's sort it each time to be sure the message we can expect. Change-Id: I9e9c1270ea408f9e217320e30902cb74e690fce8
This commit is contained in:
parent
9246e4d4be
commit
3f8f4ed43f
@ -160,7 +160,7 @@ class Enum(UserType):
|
|||||||
def validate(self, value):
|
def validate(self, value):
|
||||||
if value not in self.values:
|
if value not in self.values:
|
||||||
raise ValueError("Value '%s' is invalid (should be one of: %s)" % (
|
raise ValueError("Value '%s' is invalid (should be one of: %s)" % (
|
||||||
value, ', '.join(self.values)))
|
value, ', '.join(sorted(self.values))))
|
||||||
return value
|
return value
|
||||||
|
|
||||||
def tobasetype(self, value):
|
def tobasetype(self, value):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user