Commit b16fceca authored by Robert Bradshaw's avatar Robert Bradshaw

Put back trailing whitespace in doctest output.

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