66 _zeros_check ,
77 data_checker ,
88)
9- from numpy .testing import assert_allclose , assert_equal
10-
11- eps = 1e-6
9+ from numpy .testing import assert_equal
1210
1311
1412def test_naninfs_check1 ():
@@ -36,7 +34,7 @@ def test_naninfs_check1_numpy():
3634
3735
3836def test_naninfs_check2 ():
39- _data_input = cp .ones (shape = (10 , 10 , 10 ), dtype = cp .float32 ) * 100
37+ _data_input = cp .ones (shape = (10 , 10 , 10 )). astype ( cp .float32 ) * 100
4038 _data_input [1 , 1 , 1 ] = - cp .inf
4139 _data_input [1 , 1 , 2 ] = cp .inf
4240 _data_input [1 , 1 , 3 ] = cp .nan
@@ -82,7 +80,7 @@ def test_naninfs_check2_numpy():
8280
8381
8482def test_naninfs_check3 ():
85- _data_input = cp .ones (shape = (10 , 10 , 10 ), dtype = cp .uint16 ) * 100
83+ _data_input = cp .ones (shape = (10 , 10 , 10 )). astype ( cp .uint16 ) * 100
8684 _data_output = _naninfs_check (_data_input .copy ())
8785
8886 assert _data_output .dtype == _data_input .dtype
@@ -97,8 +95,16 @@ def test_naninfs_check3_numpy():
9795 assert _data_output .shape == (10 , 10 , 10 )
9896
9997
98+ def test_naninfs_check4_numpy ():
99+ _data_input = np .ones (shape = (10 , 10 , 10 ), dtype = np .uint8 ) * 100
100+ _data_output = _naninfs_check (_data_input .copy ())
101+
102+ assert _data_output .dtype == _data_input .dtype
103+ assert _data_output .shape == (10 , 10 , 10 )
104+
105+
100106def test_zeros_check1 ():
101- _data_input = cp .ones (shape = (10 , 10 , 10 ), dtype = cp .float32 ) * 100
107+ _data_input = cp .ones (shape = (10 , 10 , 10 )). astype ( cp .float32 ) * 100
102108 warning_zeros = _zeros_check (_data_input .copy ())
103109
104110 assert warning_zeros == False
@@ -112,7 +118,7 @@ def test_zeros_check1_numpy():
112118
113119
114120def test_zeros_check2 ():
115- _data_input = cp .ones (shape = (10 , 10 , 10 ), dtype = cp .float32 ) * 100
121+ _data_input = cp .ones (shape = (10 , 10 , 10 )). astype ( cp .float32 ) * 100
116122 _data_input [2 :7 , :, :] = 0.0
117123 warning_zeros = _zeros_check (_data_input .copy ())
118124
@@ -128,7 +134,7 @@ def test_zeros_check2_numpy():
128134
129135
130136def test_zeros_check3 ():
131- _data_input = cp .ones (shape = (10 , 10 , 10 ), dtype = cp .float32 ) * 100
137+ _data_input = cp .ones (shape = (10 , 10 , 10 )). astype ( cp .float32 ) * 100
132138 _data_input [3 :7 , :, :] = 0.0
133139 warning_zeros = _zeros_check (_data_input .copy ())
134140
@@ -144,7 +150,7 @@ def test_zeros_check3_numpy():
144150
145151
146152def test_data_checker_numpy ():
147- _data_input = np .ones (shape = (10 , 10 , 10 ), dtype = np .float32 )
153+ _data_input = np .ones (shape = (10 , 10 , 10 )). astype ( np .float32 )
148154 _data_input [1 , 1 , 1 ] = - np .inf
149155 _data_input [1 , 1 , 2 ] = np .inf
150156 _data_input [1 , 1 , 3 ] = np .nan
@@ -166,8 +172,9 @@ def test_data_checker_numpy():
166172 assert _data_output .dtype == _data_input .dtype
167173 assert _data_output .shape == (10 , 10 , 10 )
168174
175+
169176def test_data_checker ():
170- _data_input = cp .ones (shape = (10 , 10 , 10 )).astype (cp .float32 ) * 100.0
177+ _data_input = cp .ones (shape = (10 , 10 , 10 )).astype (cp .float32 ) * 100.0
171178 _data_input [1 , 1 , 1 ] = - cp .inf
172179 _data_input [1 , 1 , 2 ] = cp .inf
173180 _data_input [1 , 1 , 3 ] = cp .nan
@@ -187,4 +194,4 @@ def test_data_checker():
187194 0.0 ,
188195 )
189196 assert _data_output .dtype == _data_input .dtype
190- assert _data_output .shape == (10 , 10 , 10 )
197+ assert _data_output .shape == (10 , 10 , 10 )
0 commit comments