summaryrefslogtreecommitdiff
path: root/numpy/tests
diff options
context:
space:
mode:
authorBas van Beek <b.f.van.beek@vu.nl>2020-10-10 14:20:42 +0200
committerBas van Beek <b.f.van.beek@vu.nl>2020-10-10 14:24:23 +0200
commita9edc0433e2efff6695c2d22a1cd0cad325556ae (patch)
tree9d0b4c6caeb13e440b8e55a0e1385ddc897dd236 /numpy/tests
parent907796d43f99e923f1c0dc4da1944b171ab546fd (diff)
downloadnumpy-a9edc0433e2efff6695c2d22a1cd0cad325556ae.tar.gz
TST: Updated the `ctypeslib.load_library` tests
Diffstat (limited to 'numpy/tests')
-rw-r--r--numpy/tests/test_ctypeslib.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/numpy/tests/test_ctypeslib.py b/numpy/tests/test_ctypeslib.py
index af3730df1..1ea083700 100644
--- a/numpy/tests/test_ctypeslib.py
+++ b/numpy/tests/test_ctypeslib.py
@@ -1,6 +1,7 @@
import sys
import pytest
import weakref
+from pathlib import Path
import numpy as np
from numpy.ctypeslib import ndpointer, load_library, as_array
@@ -37,13 +38,15 @@ else:
reason="Known to fail on cygwin")
class TestLoadLibrary:
def test_basic(self):
- try:
- # Should succeed
- load_library('_multiarray_umath', np.core._multiarray_umath.__file__)
- except ImportError as e:
- msg = ("ctypes is not available on this python: skipping the test"
- " (import error was: %s)" % str(e))
- print(msg)
+ loader_path = np.core._multiarray_umath.__file__
+
+ out1 = load_library('_multiarray_umath', loader_path)
+ out2 = load_library(Path('_multiarray_umath'), loader_path)
+ out3 = load_library('_multiarray_umath', Path(loader_path))
+ out4 = load_library(b'_multiarray_umath', loader_path)
+
+ assert isinstance(out1, ctypes.CDLL)
+ assert out1 is out2 is out3 is out4
def test_basic2(self):
# Regression for #801: load_library with a full library name