From eea8ce9147778dd762828f25649858e525179bd8 Mon Sep 17 00:00:00 2001 From: Stefan Behnel <scoder@users.berlios.de> Date: Thu, 2 Dec 2010 08:03:14 +0100 Subject: [PATCH] additional test case --- tests/run/set.pyx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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 = [] -- 2.26.2