def test_quantile_broadcast_1(): broadcast_tester(qt.quantile, "(n),()->()", otype="float64", excluded=(1, ), dtype=np.float_, elements=[floats_, probs])
def test_linear_rescale_broadcast(): def clean_up(args): X, lb0, ub0, lb1, ub1, enforce_bounds = args enforce_bounds = enforce_bounds >= 0 # Ideally, hypothesis should be able to handle constraints like this lb0, ub0 = pair_sort(lb0, ub0) lb1, ub1 = pair_sort(lb1, ub1) assume(np.all(lb0 < ub0)) assume(np.all(lb1 <= ub1)) if enforce_bounds: X = np.clip(X, lb0, ub0) return X, lb0, ub0, lb1, ub1, enforce_bounds broadcast_tester( np_util.linear_rescale, "(),(),(),(),(),()->()", "float64", excluded=(5, ), map_=clean_up, min_value=-1000, max_value=1000, )
def test_decode_broadcast_float(): broadcast_tester( sp.decode, "(m,n),(n),()->(m)", otype=CAT_DTYPE, excluded=(1, 2), dtype=[np.float_, CAT_DTYPE, np.bool_], elements=[floats(), from_dtype(np.dtype(CAT_DTYPE)), booleans()], unique=[False, True, False], min_side={"n": 1}, map_=decoder_gen_broadcast, )
def test_encode_broadcast_float(): broadcast_tester( sp.encode, "(),(n),(),(),()->(n)", otype=float, excluded=(1, 2, 3, 4), dtype=[np.int_, CAT_DTYPE, np.bool_, object, np.bool_], elements=[integers(0, INT_MAX), from_dtype(np.dtype(CAT_DTYPE)), booleans(), just("float"), booleans()], unique=[False, True, False, False, False], min_side={"n": 1}, map_=encoder_gen, )
def test_biexp_broadcast(): broadcast_tester(sp.biexp, "()->()", otype=float, min_value=-10, max_value=10)
def test_bilog_broadcast(): broadcast_tester(sp.bilog, "()->()", otype=float)
def test_order_stats_broadcast(): broadcast_tester(order_stats_trim, "(n)->(n)", otype="float64", dtype=np.float_, elements=floats_)
def test_isclose_broadcast(): broadcast_tester(np_util.isclose_lte, "(),()->()", otype="bool", min_value=-1000, max_value=1000)