TPRU-India / taxcalc

Tax Microsimulation Model for India
3 stars 59 forks source link

Test Failure #82

Closed kumar-ab closed 5 years ago

kumar-ab commented 5 years ago

@andersonfrailey @martinholmer I included losses functionality to the Tax Calculator. The code is running fine and giving the expected result. However, while running the pytest, there were three tests failures - one in "test_utils.py" and two in "test_calculator.py". The following error message is displayed on the command prompt:

test failure

I am not able to find out the reason of the test failure in "test_utils.py" especially as this is the first time during the entire exercise that the test_utils has failed. Can you please have a look at this. I have made the following additions to the functions.py file (along with the corresponding changes in records_variables.json, records.py, calculator.py, growfactors.py and growfactors.csv files):

@iterate_jit(nopython=True)
def curr_year_losses(CY_LOSSES, CYL_SET_OFF):
    """
    Compute current year losses from the relevant schedule.
    """
    # TODO: when shedule is available, do the calculation
    # TODO: when using losses as function argument, no calculations neeed
    CY_LOSSES = CYL_SET_OFF
    return CY_LOSSES

@iterate_jit(nopython=True)
def brought_fwd_losses(BF_LOSSES, BFL_SET_OFF_BALANCE):
    """
    Compute current year losses from the relevant schedule.
    """
    # TODO: when shedule is available, do the calculation
    # TODO: when using losses as function argument, no calculations neeed
    BF_LOSSES = BFL_SET_OFF_BALANCE
    return BF_LOSSES

@iterate_jit(nopython=True)
def gross_total_income(SALARIES, INCOME_HP, TOTAL_PROFTS_GAINS_BP,
                       ST_CG_AMT_1, ST_CG_AMT_2, ST_CG_AMT_APPRATE,
                       LT_CG_AMT_1, LT_CG_AMT_2, TOTAL_INCOME_OS, CY_LOSSES,
                       BF_LOSSES, GTI):
    """
    Compute GTI including capital gains amounts taxed at special rates.
    """
    GTI = (SALARIES + INCOME_HP + TOTAL_PROFTS_GAINS_BP +
           ST_CG_AMT_1 + ST_CG_AMT_2 + ST_CG_AMT_APPRATE +
           LT_CG_AMT_1 + LT_CG_AMT_2 +
           TOTAL_INCOME_OS)
    GTI = GTI - (CY_LOSSES + BF_LOSSES)
    return GTI

Can you please have a look at this issue?

kumar-ab commented 5 years ago

The issue got resolved after making the necessary changes in the tests and the model.