From 208ba2446d1e37be10604eee16a3e41fc16b335a Mon Sep 17 00:00:00 2001 From: Robert Bradshaw Date: Sat, 13 Nov 2010 23:57:49 -0800 Subject: [PATCH] Test for inplace fix. --- tests/run/inplace.pyx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/run/inplace.pyx b/tests/run/inplace.pyx index a734913c..a5606f6a 100644 --- a/tests/run/inplace.pyx +++ b/tests/run/inplace.pyx @@ -244,3 +244,13 @@ def double_deref_and_increment(o, key1, key2): v __setitem__ a 11 """ o[side_effect(key1)][side_effect(key2)] += 1 + +def conditional_inplace(value, a, condition, b): + """ + >>> conditional_inplace([1, 2, 3], [100], True, [200]) + [1, 2, 3, 100] + >>> conditional_inplace([1, 2, 3], [100], False, [200]) + [1, 2, 3, 200] + """ + value += a if condition else b + return value -- 2.26.2