Commit 1edd3d94 authored by Dag Sverre Seljebotn's avatar Dag Sverre Seljebotn

Some testcase cleanup.

Removed use of <BLANKLINE> doctest directive.
parent 43b10334
...@@ -81,7 +81,6 @@ def acquire_raise(o): ...@@ -81,7 +81,6 @@ def acquire_raise(o):
>>> A.printlog() >>> A.printlog()
acquired A acquired A
released A released A
<BLANKLINE>
""" """
cdef object[int] buf cdef object[int] buf
...@@ -443,7 +442,7 @@ def list_comprehension(object[int] buf, len): ...@@ -443,7 +442,7 @@ def list_comprehension(object[int] buf, len):
1|2|3 1|2|3
""" """
cdef int i 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 # Buffer type mismatch examples. Varying the type and access
...@@ -900,8 +899,6 @@ cdef class MockBuffer: ...@@ -900,8 +899,6 @@ cdef class MockBuffer:
suboffsets = [0] * (self.ndim-1) + [-1] suboffsets = [0] * (self.ndim-1) + [-1]
strides = [sizeof(void*)] * (self.ndim-1) + [self.itemsize] strides = [sizeof(void*)] * (self.ndim-1) + [self.itemsize]
self.suboffsets = self.list_to_sizebuf(suboffsets) self.suboffsets = self.list_to_sizebuf(suboffsets)
# printf("%ld; %ld %ld %ld %ld %ld", i0, s0, o0, i1, s1, o1);
else: else:
# strided and/or simple access # strided and/or simple access
self.buffer = self.create_buffer(data) self.buffer = self.create_buffer(data)
...@@ -987,7 +984,7 @@ cdef class MockBuffer: ...@@ -987,7 +984,7 @@ cdef class MockBuffer:
self.log += msg + "\n" self.log += msg + "\n"
def printlog(self): def printlog(self):
print self.log print self.log[:-1]
def resetlog(self): def resetlog(self):
self.log = "" self.log = ""
......
...@@ -14,10 +14,10 @@ try: ...@@ -14,10 +14,10 @@ try:
>>> three_dim() >>> three_dim()
[[[ 0. 1. 2. 3.] [[[ 0. 1. 2. 3.]
[ 4. 5. 6. 7.]] [ 4. 5. 6. 7.]]
<BLANKLINE> <_BLANKLINE_>
[[ 8. 9. 10. 11.] [[ 8. 9. 10. 11.]
[ 12. 13. 14. 15.]] [ 12. 13. 14. 15.]]
<BLANKLINE> <_BLANKLINE_>
[[ 16. 17. 18. 19.] [[ 16. 17. 18. 19.]
[ 20. 21. 22. 23.]]] [ 20. 21. 22. 23.]]]
6.0 0.0 13.0 8.0 6.0 0.0 13.0 8.0
...@@ -96,6 +96,7 @@ try: ...@@ -96,6 +96,7 @@ try:
>>> test_dtype(np.long, inc1_long_t) >>> test_dtype(np.long, inc1_long_t)
>>> test_dtype(np.float, inc1_float_t) >>> test_dtype(np.float, inc1_float_t)
>>> test_dtype(np.double, inc1_double_t) >>> test_dtype(np.double, inc1_double_t)
>>> test_dtype(np.longdouble, inc1_longdouble_t) >>> test_dtype(np.longdouble, inc1_longdouble_t)
>>> test_dtype(np.int32, inc1_int32_t) >>> test_dtype(np.int32, inc1_int32_t)
...@@ -117,6 +118,13 @@ try: ...@@ -117,6 +118,13 @@ try:
except: except:
__doc__ = "" __doc__ = ""
def ndarray_str(arr):
"""
Since Py2.3 doctest don't support <BLANKLINE>, manually replace blank lines
with <_BLANKLINE_>
"""
return str(arr).replace('\n\n', '\n<_BLANKLINE_>\n')
def basic(): def basic():
cdef object[int, ndim=2] buf = np.arange(10, dtype='i').reshape((2, 5)) cdef object[int, ndim=2] buf = np.arange(10, dtype='i').reshape((2, 5))
print buf print buf
...@@ -124,7 +132,7 @@ def basic(): ...@@ -124,7 +132,7 @@ def basic():
def three_dim(): def three_dim():
cdef object[double, ndim=3] buf = np.arange(24, dtype='d').reshape((3,2,4)) 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] print buf[0, 1, 2], buf[0, 0, 0], buf[1, 1, 1], buf[1, 0, 0]
def obj_array(): def obj_array():
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment