From: Stefan Behnel Date: Thu, 2 Dec 2010 07:03:14 +0000 (+0100) Subject: additional test case X-Git-Tag: 0.14.alpha0~35 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=eea8ce9147778dd762828f25649858e525179bd8;p=cython.git additional test case --- diff --git a/tests/run/set.pyx b/tests/run/set.pyx index 07434520..41b50d8c 100644 --- a/tests/run/set.pyx +++ b/tests/run/set.pyx @@ -105,6 +105,24 @@ def test_set_discard(): s1.discard(3) return s1 +def test_set_sideeffect_unhashable_failure(): + """ + >>> test_set_sideeffect_unhashable_failure() + [2, 4, 5] + """ + L = [] + def sideeffect(x): + L.append(x) + return x + def unhashable_value(x): + L.append(x) + return set() + try: + s = set([1,sideeffect(2),3,unhashable_value(4),sideeffect(5)]) + except TypeError: pass + else: assert False, "expected exception not raised" + return L + def sorted(it): # Py3 can't compare strings to ints chars = []