From c3d65de3a99aa9db3453a8b3161a69c201396ca1 Mon Sep 17 00:00:00 2001 From: Robert Bradshaw Date: Wed, 11 Feb 2009 13:16:53 -0800 Subject: [PATCH] extend size_t test --- tests/run/size_t.pyx | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tests/run/size_t.pyx b/tests/run/size_t.pyx index 55001e21..70324328 100644 --- a/tests/run/size_t.pyx +++ b/tests/run/size_t.pyx @@ -17,7 +17,35 @@ OverflowError: ... Traceback (most recent call last): ... OverflowError: ... + +>>> a = A(1,2) +>>> a.a == 1 +True +>>> a.b == 2 +True +>>> a.foo(5) +5 +>>> a.foo(-1) #doctest: +ELLIPSIS +Traceback (most recent call last): + ... +OverflowError: ... +>>> a.foo(1 << 180) #doctest: +ELLIPSIS +Traceback (most recent call last): + ... +OverflowError: ... """ def test(size_t i): return i + +cdef class A: + cdef public size_t a + cdef readonly size_t b + + def __init__(self, size_t a, object b): + self.a = a + self.b = b + + cpdef size_t foo(self, size_t x): + cdef object o = x + return o -- 2.26.2