Skip to content

Commit 18aa715

Browse files
committed
fix numpy imports
1 parent 61ffa3a commit 18aa715

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

tests/unit/v1/converters/test_type_converter.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""Unit tests for the type converter module."""
22

3+
import numpy as np
34
import pytest
4-
from numpy import dtype as np_dtype
55

66
from mdio.converters.type_converter import to_numpy_dtype
77
from mdio.converters.type_converter import to_scalar_type
@@ -58,34 +58,34 @@ def test_to_numpy_dtype(supported_scalar_types_map: tuple[ScalarType, str], a_st
5858
# Test 1: ScalarType cases - all supported scalar types
5959
for scalar_type, expected_numpy_type in supported_scalar_types_map:
6060
result = to_numpy_dtype(scalar_type)
61-
expected = np_dtype(expected_numpy_type)
61+
expected = np.dtype(expected_numpy_type)
6262
assert result == expected
63-
assert isinstance(result, np_dtype)
63+
assert isinstance(result, np.dtype)
6464
assert result.name == expected.name
6565

6666
# Test 2: StructuredType with multiple fields
6767
result_multi = to_numpy_dtype(a_structured_type)
68-
expected_multi = np_dtype(
68+
expected_multi = np.dtype(
6969
[("x", "float64"), ("y", "float64"), ("z", "float64"), ("id", "int32"), ("valid", "bool")]
7070
)
7171

7272
assert result_multi == expected_multi
73-
assert isinstance(result_multi, np_dtype)
73+
assert isinstance(result_multi, np.dtype)
7474
assert len(result_multi.names) == 5
7575
assert set(result_multi.names) == {"x", "y", "z", "id", "valid"}
7676

7777

7878
def test_to_scalar_type(supported_scalar_types_map: tuple[ScalarType, str]) -> None:
7979
"""Test for to_scalar_type function."""
8080
for expected_mdio_type, numpy_type in supported_scalar_types_map:
81-
result = to_scalar_type(np_dtype(numpy_type))
81+
result = to_scalar_type(np.dtype(numpy_type))
8282
assert result == expected_mdio_type
8383

8484

8585
def test_to_structured_type(a_structured_type: StructuredType) -> None:
8686
"""Test for to_structured_type function."""
87-
dtype = np_dtype([("x", "float64"), ("y", "float64"), ("z", "float64"), ("id", "int32"), ("valid", "bool")])
87+
dtype = np.dtype([("x", "float64"), ("y", "float64"), ("z", "float64"), ("id", "int32"), ("valid", "bool")])
8888
assert a_structured_type == to_structured_type(dtype)
8989

90-
dtype = np_dtype([("x", "<f8"), ("y", "<f8"), ("z", "<f8"), ("id", "<i4"), ("valid", "?")])
90+
dtype = np.dtype([("x", "<f8"), ("y", "<f8"), ("z", "<f8"), ("id", "<i4"), ("valid", "?")])
9191
assert a_structured_type == to_structured_type(dtype)

0 commit comments

Comments
 (0)