From: Dag Sverre Seljebotn Date: Sun, 17 Aug 2008 23:08:25 +0000 (+0200) Subject: Some testcase cleanup. X-Git-Tag: 0.9.8.1~4^2 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=1edd3d9481e780aec2e341fa8ede1ae5ba31db08;p=cython.git Some testcase cleanup. Removed use of doctest directive. --- diff --git a/tests/run/bufaccess.pyx b/tests/run/bufaccess.pyx index 29ed6903..49d2a3b7 100644 --- a/tests/run/bufaccess.pyx +++ b/tests/run/bufaccess.pyx @@ -81,7 +81,6 @@ def acquire_raise(o): >>> A.printlog() acquired A released A - """ cdef object[int] buf @@ -443,7 +442,7 @@ def list_comprehension(object[int] buf, len): 1|2|3 """ cdef int i - print "|".join([str(buf[i]) for i in range(len)]) + print u"|".join([unicode(buf[i]) for i in range(len)]) # # Buffer type mismatch examples. Varying the type and access @@ -900,8 +899,6 @@ cdef class MockBuffer: suboffsets = [0] * (self.ndim-1) + [-1] strides = [sizeof(void*)] * (self.ndim-1) + [self.itemsize] self.suboffsets = self.list_to_sizebuf(suboffsets) - # printf("%ld; %ld %ld %ld %ld %ld", i0, s0, o0, i1, s1, o1); - else: # strided and/or simple access self.buffer = self.create_buffer(data) @@ -987,7 +984,7 @@ cdef class MockBuffer: self.log += msg + "\n" def printlog(self): - print self.log + print self.log[:-1] def resetlog(self): self.log = "" diff --git a/tests/run/tnumpy.pyx b/tests/run/tnumpy.pyx index 418981d4..a07fb6e1 100644 --- a/tests/run/tnumpy.pyx +++ b/tests/run/tnumpy.pyx @@ -14,10 +14,10 @@ try: >>> three_dim() [[[ 0. 1. 2. 3.] [ 4. 5. 6. 7.]] - + <_BLANKLINE_> [[ 8. 9. 10. 11.] [ 12. 13. 14. 15.]] - + <_BLANKLINE_> [[ 16. 17. 18. 19.] [ 20. 21. 22. 23.]]] 6.0 0.0 13.0 8.0 @@ -96,6 +96,7 @@ try: >>> test_dtype(np.long, inc1_long_t) >>> test_dtype(np.float, inc1_float_t) >>> test_dtype(np.double, inc1_double_t) + >>> test_dtype(np.longdouble, inc1_longdouble_t) >>> test_dtype(np.int32, inc1_int32_t) @@ -117,6 +118,13 @@ try: except: __doc__ = "" +def ndarray_str(arr): + """ + Since Py2.3 doctest don't support , manually replace blank lines + with <_BLANKLINE_> + """ + return str(arr).replace('\n\n', '\n<_BLANKLINE_>\n') + def basic(): cdef object[int, ndim=2] buf = np.arange(10, dtype='i').reshape((2, 5)) print buf @@ -124,7 +132,7 @@ def basic(): def three_dim(): cdef object[double, ndim=3] buf = np.arange(24, dtype='d').reshape((3,2,4)) - print buf + print ndarray_str(buf) print buf[0, 1, 2], buf[0, 0, 0], buf[1, 1, 1], buf[1, 0, 0] def obj_array():