예제 #1
0
파일: test_credit.py 프로젝트: nboutin/immo
    def test02_MensualitePeriodique(self):
        self.assertAlmostEqual(Credit.mensualite_periodique(100000, 0.005, 240), 716.43, 2)
        self.assertAlmostEqual(Credit.mensualite_periodique(150000, 0.00193, 240), 781.48, 2)

        self.assertAlmostEqual(Credit.mensualite_periodique(100000, 0.015 / 12, 240), 482.55, 2)
        self.assertAlmostEqual(Credit.mensualite_periodique(88000, 0.0099 / 12, 15 * 12), 526.29, 2)
        self.assertAlmostEqual(Credit.mensualite_periodique(136000, 0.018 / 12, 240), 675.19, 2)
예제 #2
0
파일: test_credit.py 프로젝트: nboutin/immo
    def test03_GetMensualiteAvecAssurance(self):

        cred = Credit(100000, 1, 0, Credit.taux_e.periodique, 0.0035, Credit.mode_e.fixe_CI, 0, 0)
        self.assertAlmostEqual(cred.get_mensualite_avec_assurance(), 29.17, 2)
        self.assertAlmostEqual(cred.get_mensualite_avec_assurance(1), 29.17, 2)

        cred = Credit(136000, 240, 0.018, Credit.taux_e.periodique, 0.0036, Credit.mode_e.fixe_CI, 0, 0)
        self.assertAlmostEqual(cred.get_mensualite_avec_assurance(), 715.99, 2)
        self.assertAlmostEqual(cred.get_mensualite_avec_assurance(1), 715.99, 2)
        self.assertAlmostEqual(cred.get_mensualite_avec_assurance(24), 715.99, 2)
예제 #3
0
파일: test_credit.py 프로젝트: nboutin/immo
    def test05_MontantInteretTotal(self):

        cred = Credit(10000, 36, 0.02, Credit.taux_e.periodique, 0, Credit.mode_e.fixe_CI, 0, 0)
        self.assertAlmostEqual(cred.get_montant_interet_total(), 311.33, 2)

        cred = Credit(100000, 240, 0.02, Credit.taux_e.periodique, 0, Credit.mode_e.fixe_CI, 0, 0)
        self.assertAlmostEqual(cred.get_montant_interet_total(), 21412, 2)

        cred = Credit(136000, 240, 0.018, Credit.taux_e.periodique, 0, Credit.mode_e.fixe_CI, 0, 0)
        self.assertAlmostEqual(cred.get_montant_interet_total(), 26046.52, 2)
예제 #4
0
파일: test_credit.py 프로젝트: nboutin/immo
    def test01_FixeCI1(self):
        cred = Credit(10000, 36, 0.02, Credit.taux_e.periodique, 0, Credit.mode_e.fixe_CI, 0, 0)

        self.assertAlmostEqual(cred.capital, 10000, 2)
        self.assertAlmostEqual(cred.get_amortissement(), 269.76, 2)
        self.assertAlmostEqual(cred.get_interet(), 16.67, 2)
        self.assertAlmostEqual(cred.get_mensualite_assurance(), 0, 2)
        self.assertAlmostEqual(cred.get_mensualite_avec_assurance(), 286.43, 2)

        start = 36
        self.assertAlmostEqual(cred.get_amortissement(start), 285.95, 2)
        self.assertAlmostEqual(cred.get_interet(start), 0.48, 2)
        self.assertAlmostEqual(cred.get_mensualite_assurance(start), 0, 2)
        self.assertAlmostEqual(cred.get_mensualite_avec_assurance(start), 286.43, 2)
