Commit b734ecc0 authored by Robert Bradshaw's avatar Robert Bradshaw

merge

parents 940e168b b16fceca
......@@ -34,7 +34,7 @@ try:
[[ 16. 17. 18. 19.]
[ 20. 21. 22. 23.]]]
6.0 0.0 13.0 8.0
>>> obj_array()
[a 1 {}]
a 1 {}
......@@ -115,7 +115,7 @@ try:
Traceback (most recent call last):
...
ValueError: ndarray is not C contiguous
>>> test_dtype('b', inc1_byte)
>>> test_dtype('B', inc1_ubyte)
>>> test_dtype('h', inc1_short)
......@@ -124,7 +124,7 @@ try:
>>> test_dtype('I', inc1_uint)
>>> test_dtype('l', inc1_long)
>>> test_dtype('L', inc1_ulong)
>>> test_dtype('f', inc1_float)
>>> test_dtype('d', inc1_double)
>>> test_dtype('g', inc1_longdouble)
......@@ -154,16 +154,16 @@ try:
Traceback (most recent call last):
...
ValueError: Non-native byte order not supported
>>> test_recordarray()
>>> print(test_nested_dtypes(np.zeros((3,), dtype=np.dtype([\
('a', np.dtype('i,i')),\
('b', np.dtype('i,i'))\
]))))
array([((0, 0), (0, 0)), ((1, 2), (1, 4)), ((1, 2), (1, 4))],
array([((0, 0), (0, 0)), ((1, 2), (1, 4)), ((1, 2), (1, 4))],
dtype=[('a', [('f0', '!i4'), ('f1', '!i4')]), ('b', [('f0', '!i4'), ('f1', '!i4')])])
>>> print(test_nested_dtypes(np.zeros((3,), dtype=np.dtype([\
......@@ -175,10 +175,10 @@ try:
ValueError: Buffer dtype mismatch, expected 'int' but got 'float' in 'DoubleInt.y'
>>> print(test_packed_align(np.zeros((1,), dtype=np.dtype('b,i', align=False))))
array([(22, 23)],
array([(22, 23)],
dtype=[('f0', '|i1'), ('f1', '!i4')])
>>> print(test_unpacked_align(np.zeros((1,), dtype=np.dtype('b,i', align=True))))
array([(22, 23)],
array([(22, 23)],
dtype=[('f0', '|i1'), ('', '|V3'), ('f1', '!i4')])
>>> print(test_packed_align(np.zeros((1,), dtype=np.dtype('b,i', align=True))))
......@@ -205,9 +205,9 @@ try:
8,16
>>> test_point_record()
array([(0.0, 0.0), (1.0, -1.0), (2.0, -2.0)],
array([(0.0, 0.0), (1.0, -1.0), (2.0, -2.0)],
dtype=[('x', '!f8'), ('y', '!f8')])
"""
except:
__doc__ = u""
......@@ -232,7 +232,7 @@ def ndarray_str(arr):
Since Py2.3 doctest don't support <BLANKLINE>, manually replace blank lines
with <_BLANKLINE_>
"""
return unicode(arr).replace(u'\n\n', u'\n<_BLANKLINE_>\n')
return unicode(arr).replace(u'\n\n', u'\n<_BLANKLINE_>\n')
def basic():
cdef object[int, ndim=2] buf = np.arange(10, dtype=b'i').reshape((2, 5))
......@@ -295,7 +295,7 @@ def inc1_clongdouble(np.ndarray[long double complex] arr): arr[1] = arr[1] + (1
def inc1_cfloat_struct(np.ndarray[np.cfloat_t] arr):
arr[1].real += 1
arr[1].imag += 1
def inc1_cdouble_struct(np.ndarray[np.cdouble_t] arr):
arr[1].real += 1
arr[1].imag += 1
......@@ -324,7 +324,7 @@ def inc1_uintp_t(np.ndarray[np.uintp_t] arr): arr[1] += 1
def inc1_int32_t(np.ndarray[np.int32_t] arr): arr[1] += 1
def inc1_float64_t(np.ndarray[np.float64_t] arr): arr[1] += 1
def test_dtype(dtype, inc1):
if dtype in ("g", np.longdouble,
"G", np.clongdouble):
......@@ -407,7 +407,7 @@ def test_packed_align(np.ndarray[PackedStruct] arr):
def test_unpacked_align(np.ndarray[UnpackedStruct] arr):
arr[0].a = 22
arr[0].b = 23
arr[0].b = 23
return repr(arr).replace('<', '!').replace('>', '!')
def test_complextypes():
......
......@@ -3,7 +3,7 @@ __doc__ = u"""
... foo()
... except Exception, e:
... print("%s: %s" % (e.__class__.__name__, e))
ValueError:
ValueError:
>>> try:
... bar()
... except Exception, e:
......
......@@ -53,11 +53,11 @@ def split_sep(unicode s, sep):
>>> print_all( text.split(sep) )
ab jd
sdflk as sa
sadas asdas fsdf
sadas asdas fsdf
>>> print_all( split_sep(text, sep) )
ab jd
sdflk as sa
sadas asdas fsdf
sadas asdas fsdf
"""
return s.split(sep)
......@@ -71,10 +71,10 @@ def split_sep_max(unicode s, sep, max):
"""
>>> print_all( text.split(sep, 1) )
ab jd
sdflk as sa sadas asdas fsdf
sdflk as sa sadas asdas fsdf
>>> print_all( split_sep_max(text, sep, 1) )
ab jd
sdflk as sa sadas asdas fsdf
sdflk as sa sadas asdas fsdf
"""
return s.split(sep, max)
......@@ -87,10 +87,10 @@ def split_sep_max_int(unicode s, sep):
"""
>>> print_all( text.split(sep, 1) )
ab jd
sdflk as sa sadas asdas fsdf
sdflk as sa sadas asdas fsdf
>>> print_all( split_sep_max_int(text, sep) )
ab jd
sdflk as sa sadas asdas fsdf
sdflk as sa sadas asdas fsdf
"""
return s.split(sep, 1)
......@@ -106,13 +106,13 @@ def splitlines(unicode s):
>>> print_all( multiline_text.splitlines() )
ab jd
sdflk as sa
sadas asdas fsdf
sadas asdas fsdf
>>> len(splitlines(multiline_text))
3
>>> print_all( splitlines(multiline_text) )
ab jd
sdflk as sa
sadas asdas fsdf
sadas asdas fsdf
"""
return s.splitlines()
......@@ -127,7 +127,7 @@ def splitlines_keep(unicode s, keep):
<BLANKLINE>
sdflk as sa
<BLANKLINE>
sadas asdas fsdf
sadas asdas fsdf
>>> len(splitlines_keep(multiline_text, True))
3
>>> print_all( splitlines_keep(multiline_text, True) )
......@@ -135,7 +135,7 @@ def splitlines_keep(unicode s, keep):
<BLANKLINE>
sdflk as sa
<BLANKLINE>
sadas asdas fsdf
sadas asdas fsdf
"""
return s.splitlines(keep)
......@@ -153,11 +153,11 @@ def splitlines_keep_bint(unicode s):
<BLANKLINE>
sdflk as sa
<BLANKLINE>
sadas asdas fsdf
sadas asdas fsdf
>>> print_all( multiline_text.splitlines(False) )
ab jd
sdflk as sa
sadas asdas fsdf
sadas asdas fsdf
>>> len(splitlines_keep_bint(multiline_text))
7
>>> print_all( splitlines_keep_bint(multiline_text) )
......@@ -165,11 +165,11 @@ def splitlines_keep_bint(unicode s):
<BLANKLINE>
sdflk as sa
<BLANKLINE>
sadas asdas fsdf
sadas asdas fsdf
--
ab jd
sdflk as sa
sadas asdas fsdf
sadas asdas fsdf
"""
return s.splitlines(True) + ['--'] + s.splitlines(False)
......@@ -471,9 +471,9 @@ def count_start_end(unicode s, substring, start, end):
def replace(unicode s, substring, repl):
"""
>>> print( text.replace('sa', 'SA') )
ab jd sdflk as SA SAdas asdas fsdf
ab jd sdflk as SA SAdas asdas fsdf
>>> print( replace(text, 'sa', 'SA') )
ab jd sdflk as SA SAdas asdas fsdf
ab jd sdflk as SA SAdas asdas fsdf
"""
return s.replace(substring, repl)
......@@ -485,8 +485,8 @@ def replace(unicode s, substring, repl):
def replace_maxcount(unicode s, substring, repl, maxcount):
"""
>>> print( text.replace('sa', 'SA', 1) )
ab jd sdflk as SA sadas asdas fsdf
ab jd sdflk as SA sadas asdas fsdf
>>> print( replace_maxcount(text, 'sa', 'SA', 1) )
ab jd sdflk as SA sadas asdas fsdf
ab jd sdflk as SA sadas asdas fsdf
"""
return s.replace(substring, repl, maxcount)
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