def mk_solidaridad(independiente, income): if independiente: (_, compute_base, rate) = util.tuple_by_threshold( income, ss.ss_contrib_schedule_for_contractor["solidaridad"]) return compute_base(income) * rate else: (_, compute_base, rate) = util.tuple_by_threshold( income, ss.ss_contrib_schedule_for_employee["solidaridad"]) return compute_base(income) * rate
def test_tuple_by_threshold(): sched = [(0,"a","b")] for income in [-1,0,1,1e11]: assert util.tuple_by_threshold( income, sched ) == sched[0] sched = [ (0,1,2), (10,"whatever","something") ] for income in [(-1,0,1,9)]: assert util.tuple_by_threshold( income, sched ) == sched[0] for income in [(10,11,1e11)]: assert util.tuple_by_threshold( income, sched ) == sched[1]
def mk_salud_employer(independiente, income): if independiente: return 0 else: (_, compute_base, rate) = util.tuple_by_threshold(income, ss.ss_contribs_by_employer["salud"]) return compute_base(income) * rate
def mk_cesantias_y_primas_employer(independiente, income): if independiente: return 0 else: (_, compute_base, rate) = util.tuple_by_threshold( income, ss.ss_contribs_by_employer["cesantias + primas"]) return compute_base(income) * rate
def mk_cajas_de_compensacion_employer(independiente, income): if independiente: return 0 else: (_, compute_base, rate) = util.tuple_by_threshold( income, ss.ss_contribs_by_employer["cajas de compensacion"]) return compute_base(income) * rate