예제 #5
0
파일: test_credit.py 프로젝트: nboutin/immo
    def test04_DegressiveCRD(self):
        cred = Credit(81600, 240, 0.0115, Credit.taux_e.periodique,
                      0.0026, Credit.mode_e.degressive_CRD, 0, 0)

        self.assertAlmostEqual(cred.get_mensualite_hors_assurance(), 380.76, 2)

        self.assertAlmostEqual(cred.get_amortissement_total(), 81600, 2)
        self.assertAlmostEqual(cred.get_montant_interet_total(), 9782.33, 2)
        self.assertAlmostEqual(cred.get_montant_assurance_total(), 2211.66, 2)  # 2234.76
        self.assertAlmostEqual(cred.get_mensualite_hors_assurance_total(), 91382.33, 2)
        self.assertAlmostEqual(cred.get_mensualite_avec_assurance_total(), 93593.98, 2)
예제 #6
0
파일: test_credit.py 프로젝트: nboutin/immo
    def test07_CoutTotal(self):

        cred = Credit(10000, 36, 0.02, Credit.taux_e.periodique, 0.0030, Credit.mode_e.fixe_CI, 100, 200)
        self.assertAlmostEqual(cred.get_cout_total(), 701.33, 2)

        cred = Credit(136000, 240, 0.018, Credit.taux_e.periodique, 0.0036, Credit.mode_e.fixe_CI, 40, 60)
        self.assertAlmostEqual(cred.get_cout_total(), 35938.52, 2)
예제 #7
0
파일: test_credit.py 프로젝트: nboutin/immo
    def test06_MontantAssuranceTotal(self):

        cred = Credit(10000, 36, 0.02, Credit.taux_e.periodique, 0.0030, Credit.mode_e.fixe_CI, 0, 0)
        self.assertAlmostEqual(cred.get_montant_assurance_total(), 90, 2)

        cred = Credit(136000, 240, 0.02, Credit.taux_e.periodique, 0.0036, Credit.mode_e.fixe_CI, 0, 0)
        self.assertAlmostEqual(cred.get_montant_assurance_total(), 9792, 2)
예제 #8
0
    def testCashflow(self):
        bi = Bien_Immo(50000, 0, 0, 0, 0)

        lot1 = Lot("T2", 50, 500)
        bi.add_lot(lot1)
        cr = Credit(50000, 240, 0.02, Credit.taux_e.periodique, 0,
                    Credit.mode_e.fixe_CI, 0, 0)
        rdt = Rendement(bi, cr)
        self.assertAlmostEqual(rdt.cashflow_net_mensuel, 247.06, 2)

        lot2 = Lot("T2", 50, 500)
        charge = Charge(lot2, None)
        charge.add(Charge.charge_e.copropriete, 51 * 12)
        charge.add(Charge.charge_e.prime_assurance, 90)
        charge.add(Charge.charge_e.vacance_locative, 1 / 12)
        charge.add(Charge.charge_e.agence_immo, 0.05)
        lot2.charge = charge
        bi.add_lot(lot2)

        self.assertAlmostEqual(bi.loyer_nu_brut_annuel, 12000, 2)
        self.assertAlmostEqual(bi.charges + bi.provisions, 1002, 2)
        self.assertAlmostEqual(cr.get_mensualite_avec_assurance(), 252.94, 2)
        self.assertAlmostEqual(rdt.cashflow_net_mensuel, 621.89, 2)
        self.assertAlmostEqual(rdt.cashflow_net_annuel, 7462.70, 2)
예제 #9
0
파일: factory.py 프로젝트: nboutin/immo
    def make_credit(credit_data, bien_immo):

        if credit_data['mode'] == 'fixe_ci':
            mode = Credit.mode_e.fixe_CI
        elif credit_data['mode'] == 'fixe_crd':
            mode = Credit.mode_e.fixe_CRD
        elif credit_data['mode'] == 'degressive_crd':
            mode = Credit.mode_e.degressive_CRD
        else:
            raise Exception('Bad Credit mode')

        credit = Credit(bien_immo.financement_total,
                        credit_data['duree_annee'] * 12,
                        credit_data['taux_interet'], Credit.taux_e.periodique,
                        credit_data['taux_assurance'], mode,
                        credit_data['frais_dossier'],
                        credit_data['frais_garantie'])
        return credit
