8
8
"""
9
9
10
10
from ..array_helpers import (NaN , assert_exactly_equal , exactly_equal , greater , infinity , isfinite ,
11
- isintegral , isodd , less , logical_and , logical_not , one , zero )
11
+ isintegral , isodd , less , logical_and , logical_not , notequal , one , zero )
12
12
from ..hypothesis_helpers import numeric_arrays
13
13
from .._array_module import pow
14
14
@@ -37,7 +37,7 @@ def test_pow_special_cases_two_args_even_if_1(arg1, arg2):
37
37
38
38
"""
39
39
res = pow (arg1 , arg2 )
40
- mask = exactly_equal (arg1 , zero (arg1 .shape , arg1 .dtype ))
40
+ mask = exactly_equal (arg2 , zero (arg2 .shape , arg2 .dtype ))
41
41
assert_exactly_equal (res [mask ], (one (arg1 .shape , arg1 .dtype ))[mask ])
42
42
43
43
@@ -50,7 +50,7 @@ def test_pow_special_cases_two_args_even_if_2(arg1, arg2):
50
50
51
51
"""
52
52
res = pow (arg1 , arg2 )
53
- mask = exactly_equal (arg1 , - zero (arg1 .shape , arg1 .dtype ))
53
+ mask = exactly_equal (arg2 , - zero (arg2 .shape , arg2 .dtype ))
54
54
assert_exactly_equal (res [mask ], (one (arg1 .shape , arg1 .dtype ))[mask ])
55
55
56
56
@@ -63,7 +63,7 @@ def test_pow_special_cases_two_args_equal__notequal_1(arg1, arg2):
63
63
64
64
"""
65
65
res = pow (arg1 , arg2 )
66
- mask = logical_and (exactly_equal (arg1 , NaN (arg1 .shape , arg1 .dtype )), logical_not ( exactly_equal ( arg2 , zero (arg2 .shape , arg2 .dtype ) )))
66
+ mask = logical_and (exactly_equal (arg1 , NaN (arg1 .shape , arg1 .dtype )), notequal ( arg2 , zero (arg2 .shape , arg2 .dtype )))
67
67
assert_exactly_equal (res [mask ], (NaN (arg1 .shape , arg1 .dtype ))[mask ])
68
68
69
69
@@ -173,19 +173,6 @@ def test_pow_special_cases_two_args_equal__greater_1(arg1, arg2):
173
173
174
174
@given (numeric_arrays , numeric_arrays )
175
175
def test_pow_special_cases_two_args_equal__greater_2 (arg1 , arg2 ):
176
- """
177
- Special case test for `pow(x1, x2)`:
178
-
179
- - If `x1_i` is `-infinity` and `x2_i` is greater than `0`, the result is `-infinity`.
180
-
181
- """
182
- res = pow (arg1 , arg2 )
183
- mask = logical_and (exactly_equal (arg1 , - infinity (arg1 .shape , arg1 .dtype )), greater (arg2 , zero (arg2 .shape , arg2 .dtype )))
184
- assert_exactly_equal (res [mask ], (- infinity (arg1 .shape , arg1 .dtype ))[mask ])
185
-
186
-
187
- @given (numeric_arrays , numeric_arrays )
188
- def test_pow_special_cases_two_args_equal__greater_3 (arg1 , arg2 ):
189
176
"""
190
177
Special case test for `pow(x1, x2)`:
191
178
@@ -223,6 +210,32 @@ def test_pow_special_cases_two_args_equal__less_2(arg1, arg2):
223
210
assert_exactly_equal (res [mask ], (infinity (arg1 .shape , arg1 .dtype ))[mask ])
224
211
225
212
213
+ @given (numeric_arrays , numeric_arrays )
214
+ def test_pow_special_cases_two_args_equal__greater_equal_1 (arg1 , arg2 ):
215
+ """
216
+ Special case test for `pow(x1, x2)`:
217
+
218
+ - If `x1_i` is `-infinity`, `x2_i` is greater than `0`, and `x2_i` is an odd integer value, the result is `-infinity`.
219
+
220
+ """
221
+ res = pow (arg1 , arg2 )
222
+ mask = logical_and (exactly_equal (arg1 , - infinity (arg1 .shape , arg1 .dtype )), logical_and (greater (arg2 , zero (arg2 .shape , arg2 .dtype )), isodd (arg2 )))
223
+ assert_exactly_equal (res [mask ], (- infinity (arg1 .shape , arg1 .dtype ))[mask ])
224
+
225
+
226
+ @given (numeric_arrays , numeric_arrays )
227
+ def test_pow_special_cases_two_args_equal__greater_equal_2 (arg1 , arg2 ):
228
+ """
229
+ Special case test for `pow(x1, x2)`:
230
+
231
+ - If `x1_i` is `-0`, `x2_i` is greater than `0`, and `x2_i` is an odd integer value, the result is `-0`.
232
+
233
+ """
234
+ res = pow (arg1 , arg2 )
235
+ mask = logical_and (exactly_equal (arg1 , - zero (arg1 .shape , arg1 .dtype )), logical_and (greater (arg2 , zero (arg2 .shape , arg2 .dtype )), isodd (arg2 )))
236
+ assert_exactly_equal (res [mask ], (- zero (arg1 .shape , arg1 .dtype ))[mask ])
237
+
238
+
226
239
@given (numeric_arrays , numeric_arrays )
227
240
def test_pow_special_cases_two_args_equal__greater_notequal_1 (arg1 , arg2 ):
228
241
"""
@@ -301,19 +314,6 @@ def test_pow_special_cases_two_args_equal__less_notequal_2(arg1, arg2):
301
314
assert_exactly_equal (res [mask ], (infinity (arg1 .shape , arg1 .dtype ))[mask ])
302
315
303
316
304
- @given (numeric_arrays , numeric_arrays )
305
- def test_pow_special_cases_two_args_equal__greater_equal (arg1 , arg2 ):
306
- """
307
- Special case test for `pow(x1, x2)`:
308
-
309
- - If `x1_i` is `-0`, `x2_i` is greater than `0`, and `x2_i` is an odd integer value, the result is `-0`.
310
-
311
- """
312
- res = pow (arg1 , arg2 )
313
- mask = logical_and (exactly_equal (arg1 , - zero (arg1 .shape , arg1 .dtype )), logical_and (greater (arg2 , zero (arg2 .shape , arg2 .dtype )), isodd (arg2 )))
314
- assert_exactly_equal (res [mask ], (- zero (arg1 .shape , arg1 .dtype ))[mask ])
315
-
316
-
317
317
@given (numeric_arrays , numeric_arrays )
318
318
def test_pow_special_cases_two_args_less_equal__equal_notequal (arg1 , arg2 ):
319
319
"""
0 commit comments