@@ -97,11 +97,9 @@ def test_empty_like(x, dtype):
97
97
x_like = empty_like (x , ** kwargs )
98
98
99
99
if dtype is None :
100
- # TODO: Should it actually match a.dtype?
101
- # assert is_float_dtype(x_like.dtype), "empty_like() should produce an array with the default floating point dtype"
102
- pass
100
+ assert x_like .dtype == x .dtype , f"{ x .dtype = !s} , but empty_like() did not produce a { x .dtype } array - instead was { x_like .dtype } "
103
101
else :
104
- assert x_like .dtype == dtype , " empty_like() produced an array with an incorrect dtype"
102
+ assert x_like .dtype == dtype , f" { dtype = !s } , but empty_like() did not produce a { dtype } array - instead was { x_like . dtype } "
105
103
106
104
assert x_like .shape == x .shape , "empty_like() produced an array with an incorrect shape"
107
105
@@ -165,9 +163,9 @@ def test_full_like(x, fill_value, dtype):
165
163
x_like = full_like (x , fill_value , dtype = dtype )
166
164
167
165
if dtype is None :
168
- assert x_like .dtype == x .dtype , f"{ x .dtype = } , but full_like() did not produce a { x .dtype } array - instead was { x_like .dtype } "
166
+ assert x_like .dtype == x .dtype , f"{ x .dtype = !s } , but full_like() did not produce a { x .dtype } array - instead was { x_like .dtype } "
169
167
else :
170
- assert x_like .dtype == None , f"{ dtype = } , but full_like() did not produce a { dtype } array - instead was { x_like .dtype } "
168
+ assert x_like .dtype == dtype , f"{ dtype = !s } , but full_like() did not produce a { dtype } array - instead was { x_like .dtype } "
171
169
172
170
assert x_like .shape == x .shape , "full_like() produced an array with incorrect shape"
173
171
if is_float_dtype (x_like .dtype ) and isnan (asarray (fill_value )):
@@ -258,10 +256,9 @@ def test_ones_like(x, dtype):
258
256
x_like = ones_like (x , ** kwargs )
259
257
260
258
if dtype is None :
261
- # TODO: Should it actually match a.dtype?
262
- pass
259
+ assert x_like .dtype == x .dtype , f"{ x .dtype = !s} , but ones_like() did not produce a { x .dtype } array - instead was { x_like .dtype } "
263
260
else :
264
- assert x_like .dtype == dtype , " ones_like() produced an array with an incorrect dtype"
261
+ assert x_like .dtype == dtype , f" { dtype = !s } , but ones_like() did not produce a { dtype } array - instead was { x_like . dtype } "
265
262
266
263
assert x_like .shape == x .shape , "ones_like() produced an array with an incorrect shape"
267
264
assert all (equal (x_like , full ((), ONE , dtype = x_like .dtype ))), "ones_like() array did not equal 1"
@@ -306,10 +303,9 @@ def test_zeros_like(x, dtype):
306
303
x_like = zeros_like (x , ** kwargs )
307
304
308
305
if dtype is None :
309
- # TODO: Should it actually match a.dtype?
310
- pass
306
+ assert x_like .dtype == x .dtype , f"{ x .dtype = !s} , but zeros_like() did not produce a { x .dtype } array - instead was { x_like .dtype } "
311
307
else :
312
- assert x_like .dtype == dtype , " zeros_like() produced an array with an incorrect dtype"
308
+ assert x_like .dtype == dtype , f" { dtype = !s } , but zeros_like() did not produce a { dtype } array - instead was { x_like . dtype } "
313
309
314
310
assert x_like .shape == x .shape , "zeros_like() produced an array with an incorrect shape"
315
311
assert all (equal (x_like , full ((), ZERO , dtype = x_like .dtype ))), "zeros_like() array did not equal 0"
0 commit comments