예제 #10
0
파일: test_credit.py 프로젝트: nboutin/immo
    def test03_FixeCRD(self):
        cred = Credit(10000, 36, 0.02, Credit.taux_e.periodique, 0.0030, Credit.mode_e.fixe_CRD, 0, 0)

        start = 1
        self.assertAlmostEqual(cred.get_capital_restant(start), 9731.43, 2)
        self.assertAlmostEqual(cred.get_amortissement(start), 268.57, 2)
        self.assertAlmostEqual(cred.get_interet(start), 16.67, 2)
        self.assertAlmostEqual(cred.get_mensualite_assurance(start), 2.50, 2)
        self.assertAlmostEqual(cred.get_mensualite_hors_assurance(start), 285.24, 2)
        self.assertAlmostEqual(cred.get_mensualite_avec_assurance(start), 287.74, 2)

        start = 2
        self.assertAlmostEqual(cred.get_capital_restant(start), 9462.34, 2)
        self.assertAlmostEqual(cred.get_amortissement(start), 269.09, 2)
        self.assertAlmostEqual(cred.get_interet(start), 16.22, 2)
        self.assertAlmostEqual(cred.get_mensualite_assurance(start), 2.43, 2)
        self.assertAlmostEqual(cred.get_mensualite_hors_assurance(start), 285.30, 2)
        self.assertAlmostEqual(cred.get_mensualite_avec_assurance(start), 287.74, 2)

        start = 36
        self.assertAlmostEqual(cred.get_amortissement(start), 287.19, 2)  # 268.5706
        self.assertAlmostEqual(cred.get_interet(start), 0.48, 2)
        self.assertAlmostEqual(cred.get_mensualite_assurance(start), 0.07, 2)
        self.assertAlmostEqual(cred.get_mensualite_avec_assurance(start), 287.74, 2)

        self.assertAlmostEqual(cred.get_amortissement_total(), 10000, 2)
        self.assertAlmostEqual(cred.get_montant_interet_total(), 311.78, 2)
        self.assertAlmostEqual(cred.get_montant_assurance_total(), 46.77, 2)
        self.assertAlmostEqual(cred.get_mensualite_hors_assurance_total(), 10311.78, 2)
        self.assertAlmostEqual(cred.get_mensualite_avec_assurance_total(), 10358.54, 2)
예제 #11
0
파일: test_credit.py 프로젝트: nboutin/immo
 def test01_TauxPeriodique(self):
     self.assertAlmostEqual(Credit.taux_actuariel(0.04, 12), 0.00327, 5)
     self.assertAlmostEqual(Credit.taux_actuariel(0.0234, 12), 0.00193, 5)
예제 #12
0
파일: test_credit.py 프로젝트: nboutin/immo
 def testFraisGarantie(self):
     credit = Credit(0, 0, 0, Credit.taux_e.periodique, 0, Credit.mode_e.fixe_CI, 0, 300)
     self.assertEqual(credit.frais_garantie, 300)
예제 #13
0
파일: test_credit.py 프로젝트: nboutin/immo
 def testFraisDossier(self):
     credit = Credit(0, 0, 0, Credit.taux_e.periodique, 0, Credit.mode_e.fixe_CI, 500, 0)
     self.assertEqual(credit.frais_dossier, 500)
예제 #14
0
파일: test_credit.py 프로젝트: nboutin/immo
 def testMode(self):
     credit = Credit(0, 0, 0, Credit.taux_e.periodique, 0, Credit.mode_e.fixe_CI, 0, 0)
     self.assertEqual(credit.mode, Credit.mode_e.fixe_CI)
예제 #15
0
파일: test_credit.py 프로젝트: nboutin/immo
 def testTauxAssurance(self):
     credit = Credit(0, 0, 0, Credit.taux_e.periodique, 0.040, Credit.mode_e.fixe_CI, 0, 0)
     self.assertEqual(credit.taux_assurance, 0.040)
