class TestUfunc: (source)
Undocumented
Try to check presence and results of all ufuncs. The list of ufuncs comes from generate_umath.py and is as follows: ===== ==== ============= =============== ======================== done args function types notes ===== ==== ============= =============== ======================== n 1 conjugate nums + O n 1 absolute nums + O complex -> real n 1 negative nums + O n 1 sign nums + O -> int n 1 invert bool + ints + O flts raise an error n 1 degrees real + M cmplx raise an error n 1 radians real + M cmplx raise an error n 1 arccos flts + M n 1 arccosh flts + M n 1 arcsin flts + M n 1 arcsinh flts + M n 1 arctan flts + M n 1 arctanh flts + M n 1 cos flts + M n 1 sin flts + M n 1 tan flts + M n 1 cosh flts + M n 1 sinh flts + M n 1 tanh flts + M n 1 exp flts + M n 1 expm1 flts + M n 1 log flts + M n 1 log10 flts + M n 1 log1p flts + M n 1 sqrt flts + M real x < 0 raises error n 1 ceil real + M n 1 trunc real + M n 1 floor real + M n 1 fabs real + M n 1 rint flts + M n 1 isnan flts -> bool n 1 isinf flts -> bool n 1 isfinite flts -> bool n 1 signbit real -> bool n 1 modf real -> (frac, int) n 1 logical_not bool + nums + M -> bool n 2 left_shift ints + O flts raise an error n 2 right_shift ints + O flts raise an error n 2 add bool + nums + O boolean + is || n 2 subtract bool + nums + O boolean - is ^ n 2 multiply bool + nums + O boolean * is & n 2 divide nums + O n 2 floor_divide nums + O n 2 true_divide nums + O bBhH -> f, iIlLqQ -> d n 2 fmod nums + M n 2 power nums + O n 2 greater bool + nums + O -> bool n 2 greater_equal bool + nums + O -> bool n 2 less bool + nums + O -> bool n 2 less_equal bool + nums + O -> bool n 2 equal bool + nums + O -> bool n 2 not_equal bool + nums + O -> bool n 2 logical_and bool + nums + M -> bool n 2 logical_or bool + nums + M -> bool n 2 logical_xor bool + nums + M -> bool n 2 maximum bool + nums + O n 2 minimum bool + nums + O n 2 bitwise_and bool + ints + O flts raise an error n 2 bitwise_or bool + ints + O flts raise an error n 2 bitwise_xor bool + ints + O flts raise an error n 2 arctan2 real + M n 2 remainder ints + real + O n 2 hypot real + M ===== ==== ============= =============== ======================== Types other than those listed will be accepted, but they are cast to the smallest compatible type for which the function is defined. The casting rules are: bool -> int8 -> float32 ints -> double
Basic test for the safest casts, because ufuncs inner loops can indicate a cast-safety as well (which is normally always "no").
@pytest.mark.parametrize(
def test_logical_ufuncs_mixed_object_signatures(self, ufunc, signature): (source) ¶
Undocumented
@pytest.mark.parametrize(
def test_logical_ufuncs_object_signatures(self, ufunc, signature): (source) ¶
Undocumented
def test_logical_ufuncs_out_cast_check(self, ufunc): (source) ¶
Undocumented
def test_logical_ufuncs_reject_string(self, ufunc): (source) ¶
Logical ufuncs are normally well defined by working with the boolean equivalent, i.e. casting all inputs to bools should work.
However, casting strings to bools is currently weird, because it
actually uses bool(int(str))
. Thus we explicitly reject strings.
This test should succeed (and can probably just be removed) as soon as
string to bool casts are well defined in NumPy.
def test_logical_ufuncs_support_anything(self, ufunc): (source) ¶
Undocumented
def test_nat_is_nan(self, nat): (source) ¶
Undocumented
def test_nat_is_not_finite(self, nat): (source) ¶
Undocumented
def test_nat_is_not_inf(self, nat): (source) ¶
Undocumented
def test_out_broadcast_errors(self, arr, out): (source) ¶
Undocumented
def test_partial_signature_mismatch(self, casting): (source) ¶
Undocumented
@pytest.mark.parametrize(
@pytest.mark.parametrize(
def test_reduce_wrong_dimension_output(self, f_reduce, keepdims, out_shape): (source) ¶
Undocumented
def test_reduceat_and_accumulate_out_shape_mismatch(self, with_cast): (source) ¶
Undocumented
@pytest.mark.parametrize(
def test_reduction_with_where(self, axis, where): (source) ¶
Undocumented
@pytest.mark.parametrize(
def test_reduction_with_where_and_initial(self, axis, where, initial): (source) ¶
Undocumented
def test_signature_dtype_instances_allowed(self, get_kwarg): (source) ¶
Undocumented