def test_wsumsq(tax_func_type, expected): rate_type = 'etr' A = 0.01 B = 0.02 C = 0.1 D = 1.1 max_x = 0.55 min_x = 0.17 max_y = 0.46 min_y = 0.04 shift_x = 0.1 shift_y = 0.2 shift = 0.04 share = 0.8 phi0 = 0.396 phi1 = 0.7 phi2 = 0.9 X = np.array([32.0, 44.0, 1.6, 0.4]) Y = np.array([32.0, 55.0, 0.9, 0.03]) txrates = np.array([0.6, 0.5, 0.3, 0.25]) wgts = np.array([0.1, 0.25, 0.55, 0.1]) if tax_func_type == 'DEP': params = A, B, C, D, max_x, max_y, share args = ((min_x, min_y, shift), X, Y, txrates, wgts, tax_func_type, rate_type) elif tax_func_type == 'GS': params = phi0, phi1, phi2 args = None, X, Y, txrates, wgts, tax_func_type, rate_type test_val = txfunc.wsumsq(params, *args) assert(np.allclose(test_val, expected))
def test_wsumsq(tax_func_type, expected): rate_type = 'etr' A = 0.01 B = 0.02 C = 0.1 D = 1.1 max_x = 0.55 min_x = 0.17 max_y = 0.46 min_y = 0.04 shift_x = 0.1 shift_y = 0.2 shift = 0.04 share = 0.8 phi0 = 0.396 phi1 = 0.7 phi2 = 0.9 X = np.array([32.0, 44.0, 1.6, 0.4]) Y = np.array([32.0, 55.0, 0.9, 0.03]) txrates = np.array([0.6, 0.5, 0.3, 0.25]) wgts = np.array([0.1, 0.25, 0.55, 0.1]) if tax_func_type == 'DEP': params = A, B, C, D, max_x, max_y, share args = ((min_x, min_y, shift), X, Y, txrates, wgts, tax_func_type, rate_type) elif tax_func_type == 'GS': params = phi0, phi1, phi2 args = None, X, Y, txrates, wgts, tax_func_type, rate_type test_val = txfunc.wsumsq(params, *args) assert (np.allclose(test_val, expected))