Skip to content

Commit 0088286

Browse files
authored
Add tests for unhashable failure (#21)
1 parent 9679229 commit 0088286

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

tryingsnake/test/test_try.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,13 @@ def test_fail_with_unhashable_value(self):
161161
with pytest.raises(TypeError):
162162
hash(Success([1]))
163163

164+
class UnhashableException(Exception):
165+
def __hash__(self):
166+
raise TypeError()
167+
168+
with pytest.raises(TypeError):
169+
hash(Failure(UnhashableException()))
170+
164171
def test_generator_without_arguments(self):
165172
g = (lambda: (yield 1))()
166173
self.assertEqual(Try(g).map(lambda x: x + 1), Success(2))

0 commit comments

Comments
 (0)