31
31
logical_or , logical_and , inrange , π , one , zero ,
32
32
infinity , full , isnegzero , isnegative , any as
33
33
array_any , int_to_dtype , bool as bool_dtype )
34
- from .test_type_promotion import dtype_nbits , dtype_signed
35
34
36
35
from . import _array_module
37
36
@@ -62,64 +61,6 @@ def sanity_check(x1, x2):
62
61
if (t1 , t2 ) not in promotion_table :
63
62
raise RuntimeError ("Error in test generation (probably a bug in the test suite" )
64
63
65
- input_types = {
66
- 'abs' : 'numeric' ,
67
- 'acos' : 'floating' ,
68
- 'acosh' : 'floating' ,
69
- 'add' : 'numeric' ,
70
- 'asin' : 'floating' ,
71
- 'asinh' : 'floating' ,
72
- 'atan' : 'floating' ,
73
- 'atan2' : 'floating' ,
74
- 'atanh' : 'floating' ,
75
- 'bitwise_and' : 'integer_or_boolean' ,
76
- 'bitwise_invert' : 'integer_or_boolean' ,
77
- 'bitwise_left_shift' : 'integer' ,
78
- 'bitwise_or' : 'integer_or_boolean' ,
79
- 'bitwise_right_shift' : 'integer' ,
80
- 'bitwise_xor' : 'integer_or_boolean' ,
81
- 'ceil' : 'numeric' ,
82
- 'cos' : 'floating' ,
83
- 'cosh' : 'floating' ,
84
- 'divide' : 'floating' ,
85
- 'equal' : 'any' ,
86
- 'exp' : 'floating' ,
87
- 'expm1' : 'floating' ,
88
- 'floor' : 'numeric' ,
89
- 'floor_divide' : 'numeric' ,
90
- 'greater' : 'numeric' ,
91
- 'greater_equal' : 'numeric' ,
92
- 'isfinite' : 'numeric' ,
93
- 'isinf' : 'numeric' ,
94
- 'isnan' : 'numeric' ,
95
- 'less' : 'numeric' ,
96
- 'less_equal' : 'numeric' ,
97
- 'log' : 'floating' ,
98
- 'log10' : 'floating' ,
99
- 'log1p' : 'floating' ,
100
- 'log2' : 'floating' ,
101
- 'logical_and' : 'boolean' ,
102
- 'logical_not' : 'boolean' ,
103
- 'logical_or' : 'boolean' ,
104
- 'logical_xor' : 'boolean' ,
105
- 'multiply' : 'numeric' ,
106
- 'negative' : 'numeric' ,
107
- 'not_equal' : 'any' ,
108
- 'positive' : 'numeric' ,
109
- 'pow' : 'floating' ,
110
- 'remainder' : 'numeric' ,
111
- 'round' : 'numeric' ,
112
- 'sign' : 'numeric' ,
113
- 'sin' : 'floating' ,
114
- 'sinh' : 'floating' ,
115
- 'sqrt' : 'floating' ,
116
- 'square' : 'numeric' ,
117
- 'subtract' : 'numeric' ,
118
- 'tan' : 'floating' ,
119
- 'tanh' : 'floating' ,
120
- 'trunc' : 'numeric' ,
121
- }
122
-
123
64
@given (numeric_scalars )
124
65
def test_abs (x ):
125
66
a = _array_module .abs (x )
@@ -248,6 +189,7 @@ def test_atanh(x):
248
189
249
190
@given (two_integer_or_boolean_dtypes .flatmap (lambda i : two_array_scalars (* i )))
250
191
def test_bitwise_and (args ):
192
+ from .test_type_promotion import dtype_nbits , dtype_signed
251
193
x1 , x2 = args
252
194
sanity_check (x1 , x2 )
253
195
a = _array_module .bitwise_and (x1 , x2 )
@@ -266,6 +208,7 @@ def test_bitwise_and(args):
266
208
267
209
@given (two_integer_dtypes .flatmap (lambda i : two_array_scalars (* i )))
268
210
def test_bitwise_left_shift (args ):
211
+ from .test_type_promotion import dtype_nbits , dtype_signed
269
212
x1 , x2 = args
270
213
sanity_check (x1 , x2 )
271
214
negative_x2 = isnegative (x2 )
@@ -289,6 +232,7 @@ def test_bitwise_left_shift(args):
289
232
290
233
@given (integer_or_boolean_scalars )
291
234
def test_bitwise_invert (x ):
235
+ from .test_type_promotion import dtype_nbits , dtype_signed
292
236
a = _array_module .bitwise_invert (x )
293
237
# Compare against the Python ~ operator.
294
238
# TODO: Generalize this properly for inputs that are arrays.
@@ -304,6 +248,7 @@ def test_bitwise_invert(x):
304
248
305
249
@given (two_integer_or_boolean_dtypes .flatmap (lambda i : two_array_scalars (* i )))
306
250
def test_bitwise_or (args ):
251
+ from .test_type_promotion import dtype_nbits , dtype_signed
307
252
x1 , x2 = args
308
253
sanity_check (x1 , x2 )
309
254
a = _array_module .bitwise_or (x1 , x2 )
@@ -322,6 +267,7 @@ def test_bitwise_or(args):
322
267
323
268
@given (two_integer_dtypes .flatmap (lambda i : two_array_scalars (* i )))
324
269
def test_bitwise_right_shift (args ):
270
+ from .test_type_promotion import dtype_nbits , dtype_signed
325
271
x1 , x2 = args
326
272
sanity_check (x1 , x2 )
327
273
negative_x2 = isnegative (x2 )
@@ -340,6 +286,7 @@ def test_bitwise_right_shift(args):
340
286
341
287
@given (two_integer_or_boolean_dtypes .flatmap (lambda i : two_array_scalars (* i )))
342
288
def test_bitwise_xor (args ):
289
+ from .test_type_promotion import dtype_nbits , dtype_signed
343
290
x1 , x2 = args
344
291
sanity_check (x1 , x2 )
345
292
a = _array_module .bitwise_xor (x1 , x2 )
0 commit comments