예제 #16
0
class TestCredit_FixeCRD(unittest.TestCase):
    def setUp(self):

        self.credit = Credit(50000, 240, 0.0115, Credit.taux_e.periodique,
                             0.0026, Credit.mode_e.fixe_CRD, 0, 0)

    def testTotal(self):
        self.assertAlmostEqual(self.credit.get_montant_interet_total(),
                               6043.69, 2)
        self.assertAlmostEqual(self.credit.get_montant_assurance_total(),
                               1366.40, 2)
        self.assertAlmostEqual(self.credit.get_amortissement_total(), 50000, 2)
        self.assertAlmostEqual(
            self.credit.get_mensualite_hors_assurance_total(), 56043.69, 2)
        self.assertAlmostEqual(
            self.credit.get_mensualite_avec_assurance_total(), 57410.09, 2)
        self.assertAlmostEqual(self.credit.get_cout_total(), 7410.09, 2)

    def testRangeNone(self):
        self.assertAlmostEqual(self.credit.get_amortissement(), 180.46, 2)
        self.assertAlmostEqual(self.credit.get_interet(), 47.92, 2)
        self.assertAlmostEqual(self.credit.get_mensualite_assurance(), 10.83,
                               2)
        self.assertAlmostEqual(self.credit.get_mensualite_hors_assurance(),
                               228.38, 2)
        self.assertAlmostEqual(self.credit.get_mensualite_avec_assurance(),
                               239.21, 2)

    def testRange1(self):
        self.assertAlmostEqual(self.credit.get_amortissement(1), 180.46, 2)
        self.assertAlmostEqual(self.credit.get_interet(1), 47.92, 2)
        self.assertAlmostEqual(self.credit.get_mensualite_assurance(1), 10.83,
                               2)
        self.assertAlmostEqual(self.credit.get_mensualite_hors_assurance(1),
                               228.38, 2)
        self.assertAlmostEqual(self.credit.get_mensualite_avec_assurance(1),
                               239.21, 2)

    def testRange2(self):
        start = 2
        self.assertAlmostEqual(self.credit.get_amortissement(start), 180.67, 2)
        self.assertAlmostEqual(self.credit.get_interet(start), 47.74, 2)
        self.assertAlmostEqual(self.credit.get_mensualite_assurance(start),
                               10.79, 2)
        self.assertAlmostEqual(
            self.credit.get_mensualite_hors_assurance(start), 228.41, 2)
        self.assertAlmostEqual(
            self.credit.get_mensualite_avec_assurance(start), 239.21, 2)

    def testRange12(self):
        start = 12
        self.assertAlmostEqual(self.credit.get_amortissement(start), 182.80, 2)
        self.assertAlmostEqual(self.credit.get_interet(start), 46, 2)
        self.assertAlmostEqual(self.credit.get_mensualite_assurance(start),
                               10.40, 2)
        self.assertAlmostEqual(
            self.credit.get_mensualite_hors_assurance(start), 228.81, 2)
        self.assertAlmostEqual(
            self.credit.get_mensualite_avec_assurance(start), 239.21, 2)

    def testRange228(self):
        start = 228
        self.assertAlmostEqual(self.credit.get_amortissement(start), 235.58, 2)
        self.assertAlmostEqual(self.credit.get_interet(start), 2.96, 2)
        self.assertAlmostEqual(self.credit.get_mensualite_assurance(start),
                               0.67, 2)
        self.assertAlmostEqual(
            self.credit.get_mensualite_hors_assurance(start), 238.54, 2)
        self.assertAlmostEqual(
            self.credit.get_mensualite_avec_assurance(start), 239.21, 2)

    def testRange240(self):
        start = 240
        self.assertAlmostEqual(self.credit.get_amortissement(start), 238.93, 2)
        self.assertAlmostEqual(self.credit.get_interet(start), 0.23, 2)
        self.assertAlmostEqual(self.credit.get_mensualite_assurance(start),
                               0.05, 2)
        self.assertAlmostEqual(
            self.credit.get_mensualite_hors_assurance(start), 239.16, 2)
        self.assertAlmostEqual(
            self.credit.get_mensualite_avec_assurance(start), 239.21, 2)

    def testRange1_2(self):
        start = 1
        stop = 2
        self.assertAlmostEqual(self.credit.get_amortissement(start, stop),
                               180.46 + 180.67, 2)
        self.assertAlmostEqual(self.credit.get_interet(start, stop),
                               47.92 + 47.74, 2)
        self.assertAlmostEqual(
            self.credit.get_mensualite_assurance(start, stop), 10.83 + 10.80,
            2)
        self.assertAlmostEqual(
            self.credit.get_mensualite_hors_assurance(start, stop),
            228.38 + 228.41, 2)
        self.assertAlmostEqual(
            self.credit.get_mensualite_avec_assurance(start, stop),
            239.21 + 239.21, 2)

    def testRange1_240(self):
        start = 1
        stop = 240
        self.assertAlmostEqual(self.credit.get_amortissement(start, stop),
                               50000, 2)
        self.assertAlmostEqual(self.credit.get_interet(start, stop), 6043.69,
                               2)
        self.assertAlmostEqual(
            self.credit.get_mensualite_assurance(start, stop), 1366.40, 2)
        self.assertAlmostEqual(
            self.credit.get_mensualite_hors_assurance(start, stop), 56043.69,
            2)
        self.assertAlmostEqual(
            self.credit.get_mensualite_avec_assurance(start, stop), 57410.09,
            2)
