summaryrefslogtreecommitdiff
path: root/tests/widgets
diff options
context:
space:
mode:
authorLucas Hoffmann <l-m-h@web.de>2017-08-20 11:58:57 +0200
committerLucas Hoffmann <l-m-h@web.de>2017-08-20 12:00:15 +0200
commita91ee3f8592f7abcb405dc30ef8e8279dc9a09fd (patch)
treeed3a3bfe609ae32886a58e16841a8b052a50b488 /tests/widgets
parent762b7dc1a60dc322876c6b5fa8769037c483eba0 (diff)
Test hash() for TagWidget with unicode representation
Diffstat (limited to 'tests/widgets')
-rw-r--r--tests/widgets/globals_test.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/widgets/globals_test.py b/tests/widgets/globals_test.py
index 52563b84..91092264 100644
--- a/tests/widgets/globals_test.py
+++ b/tests/widgets/globals_test.py
@@ -39,3 +39,16 @@ class TestTagWidget(unittest.TestCase):
actual = [g.translated for g in
sorted(globals_.TagWidget(x) for x in expected)]
self.assertListEqual(actual, expected)
+
+ @unittest.expectedFailure
+ def test_hash_for_unicode_representation(self):
+ with mock.patch(
+ 'alot.widgets.globals.settings.get_tagstring_representation',
+ lambda _, __, ___: {'translated': u'✉', 'normal': None,
+ 'focussed': None}):
+ # We don't have to assert anything, we just want the hash to be
+ # computed without an exception. The implementation currently
+ # (2017-08-20) caches the hash value when __init__ is called. This
+ # test should even test the correct thing if this is changed and
+ # the hash is only computed in __hash__.
+ hash(globals_.TagWidget('unread'))