summaryrefslogtreecommitdiff
path: root/tests/widgets
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2017-01-20 16:01:25 -0800
committerDylan Baker <dylan@pnwbakers.com>2017-01-27 10:34:45 -0800
commitbef724a5d142a1ca06476d56015a6c6bcdf89f1b (patch)
treec8f650a4d68ed47fef3a4cf758fa7b6c9919ef4a /tests/widgets
parent7fd9b50a7f43821c6931e4f19efc37c138d77837 (diff)
Replace cmp with rich comparisons
This is both a performance issue (since cmp is slower than rich comparisons), and a python3 issue since cmp (and __cmp__) are gone in python 3.
Diffstat (limited to 'tests/widgets')
-rw-r--r--tests/widgets/globals_test.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/tests/widgets/globals_test.py b/tests/widgets/globals_test.py
index 4974062e..7d7d6547 100644
--- a/tests/widgets/globals_test.py
+++ b/tests/widgets/globals_test.py
@@ -29,12 +29,11 @@ class TestTagWidget(unittest.TestCase):
def test_sort(self):
"""Test sorting."""
- from alot.helper import tag_cmp
with mock.patch(
'alot.widgets.globals.settings.get_tagstring_representation',
lambda t, _, __: {'translated': t, 'normal': None,
'focussed': None}):
expected = ['a', 'z', 'aa', 'bar', 'foo']
- base = [globals_.TagWidget(x) for x in expected]
- actual = list(sorted(base, cmp=tag_cmp, key=lambda x: x.translated))
- self.assertListEqual([g.translated for g in actual], expected)
+ actual = [g.translated for g in
+ sorted(globals_.TagWidget(x) for x in expected)]
+ self.assertListEqual(actual, expected)