diff options
| author | bwarsaw | 2007-03-21 21:31:59 +0000 |
|---|---|---|
| committer | bwarsaw | 2007-03-21 21:31:59 +0000 |
| commit | daeb5dbf03fde77265e42392cae0913765423f94 (patch) | |
| tree | f696e3eaaaca084c978b7b21df53e00738629ac3 /Mailman/testing/test_enum.py | |
| parent | cdefb7ba2792083a520f8dc40993a0f946ad3434 (diff) | |
| download | mailman-daeb5dbf03fde77265e42392cae0913765423f94.tar.gz mailman-daeb5dbf03fde77265e42392cae0913765423f94.tar.zst mailman-daeb5dbf03fde77265e42392cae0913765423f94.zip | |
Added a test case for the code that Tokio fixed for enums in r8164.
However, I also changed the semantics a bit to be closer to what I
wanted, namely that iteration returns the EnumValue objects, not the
string names of the attributes.
Diffstat (limited to 'Mailman/testing/test_enum.py')
| -rw-r--r-- | Mailman/testing/test_enum.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Mailman/testing/test_enum.py b/Mailman/testing/test_enum.py index 6f198df67..de6877afc 100644 --- a/Mailman/testing/test_enum.py +++ b/Mailman/testing/test_enum.py @@ -94,7 +94,6 @@ class TestEnum(unittest.TestCase): eq(int(MoreColors.red), 1) eq(int(OtherColors.blue), 2) - def test_enum_duplicates(self): try: class Bad(Enum): @@ -109,6 +108,14 @@ class TestEnum(unittest.TestCase): got_error = False self.failUnless(got_error) + def test_enum_iteration(self): + eq = self.assertEqual + # Iteration sorts on the int value of the enum + values = [str(v) for v in MoreColors] + eq(values, ['red', 'green', 'blue', 'pink', 'cyan']) + values = [int(v) for v in MoreColors] + eq(values, [1, 2, 3, 4, 5]) + def test_suite(): |
