def test_calculate_tax_two_brackets(self):
     bracket_collection = TaxBracketCollection(configuration)
     expected_tax_owed = 48535*0.15 + (70000-48535)*0.205
     self.assertEqual(
         expected_tax_owed, 
         bracket_collection.calculate_tax(70000)
     )
 def test_calculate_tax_one_bracket(self):
     bracket_collection = TaxBracketCollection(configuration)
     expected_tax_owed = 30000*0.15
     self.assertEqual(
         expected_tax_owed,
         bracket_collection.calculate_tax(30000)
     )
 def test_calculate_tax_top_marginal(self):
     bracket_collection = TaxBracketCollection(configuration)
     expected_tax_owed = \
         48535*0.15 + \
         48534*0.205 + \
         53404*0.26 + \
         63895*0.29 + \
         (500000 - 48535 - 48534 - 53404 - 63895)*0.33
     self.assertEqual(
         expected_tax_owed,
         bracket_collection.calculate_tax(500000)
     )
Пример #4
0
def calculate_effective_tax_rate(income, configuration):
    tax_brackets = TaxBracketCollection(configuration)
    return tax_brackets.effective_tax_rate(income)
Пример #5
0
def calculate_tax_owed(income, configuration):
    tax_brackets = TaxBracketCollection(configuration)
    return tax_brackets.calculate_tax(income)
 def test_init(self):
     bracket_collection = TaxBracketCollection(configuration)
     self.assertTrue(isinstance(bracket_collection, TaxBracketCollection))
 def test_error_calculate_tax_negative_income(self):
     bracket_collection = TaxBracketCollection(configuration)
     with self.assertRaises(Exception):
         bracket_collection.calculate_tax(-1)
 def test_calculate_effective_tax_rate(self):
      bracket_collection = TaxBracketCollection(configuration)