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:
Julien Danjou 2013-08-21 12:56:38 +02:00
parent 9246e4d4be
commit 3f8f4ed43f

View File

@ -160,7 +160,7 @@ class Enum(UserType):
def validate(self, value):
if value not in self.values:
raise ValueError("Value '%s' is invalid (should be one of: %s)" % (
value, ', '.join(self.values)))
value, ', '.join(sorted(self.values))))
return value
def tobasetype(self, value):