예제 #17
0
파일: test_credit.py 프로젝트: nboutin/immo
    def test01_GetMensualiteHorsAssurance(self):
        cred = Credit(100000, 240, 0.015, Credit.taux_e.periodique, 0, Credit.mode_e.fixe_CI, 0, 0)
        self.assertAlmostEqual(cred.get_mensualite_hors_assurance(), 482.55, 2)
        self.assertAlmostEqual(cred.get_mensualite_hors_assurance(1), 482.55, 2)
        self.assertAlmostEqual(cred.get_mensualite_hors_assurance(10), 482.55, 2)

        cred = Credit(88000, 15 * 12, 0.0099, Credit.taux_e.periodique, 0, Credit.mode_e.fixe_CI, 0, 0)
        self.assertAlmostEqual(cred.get_mensualite_hors_assurance(), 526.29, 2)
        self.assertAlmostEqual(cred.get_mensualite_hors_assurance(150), 526.29, 2)
        self.assertAlmostEqual(cred.get_mensualite_hors_assurance(15 * 12), 526.29, 2)

        cred = Credit(136000, 240, 0.018, Credit.taux_e.periodique, 0, Credit.mode_e.fixe_CI, 0, 0)
        self.assertAlmostEqual(cred.get_mensualite_hors_assurance(), 675.19, 2)
예제 #18
0
파일: test_credit.py 프로젝트: nboutin/immo
 def testCapital(self):
     credit = Credit(100, 0, 0, Credit.taux_e.periodique, 0, Credit.mode_e.fixe_CI, 0, 0)
     self.assertEqual(credit.capital, 100)
예제 #19
0
    def setUp(self):

        self.credit = Credit(50000, 240, 0.0115, Credit.taux_e.periodique,
                             0.0026, Credit.mode_e.fixe_CRD, 0, 0)
예제 #20
0
파일: test_credit.py 프로젝트: nboutin/immo
 def testConstructeur(self):
     Credit(0, 0, 0, Credit.taux_e.periodique, 0, Credit.mode_e.fixe_CI, 0, 0)
     Credit(0, 1, 0, Credit.taux_e.periodique, 0, Credit.mode_e.fixe_CRD, 0, 0)
