From a91ee3f8592f7abcb405dc30ef8e8279dc9a09fd Mon Sep 17 00:00:00 2001 From: Lucas Hoffmann Date: Sun, 20 Aug 2017 11:58:57 +0200 Subject: Test hash() for TagWidget with unicode representation --- tests/widgets/globals_test.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'tests') 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')) -- cgit v1.2.3