class CompoundInterestTest(unittest.TestCase):
    def setUp(self):
        self.calc_1 = CompoundInterest(100, 20, 0.1)

    # Tests

    def test_part_one(self):
        get_part_one = self.calc_1.part_one_of_equation(
            self.calc_1.interest_rate)
        self.assertEqual(1.0083333333, get_part_one)

    def test_part_two(self):
        get_part_two = self.calc_1.part_two_of_equation(self.calc_1.years)
        self.assertEqual(240, get_part_two)

    # Should return 732.81 given 100 principal, 10 percent, 20 years
    def test_compound_interest_calc(self):
        get_compound_interest = self.calc_1.compound_interest_calc(
            self.calc_1.principal_amount, self.calc_1.years,
            self.calc_1.interest_rate)
        self.assertEqual(732.81, get_compound_interest)

    # Should return 181.94 given 100 principal, 6 percent, 10 years

    def test_compound_interest_calc__example_2(self):
        calc_2 = CompoundInterest(100, 10, 0.06)
        get_compound_interest = calc_2.compound_interest_calc(
            calc_2.principal_amount, calc_2.years, calc_2.interest_rate)
        self.assertEqual(181.94, get_compound_interest)

    # Should return 149,058.55 given 100000 principal, 5 percent, 8 years

    def test_compound_interest_calc__example_3(self):
        calc_3 = CompoundInterest(100000, 8, 0.05)
        get_compound_interest = calc_3.compound_interest_calc(
            calc_3.principal_amount, calc_3.years, calc_3.interest_rate)
        self.assertEqual(149058.55, get_compound_interest)

    # Should return 0.00 given 0 principal, 10 percent, 1 year

    def test_compound_interest_calc__example_4(self):
        calc_4 = CompoundInterest(0, 1, 0.1)
        get_compound_interest = calc_4.compound_interest_calc(
            calc_4.principal_amount, calc_4.years, calc_4.interest_rate)
        self.assertEqual(0.00, get_compound_interest)
 def test_compound_interest_calc__example_3(self):
     calc_3 = CompoundInterest(100000, 8, 0.05)
     get_compound_interest = calc_3.compound_interest_calc(
         calc_3.principal_amount, calc_3.years, calc_3.interest_rate)
     self.assertEqual(149058.55, get_compound_interest)
 def test_compound_interest_calc__example_4(self):
     calc_4 = CompoundInterest(0, 1, 0.1)
     get_compound_interest = calc_4.compound_interest_calc(
         calc_4.principal_amount, calc_4.years, calc_4.interest_rate)
     self.assertEqual(0.00, get_compound_interest)
 def test_compound_interest_calc__example_2(self):
     calc_2 = CompoundInterest(100, 10, 0.06)
     get_compound_interest = calc_2.compound_interest_calc(
         calc_2.principal_amount, calc_2.years, calc_2.interest_rate)
     self.assertEqual(181.94, get_compound_interest)