From 3cf1d712b6468c4175f2b6b5347f77cf114ffdf7 Mon Sep 17 00:00:00 2001 From: Robert Bradshaw Date: Mon, 4 Oct 2010 21:02:55 -0700 Subject: [PATCH] Test for broken reference coercion - #581. --- tests/run/libcpp_all.pyx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/run/libcpp_all.pyx b/tests/run/libcpp_all.pyx index 8ab5192d..5eaf009e 100644 --- a/tests/run/libcpp_all.pyx +++ b/tests/run/libcpp_all.pyx @@ -53,3 +53,15 @@ cdef vector[int].iterator iv1 = v1.begin() cdef vector[int].iterator iv2 = v1.end() cdef vector[int].reverse_iterator riv1 = v1.rbegin() cdef vector[int].reverse_iterator riv2 = v1.rend() + +def test_vector_coercion(*args): + """ + >>> test_vector_coercion(1.75) + [1.75] + >>> test_vector_coercion(1, 10, 100) + [1.0, 10.0, 100.0] + """ + v = new vector[double]() + for a in args: + v.push_back(a) + return [v[0][i] for i in range(v.size())] -- 2.26.2