diff --git a/tests/py_test.py b/tests/py_test.py index 672dd3201..0947adfa3 100644 --- a/tests/py_test.py +++ b/tests/py_test.py @@ -15,7 +15,6 @@ import os.path import sys -import imp PY_VERSION = sys.version_info[:2] import ctypes @@ -695,7 +694,6 @@ def CheckReadBuffer(buf, offset, sizePrefix=False, file_identifier=None): ])) try: - imp.find_module('numpy') # if numpy exists, then we should be able to get the # vector as a numpy array import numpy as np @@ -1074,7 +1072,6 @@ class TestByteLayout(unittest.TestCase): def test_create_numpy_vector_int8(self): try: - imp.find_module('numpy') # if numpy exists, then we should be able to get the # vector as a numpy array import numpy as np @@ -1120,7 +1117,6 @@ class TestByteLayout(unittest.TestCase): def test_create_numpy_vector_uint16(self): try: - imp.find_module('numpy') # if numpy exists, then we should be able to get the # vector as a numpy array import numpy as np @@ -1174,7 +1170,6 @@ class TestByteLayout(unittest.TestCase): def test_create_numpy_vector_int64(self): try: - imp.find_module('numpy') # if numpy exists, then we should be able to get the # vector as a numpy array import numpy as np @@ -1261,7 +1256,6 @@ class TestByteLayout(unittest.TestCase): def test_create_numpy_vector_float32(self): try: - imp.find_module('numpy') # if numpy exists, then we should be able to get the # vector as a numpy array import numpy as np @@ -1324,7 +1318,6 @@ class TestByteLayout(unittest.TestCase): def test_create_numpy_vector_float64(self): try: - imp.find_module('numpy') # if numpy exists, then we should be able to get the # vector as a numpy array import numpy as np @@ -1411,7 +1404,6 @@ class TestByteLayout(unittest.TestCase): def test_create_numpy_vector_bool(self): try: - imp.find_module('numpy') # if numpy exists, then we should be able to get the # vector as a numpy array import numpy as np @@ -1458,7 +1450,6 @@ class TestByteLayout(unittest.TestCase): def test_create_numpy_vector_reject_strings(self): try: - imp.find_module('numpy') # if numpy exists, then we should be able to get the # vector as a numpy array import numpy as np @@ -1476,7 +1467,6 @@ class TestByteLayout(unittest.TestCase): def test_create_numpy_vector_reject_object(self): try: - imp.find_module('numpy') # if numpy exists, then we should be able to get the # vector as a numpy array import numpy as np @@ -2343,9 +2333,10 @@ class TestAllCodePathsOfExampleSchema(unittest.TestCase): self.assertEqual(2, mon2.Testnestedflatbuffer(1)) self.assertEqual(4, mon2.Testnestedflatbuffer(2)) try: - imp.find_module('numpy') # if numpy exists, then we should be able to get the # vector as a numpy array + import numpy as np + self.assertEqual([0, 2, 4], mon2.TestnestedflatbufferAsNumpy().tolist()) except ImportError: assertRaises(self, lambda: mon2.TestnestedflatbufferAsNumpy(),