diff --git a/tests/test_utils.py b/tests/test_utils.py index c3469f9e..4f09a478 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -114,6 +114,8 @@ class TestEnumLevel(TestCase): assert_in('names', e.levels) assert_list_equal(e.names, ['names', 'one', 'two']) assert_equal(e.NAMES, 'names') + result = not (e.NAMES != 'names') + assert_true(result) def test_enum_behavior(self): e = enum(['one', 'two', 'three']) diff --git a/wa/utils/types.py b/wa/utils/types.py index 6256b9c9..c68d504c 100644 --- a/wa/utils/types.py +++ b/wa/utils/types.py @@ -569,6 +569,15 @@ class level(object): else: return self.value < other + def __ne__(self, other): + if isinstance(other, level): + return self.value != other.value + elif isinstance(other, basestring): + return self.name != other + else: + return self.value != other + + class _EnumMeta(type):