Exemplo n.º 1
0
 def test_revenue_no_add_to_depo(self):
     calc = DepositCalc(s0=100000,
                        capitalization_freq=4,
                        replenishment_freq=2,
                        is_add_to_depo=False)
     calc.revenue(values=[10000, 10000])
     self.assertEqual(calc.income, 5250)
Exemplo n.º 2
0
 def test_can_print_data(self):
     calc = DepositCalc(s0=10000, capitalization_freq=1)
     calc.revenue()
     s, r, i = calc.get_data()
     self.assertEqual(s, 10000)
     self.assertEqual(r, 0)
     self.assertEqual(i, 500)
Exemplo n.º 3
0
 def test_revenue_3(self):
     calc = DepositCalc(t=1.5,
                        s0=100000,
                        capitalization_freq=4,
                        replenishment_freq=2,
                        is_add_to_depo=True)
     self.assertEqual(calc.revenue(values=[10000, 10000, 10000]), 8499)
    def handle_btn_clicked(self):
        calc = DepositCalc(s0=self.start_depo,
                           t=self.depo_time,
                           r=self.rate,
                           is_add_to_depo=True,
                           capitalization_freq=self.capitalization,
                           replenishment_freq=self.replenishment_freq)
        arr = []
        range_val = int(self.depo_time * self.replenishment_freq)

        for i in range(range_val):
            arr.append(self.replenishment_size)

        self.result = str(calc.revenue(values=arr))
Exemplo n.º 5
0
 def test_cant_create_invalid_object_2(self):
     with self.assertRaises(AssertionError):
         DepositCalc(capitalization_freq=1, replenishment_freq=2)
Exemplo n.º 6
0
 def test_can_create_object(self):
     calc = DepositCalc()
     self.assertTrue(isinstance(calc, DepositCalc))
Exemplo n.º 7
0
 def test_revenue_1(self):
     calc = DepositCalc(capitalization_freq=2, is_add_to_depo=True)
     self.assertEqual(calc.revenue(), 5)
Exemplo n.º 8
0
 def test_cant_replenish_negative_value(self):
     calc = DepositCalc(capitalization_freq=2, replenishment_freq=1)
     with self.assertRaises(AssertionError):
         calc.replenishment(-10)
Exemplo n.º 9
0
 def test_can_replenish(self):
     calc = DepositCalc(capitalization_freq=4, replenishment_freq=2)
     calc.replenishment(10)
     calc.replenishment(20)
     self.assertEqual(calc.s0, 130)
Exemplo n.º 10
0
 def test_capitaliation_2(self):
     calc = DepositCalc(capitalization_freq=1)
     calc.capitalization()
     self.assertEqual(calc.income, 5)
     self.assertEqual(calc.s0, 100)
Exemplo n.º 11
0
 def test_capitaliation_1(self):
     calc = DepositCalc(is_add_to_depo=True, capitalization_freq=1)
     calc.capitalization()
     self.assertEqual(calc.income, 5)
     self.assertEqual(calc.s0, 105)
Exemplo n.º 12
0
 def test_cant_create_invalid_object_1(self):
     with self.assertRaises(AssertionError):
         DepositCalc(s0=-1, capitalization_freq=9)