diff --git a/tests/test_helpers.py b/tests/test_helpers.py index 51cbc80..f92e876 100644 --- a/tests/test_helpers.py +++ b/tests/test_helpers.py @@ -3,14 +3,14 @@ import numpy as np from pytest import mark, raises -import cuvec +import cuvec as cu shape = 127, 344, 344 @mark.parametrize("spec,result", [("i", np.int32), ("d", np.float64)]) def test_zeros(spec, result): - a = np.asarray(cuvec.zeros(shape, spec)) + a = np.asarray(cu.zeros(shape, spec)) assert a.dtype == result assert a.shape == shape assert not a.any() @@ -18,7 +18,7 @@ def test_zeros(spec, result): def test_copy(): a = np.random.random(shape) - b = np.asarray(cuvec.copy(a)) + b = np.asarray(cu.copy(a)) assert a.shape == b.shape assert a.dtype == b.dtype assert (a == b).all() @@ -26,14 +26,14 @@ def test_copy(): def test_CuVec_creation(caplog): with raises(TypeError): - cuvec.CuVec() + cu.CuVec() with raises(NotImplementedError): - cuvec.CuVec(shape) + cu.CuVec(shape) caplog.set_level(logging.DEBUG) caplog.clear() - v = cuvec.CuVec(np.ones(shape, dtype='h')) + v = cu.CuVec(np.ones(shape, dtype='h')) assert [i[1:] for i in caplog.record_tuples] == [(10, 'copy'), (10, "wrap raw ")] assert v.shape == shape @@ -41,15 +41,15 @@ def test_CuVec_creation(caplog): assert (v == 1).all() caplog.clear() - v = cuvec.zeros(shape, 'd') + v = cu.zeros(shape, 'd') assert [i[1:] for i in caplog.record_tuples] == [(10, "wrap raw ")] caplog.clear() v[0, 0, 0] = 1 assert not caplog.record_tuples - w = cuvec.CuVec(v) + w = cu.CuVec(v) assert [i[1:] for i in caplog.record_tuples] == [(10, "new view")] - assert cuvec.asarray(w.cuvec).cuvec == w.cuvec + assert cu.asarray(w.cuvec).cuvec == w.cuvec caplog.clear() assert w[0, 0, 0] == 1 diff --git a/tests/test_pycuvec.py b/tests/test_pycuvec.py index 415f7c7..349dbf2 100644 --- a/tests/test_pycuvec.py +++ b/tests/test_pycuvec.py @@ -1,13 +1,13 @@ import numpy as np from pytest import mark -import cuvec +import cuvec as cu -@mark.parametrize("tp", list(cuvec.typecodes)) +@mark.parametrize("tp", list(cu.typecodes)) def test_Vector_asarray(tp): """tp(char): any of bBhHiIqQfd""" - v = getattr(cuvec.cuvec, f"Vector_{tp}")((1, 2, 3)) + v = getattr(cu.cuvec, f"Vector_{tp}")((1, 2, 3)) assert str(v) == f"Vector_{tp}((1, 2, 3))" a = np.asarray(v) assert not a.any() @@ -21,7 +21,7 @@ def test_Vector_asarray(tp): def test_Vector_strides(): shape = 127, 344, 344 - v = cuvec.cuvec.Vector_f(shape) + v = cu.cuvec.Vector_f(shape) a = np.asarray(v) assert a.shape == shape assert a.strides == (473344, 1376, 4)