11"""These tests are based on the doctests from `numpy/lib/recfunctions.py`."""
22
3- from __future__ import annotations
4-
53from typing import TYPE_CHECKING , Any , assert_type
64
75import numpy as np
108if TYPE_CHECKING :
119 import _numtype as _nt
1210
11+ # ruff: noqa: S101
12+
1313
1414def test_recursive_fill_fields () -> None :
1515 a : _nt .Array [np .void ] = np .array (
1616 [(1 , 10.0 ), (2 , 20.0 )],
1717 dtype = [("A" , np .int64 ), ("B" , np .float64 )],
1818 )
19- b = np .zeros ((int ( 3 ) ,), dtype = a .dtype )
19+ b = np .zeros ((3 ,), dtype = a .dtype )
2020 out = rfn .recursive_fill_fields (a , b )
2121 assert_type (out , "_nt.Array1D[np.void]" )
2222
@@ -57,16 +57,16 @@ def test_get_fieldstructure() -> None:
5757def test_merge_arrays () -> None :
5858 assert_type (
5959 rfn .merge_arrays ((
60- np .ones ((int (2 ),), np .int_ ),
61- np .ones ((int (3 ),), np .float64 ),
60+ np .ones (((2 ),), np .int_ ),
61+ np .ones (((3 ),), np .float64 ),
6262 )),
6363 "np.recarray[_nt.Rank1, np.dtype[np.void]]" ,
6464 )
6565
6666
6767def test_drop_fields () -> None :
6868 ndtype = [("a" , np .int64 ), ("b" , [("b_a" , np .double ), ("b_b" , np .int64 )])]
69- a = np .ones ((int (3 ),), dtype = ndtype )
69+ a = np .ones (((3 ),), dtype = ndtype )
7070
7171 assert_type (rfn .drop_fields (a , "a" ), "_nt.Array1D[np.void]" )
7272 assert_type (
@@ -81,7 +81,7 @@ def test_drop_fields() -> None:
8181
8282def test_rename_fields () -> None :
8383 ndtype = [("a" , np .int64 ), ("b" , [("b_a" , np .double ), ("b_b" , np .int64 )])]
84- a = np .ones ((int (3 ),), dtype = ndtype )
84+ a = np .ones (((3 ),), dtype = ndtype )
8585
8686 assert_type (
8787 rfn .rename_fields (a , {"a" : "A" , "b_b" : "B_B" }),
@@ -130,11 +130,11 @@ def test_require_fields() -> None:
130130
131131
132132def test_stack_arrays () -> None :
133- x = np .zeros ((int (2 ),), np .int32 )
133+ x = np .zeros (((2 ),), np .int32 )
134134 assert_type (rfn .stack_arrays (x ), "_nt.Array1D[np.int32]" )
135135
136- z = np .ones ((int (2 ),), [("A" , "|S3" ), ("B" , float )])
137- zz = np .ones ((int (2 ),), [("A" , "|S3" ), ("B" , np .float64 ), ("C" , np .float64 )])
136+ z = np .ones (((2 ),), [("A" , "|S3" ), ("B" , float )])
137+ zz = np .ones (((2 ),), [("A" , "|S3" ), ("B" , np .float64 ), ("C" , np .float64 )])
138138 assert_type (rfn .stack_arrays ((z , zz )), "_nt.MArray[np.void]" )
139139
140140
0 commit comments