From 3f8f4ed43f65e012558fefa685a92ad944e03c98 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Wed, 21 Aug 2013 12:56:38 +0200 Subject: [PATCH] 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 --- wsme/types.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wsme/types.py b/wsme/types.py index ebee9d0..aa3e850 100644 --- a/wsme/types.py +++ b/wsme/types.py @@ -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):