Commit cccfa3de authored by Stefan Behnel's avatar Stefan Behnel

Skip numpy inline test rather than discarding it if numpy is not installed.

parent 10c2fa4f
import os, tempfile import os
import tempfile
import unittest
from Cython.Shadow import inline from Cython.Shadow import inline
from Cython.Build.Inline import safe_type from Cython.Build.Inline import safe_type
from Cython.TestUtils import CythonTest from Cython.TestUtils import CythonTest
...@@ -86,11 +88,10 @@ class TestInline(CythonTest): ...@@ -86,11 +88,10 @@ class TestInline(CythonTest):
2.5 2.5
) )
if has_numpy: @unittest.skipIf(not has_numpy, "NumPy is not available")
def test_numpy(self):
def test_numpy(self): import numpy
import numpy a = numpy.ndarray((10, 20))
a = numpy.ndarray((10, 20)) a[0,0] = 10
a[0,0] = 10 self.assertEqual(safe_type(a), 'numpy.ndarray[numpy.float64_t, ndim=2]')
self.assertEqual(safe_type(a), 'numpy.ndarray[numpy.float64_t, ndim=2]') self.assertEqual(inline("return a[0,0]", a=a, **self.test_kwds), 10.0)
self.assertEqual(inline("return a[0,0]", a=a, **self.test_kwds), 10.0)
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