summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPatrick Totzke <patricktotzke@gmail.com>2017-01-30 22:05:34 +0000
committerGitHub <noreply@github.com>2017-01-30 22:05:34 +0000
commitb29da9cdcda59b262e3df2a1fb739a33311b2165 (patch)
treecc2192bafa66fdd7e4d8f1b2d944142edefef120 /tests
parent53f8800854e32f86f7224c599dab854a1094b010 (diff)
parent514795d2ec9773b8a66cfdfaede3af0d49ad92b7 (diff)
Merge pull request #1009 from dcbaker/pr/remove_cmp
Remove remaining uses of cmp
Diffstat (limited to 'tests')
-rw-r--r--tests/widgets/__init__.py0
-rw-r--r--tests/widgets/globals_test.py39
2 files changed, 39 insertions, 0 deletions
diff --git a/tests/widgets/__init__.py b/tests/widgets/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/widgets/__init__.py
diff --git a/tests/widgets/globals_test.py b/tests/widgets/globals_test.py
new file mode 100644
index 00000000..7d7d6547
--- /dev/null
+++ b/tests/widgets/globals_test.py
@@ -0,0 +1,39 @@
+# encoding=utf-8
+# Copyright © 2017 Dylan Baker
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+"""Tests for the alot.widgets.globals module."""
+
+from __future__ import absolute_import
+
+import unittest
+
+import mock
+
+from alot.widgets import globals as globals_
+
+
+class TestTagWidget(unittest.TestCase):
+
+ def test_sort(self):
+ """Test sorting."""
+ with mock.patch(
+ 'alot.widgets.globals.settings.get_tagstring_representation',
+ lambda t, _, __: {'translated': t, 'normal': None,
+ 'focussed': None}):
+ expected = ['a', 'z', 'aa', 'bar', 'foo']
+ actual = [g.translated for g in
+ sorted(globals_.TagWidget(x) for x in expected)]
+ self.assertListEqual(actual, expected)