From: Pauli Virtanen Date: Mon, 4 Apr 2011 08:40:53 +0000 (+0200) Subject: TST: numpy_test: run some of the buffer tests only when a sufficiently new Numpy... X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=fcd59a76dd679feda9c24c75cf21c78ea4a0cbb7;p=cython.git TST: numpy_test: run some of the buffer tests only when a sufficiently new Numpy version is available --- diff --git a/tests/run/numpy_test.pyx b/tests/run/numpy_test.pyx index c340c1ca..3886e13d 100644 --- a/tests/run/numpy_test.pyx +++ b/tests/run/numpy_test.pyx @@ -193,27 +193,6 @@ try: ValueError: ... - The following expose bugs in Numpy (versions prior to 2011-04-02): - - >>> print(test_partially_packed_align(np.zeros((1,), dtype=np.dtype([('a', 'b'), ('b', 'i'), ('sub', np.dtype('b,i')), ('c', 'i')], align=True)))) - array([(22, 23, (24, 25), 26)], - dtype=[('a', '|i1'), ('', '|V3'), ('b', '!i4'), ('sub', [('f0', '|i1'), ('f1', '!i4')]), ('', '|V3'), ('c', '!i4')]) - - >>> print(test_partially_packed_align_2(np.zeros((1,), dtype=np.dtype([('a', 'b'), ('b', 'i'), ('c', 'b'), ('sub', np.dtype('b,i', align=True))])))) - array([(22, 23, 24, (27, 28))], - dtype=[('a', '|i1'), ('b', '!i4'), ('c', '|i1'), ('sub', [('f0', '|i1'), ('', '|V3'), ('f1', '!i4')])]) - - >>> print(test_partially_packed_align(np.zeros((1,), dtype=np.dtype([('a', 'b'), ('b', 'i'), ('sub', np.dtype('b,i')), ('c', 'i')], align=False)))) #doctest: +ELLIPSIS - Traceback (most recent call last): - ... - ValueError: ... - - >>> print(test_partially_packed_align_2(np.zeros((1,), dtype=np.dtype([('a', 'b'), ('b', 'i'), ('c', 'b'), ('sub', np.dtype('b,i', align=False))])))) #doctest: +ELLIPSIS - Traceback (most recent call last): - ... - ValueError: ... - - >>> test_good_cast() True >>> test_bad_cast() @@ -231,6 +210,30 @@ try: dtype=[('x', '!f8'), ('y', '!f8')]) """ + + if np.__version__ >= '1.6': + __doc__ += u""" + The following expose bugs in Numpy (versions prior to 2011-04-02): + + >>> print(test_partially_packed_align(np.zeros((1,), dtype=np.dtype([('a', 'b'), ('b', 'i'), ('sub', np.dtype('b,i')), ('c', 'i')], align=True)))) + array([(22, 23, (24, 25), 26)], + dtype=[('a', '|i1'), ('', '|V3'), ('b', '!i4'), ('sub', [('f0', '|i1'), ('f1', '!i4')]), ('', '|V3'), ('c', '!i4')]) + + >>> print(test_partially_packed_align_2(np.zeros((1,), dtype=np.dtype([('a', 'b'), ('b', 'i'), ('c', 'b'), ('sub', np.dtype('b,i', align=True))])))) + array([(22, 23, 24, (27, 28))], + dtype=[('a', '|i1'), ('b', '!i4'), ('c', '|i1'), ('sub', [('f0', '|i1'), ('', '|V3'), ('f1', '!i4')])]) + + >>> print(test_partially_packed_align(np.zeros((1,), dtype=np.dtype([('a', 'b'), ('b', 'i'), ('sub', np.dtype('b,i')), ('c', 'i')], align=False)))) #doctest: +ELLIPSIS + Traceback (most recent call last): + ... + ValueError: ... + + >>> print(test_partially_packed_align_2(np.zeros((1,), dtype=np.dtype([('a', 'b'), ('b', 'i'), ('c', 'b'), ('sub', np.dtype('b,i', align=False))])))) #doctest: +ELLIPSIS + Traceback (most recent call last): + ... + ValueError: ... + """ + except: __doc__ = u""