From bef724a5d142a1ca06476d56015a6c6bcdf89f1b Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Fri, 20 Jan 2017 16:01:25 -0800 Subject: 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. --- tests/widgets/globals_test.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'tests/widgets') 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) -- cgit v1.2.3