def testGISBenefitReallyPositiveIncome(self): """Regular and supplemental GIS benefit should both be 0""" income = incomes.GIS() income.last_year_income_base = 20000 year_rec = self.setUpYearRecForGIS(has_oas=True, income_base=20000) amount, _, _ = income.GiveMeMoney(year_rec) self.assertEqual(amount, 0)
def testGISBenefitIncomeBelowSupplementExemption(self): """Income base is below supplement exemption but above clawback exemption""" income = incomes.GIS() income.last_year_income_base = 1000 year_rec = self.setUpYearRecForGIS(has_oas=True, income_base=1000) amount, _, _ = income.GiveMeMoney(year_rec) self.assertAlmostEqual(amount, 9431.64)
def testGISBenefitPositiveIncomeNoSupplement(self): """Getting regular GIS benefit but supplemental GIS benefit should be 0""" income = incomes.GIS() income.last_year_income_base = 10000 year_rec = self.setUpYearRecForGIS(has_oas=True, income_base=10000) amount, _, _ = income.GiveMeMoney(year_rec) self.assertAlmostEqual(amount, 4021.37)
def testGISBenefitPositiveIncome(self): """Income base is above both clawback and supplement exemption""" income = incomes.GIS() income.last_year_income_base = 5000 year_rec = self.setUpYearRecForGIS(has_oas=True, income_base=5000) amount, _, _ = income.GiveMeMoney(year_rec) self.assertAlmostEqual(amount, 7289.46)
def testGISBenefitPositiveIncomeWithInflation(self): """Income base is above both clawback and supplement exemption (with inflation)""" income = incomes.GIS() income.last_year_income_base = 10000 year_rec = self.setUpYearRecForGIS(has_oas=True, income_base=10000, cpi=2) amount, _, _ = income.GiveMeMoney(year_rec) self.assertAlmostEqual(amount, 14572.92)
def __init__(self, strategy, gender=FEMALE, basic_only=False, real_values=True): self.year = world.BASE_YEAR self.age = world.START_AGE self.gender = gender self.strategy = strategy self.cpi = 1 # Ignoring factor of 100 and StatsCan rounding rules here. self.cpi_history = [] self.basic_only = basic_only self.real_values = real_values self.employed_last_year = True self.retired = False # CAUTION: GIS must be the last income in the list. self.incomes = [ incomes.Earnings(), incomes.EI(), incomes.CPP(), incomes.OAS(), incomes.GIS() ] self.funds = { "wp_tfsa": funds.TFSA(), "wp_rrsp": funds.RRSP(), "wp_nonreg": funds.NonRegistered() } self.involuntary_retirement_random = random.random() self.tfsa_room = world.TFSA_INITIAL_CONTRIBUTION_LIMIT self.rrsp_room = world.RRSP_INITIAL_LIMIT self.capital_loss_carry_forward = 0 self.accumulators = utils.AccumulatorBundle() self.has_been_ruined = False self.has_received_gis = False self.has_experienced_income_under_lico = False # The following hold real dollar amounts self.assets_at_retirement = 0 self.total_retirement_withdrawals = 0 self.total_lifetime_withdrawals = 0 self.total_working_savings = 0 self.positive_earnings_years = 0 self.positive_savings_years = 0 self.ei_years = 0 self.gis_years = 0 self.gross_income_below_lico_years = 0 self.no_assets_years = 0 self.period_years = { EMPLOYED: 0, UNEMPLOYED: 0, RETIRED: 0, INVOLUNTARILY_RETIRED: 0 }
def testGISBenefitPositiveIncomeNoOAS(self): income = incomes.GIS() income.last_year_income_base = 1000 year_rec = self.setUpYearRecForGIS(has_oas=False, income_base=1000) amount, taxable, year_rec = income.GiveMeMoney(year_rec) self.assertEqual(amount, 0) self.assertFalse(taxable) self.assertIn(incomes.IncomeReceipt(0, incomes.INCOME_TYPE_GIS), year_rec.incomes)
def testGISCalcIncomeBaseIncomesAndPayrollDeductions(self): income = incomes.GIS() income.last_year_income_base = 10000 year_rec = utils.YearRecord() year_rec.incomes = [ incomes.IncomeReceipt(5000, incomes.INCOME_TYPE_EARNINGS) ] year_rec.ei_premium = 2000 year_rec.cpp_contribution = 2000 self.assertEqual(income._CalcIncomeBase(year_rec), 1000)
def testGISCalcIncomeBaseCapitalGains(self): income = incomes.GIS() income.last_year_income_base = 10000 year_rec = utils.YearRecord() year_rec.withdrawals = [ funds.WithdrawReceipt(2000, 1000, funds.FUND_TYPE_NONREG) ] year_rec.tax_receipts = [funds.TaxReceipt(500, funds.FUND_TYPE_NONREG)] year_rec.ei_premium = 0 year_rec.cpp_contribution = 0 self.assertEqual(income._CalcIncomeBase(year_rec), 750)
def testGISCalcIncomeBaseRRSPWithdrawals(self): income = incomes.GIS() income.last_year_income_base = 10000 year_rec = utils.YearRecord() year_rec.withdrawals = [ funds.WithdrawReceipt(2000, 0, funds.FUND_TYPE_RRSP), funds.WithdrawReceipt(3000, 0, funds.FUND_TYPE_BRIDGING) ] year_rec.ei_premium = 0 year_rec.cpp_contribution = 0 self.assertEqual(income._CalcIncomeBase(year_rec), 5000)
def testGISCalcIncomeBaseUsesLesserIncome(self): income = incomes.GIS() income.last_year_income_base = 5000 year_rec = utils.YearRecord() year_rec.incomes = [ incomes.IncomeReceipt(8000, incomes.INCOME_TYPE_EARNINGS) ] year_rec.ei_premium = 0 year_rec.cpp_contribution = 0 self.assertEqual(income._CalcIncomeBase(year_rec), 5000) self.assertEqual(income.last_year_income_base, 8000)
def testGISCalcIncomeBaseIncomes(self): income = incomes.GIS() income.last_year_income_base = 10000 year_rec = utils.YearRecord() year_rec.incomes = [ incomes.IncomeReceipt(1000, incomes.INCOME_TYPE_EARNINGS), incomes.IncomeReceipt(2000, incomes.INCOME_TYPE_CPP), incomes.IncomeReceipt(3000, incomes.INCOME_TYPE_EI), incomes.IncomeReceipt(4000, incomes.INCOME_TYPE_OAS) ] year_rec.ei_premium = 0 year_rec.cpp_contribution = 0 self.assertEqual(income._CalcIncomeBase(year_rec), 6000)