예제 #21
0
파일: test_credit.py 프로젝트: nboutin/immo
    def test02_GetMensualiteAssurance(self):

        cred = Credit(136000, 12, 0, Credit.taux_e.periodique, 0.0036, Credit.mode_e.fixe_CI, 0, 0)
        self.assertAlmostEqual(cred.get_mensualite_assurance(), 40.80, 2)
        self.assertAlmostEqual(cred.get_mensualite_assurance(1), 40.80, 2)
        self.assertAlmostEqual(cred.get_mensualite_assurance(12), 40.80, 2)
예제 #22
0
파일: test_credit.py 프로젝트: nboutin/immo
 def testDureeMois(self):
     credit = Credit(0, 15, 0, Credit.taux_e.periodique, 0, Credit.mode_e.fixe_CI, 0, 0)
     self.assertEqual(credit.duree_mois, 15)
예제 #23
0
파일: test_credit.py 프로젝트: nboutin/immo
    def test04_MensualiteAvecAssuranceTotal(self):

        cred = Credit(10000, 36, 0.02, Credit.taux_e.periodique, 0, Credit.mode_e.fixe_CI, 0, 0)
        self.assertAlmostEqual(cred.get_mensualite_avec_assurance_total(), 10311.33, 2)
예제 #24
0
파일: test_credit.py 프로젝트: nboutin/immo
 def testTaux(self):
     credit = Credit(0, 0, 1.15, Credit.taux_e.periodique, 0, Credit.mode_e.fixe_CI, 0, 0)
     self.assertEqual(credit.taux, 1.15)
예제 #25
0
 def setUp(self):
     self._database = Database()
     self.credit = Credit(0, 0, 0, 0, None, 0, 0)
    def testExemple2(self):
        '''
        www.lacentraledefinancement.fr
        '''

        credit = Credit(10000, 60, 0.01, Credit.taux_e.periodique, 0.0020, Credit.mode_e.fixe_CRD, 0, 0)

#         self.assertAlmostEqual(credit.get_montant_interet_total(), 308, 0)
#         self.assertAlmostEqual(credit.get_montant_assurance_total(), 100, 0)
        self.assertAlmostEqual(credit.get_cout_total(), 308, 2)

        mois = 1
        self.assertAlmostEqual(credit.get_capital_restant(mois), 9838.20, 2)
        self.assertAlmostEqual(credit.get_amortissement(mois), 161.80, 2)
        self.assertAlmostEqual(credit.get_interet(mois), 8.33, 2)
        self.assertAlmostEqual(credit.get_mensualite_assurance(mois), 1.67, 2)
        self.assertAlmostEqual(credit.get_mensualite_hors_assurance(mois), 170.13, 2)
        self.assertAlmostEqual(credit.get_mensualite_avec_assurance(mois), 171.80, 2)

        mois = 2
        self.assertAlmostEqual(credit.get_capital_restant(mois), 9676.24, 2)
        self.assertAlmostEqual(credit.get_amortissement(mois), 161.96, 2)
        self.assertAlmostEqual(credit.get_interet(mois), 8.20, 2)
        self.assertAlmostEqual(credit.get_mensualite_assurance(mois), 1.64, 2)
        self.assertAlmostEqual(credit.get_mensualite_hors_assurance(mois), 170.16, 2)
        self.assertAlmostEqual(credit.get_mensualite_avec_assurance(mois), 171.80, 2)

        mois = 13
        self.assertAlmostEqual(credit.get_capital_restant(mois), 7883.93, 2)
        self.assertAlmostEqual(credit.get_amortissement(mois), 163.75, 2)
        self.assertAlmostEqual(credit.get_interet(mois), 6.71, 2)
        self.assertAlmostEqual(credit.get_mensualite_assurance(mois), 1.34, 2)
        self.assertAlmostEqual(credit.get_mensualite_hors_assurance(mois), 170.46, 2)
        self.assertAlmostEqual(credit.get_mensualite_avec_assurance(mois), 171.80, 2)