Exemple #1
0
    def setUp(self):
        __location__ = os.path.realpath(
            os.path.join(os.getcwd(), os.path.dirname(__file__)))
        __DATA_TEST_PATHNAME = os.path.join(__location__, 'data',
                                            'input_test_simulation_B.json')
        with open(__DATA_TEST_PATHNAME, 'r') as file:
            input_data = json.load(file)

        self.achat_data = input_data['achat']
        self.lots_data = input_data['lots']
        self.credit_data = input_data['credit']

        self.bi = Factory.make_bien_immo(self.achat_data, self.lots_data)
        self.credit = Factory.make_credit(self.credit_data, self.bi)
        self.rdt = Rendement(self.bi, self.credit)
Exemple #2
0
 def testCopropriete(self):
     self.achat_data['prix_net_vendeur'] = 115000
     self.lots_data[0]['loyer_nu_mensuel'] = 500
     self.lots_data[0]['charges']['copropriete'] = 1000
     bi = Factory.make_bien_immo(self.achat_data, self.lots_data)
     rdt = Rendement(bi)
     self.assertAlmostEqual(rdt.rendement_net, 0.0435, 4)
Exemple #3
0
 def testVacanceLocative(self):
     self.achat_data['prix_net_vendeur'] = 115000
     self.lots_data[0]['loyer_nu_mensuel'] = 500
     self.lots_data[0]['charges']['vacance_locative_taux'] = 1 / 24
     bi = Factory.make_bien_immo(self.achat_data, self.lots_data)
     rdt = Rendement(bi)
     self.assertAlmostEqual(rdt.rendement_net, 0.05, 4)
Exemple #4
0
 def testGestionAgence(self):
     self.achat_data['prix_net_vendeur'] = 115000
     self.lots_data[0]['loyer_nu_mensuel'] = 500
     self.lots_data[0]['charges']['agence_immo'] = 0.075
     bi = Factory.make_bien_immo(self.achat_data, self.lots_data)
     rdt = Rendement(bi)
     self.assertAlmostEqual(rdt.rendement_net, 0.0483, 4)
Exemple #5
0
    def testCashflowMensuel(self):
        self.achat_data['prix_net_vendeur'] = 136000
        self.lots_data[0]['loyer_nu_mensuel'] = 1000
        self.lots_data[0]['charges']['taxe_fonciere'] = 1500
        self.lots_data[0]['charges']['PNO'] = 100
        self.lots_data[0]['charges']['travaux_provision_taux'] = 0.05
        self.credit_data['duree_annee'] = 20
        self.credit_data['taux_interet'] = 0.018
        self.credit_data['taux_assurance'] = 0.0036
        self.credit_data['mode'] = 'fixe_ci'

        bi = Factory.make_bien_immo(self.achat_data, self.lots_data)
        cred = Factory.make_credit(self.credit_data, bi)
        rdt = Rendement(bi, cred)

        self.assertAlmostEqual(rdt.cashflow_net_mensuel, 100.67, 2)
Exemple #6
0
 def testTravauxProvision(self):
     self.achat_data['prix_net_vendeur'] = 115000
     self.lots_data[0]['loyer_nu_mensuel'] = 500
     self.lots_data[0]['charges']['travaux_provision_taux'] = 0.01
     bi = Factory.make_bien_immo(self.achat_data, self.lots_data)
     rdt = Rendement(bi)
     self.assertAlmostEqual(rdt.rendement_net, 0.0517, 4)
Exemple #7
0
def main(argv):
    configure_logger()

    logging.info('{} {}\n'.format(__NAME, __VERSION))

    inputfile = parse_args(argv)
    # If path to input file is provided, create output log file in the same folder
    if inputfile:
        location = os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(inputfile)))
        filepath = os.path.join(location, 'analyse_immo.log')
        add_logger_file_handler(filepath)

    input_data = load_file(inputfile)

    achat_data = input_data['achat']
    defaut_data = input_data['defaut']
    lots_data = input_data['lots']
    credit_data = input_data['credit']
    impot_data = input_data['impot']

    database = Database()
    defaut = Factory.make_defaut(defaut_data)

    bien_immo = Factory.make_bien_immo(achat_data, lots_data, defaut)
    credit = Factory.make_credit(credit_data, bien_immo)
    rendement = Rendement(bien_immo, credit)

    # Impot
    annee_achat = achat_data['annee']
    credit_duree = credit_data['duree_annee']

    # IRPP + 2044
    irpp_2044_list = list()

    for i_annee in range(credit_duree):
        annee_revenu = annee_achat + i_annee
        irpp = Factory.make_irpp(database, impot_data, annee_revenu)

        irpp.annexe_2044 = Factory.make_annexe_2044(database, bien_immo, credit, i_annee + 1)
        irpp_2044_list.append(irpp)

    # IRPP + Micro foncier
    irpp_micro_foncier_list = list()

    for i_annee in range(credit_duree):
        annee_revenu = annee_achat + i_annee
        irpp = Factory.make_irpp(database, impot_data, annee_revenu)

        irpp.micro_foncier = Factory.make_micro_foncier(database, bien_immo)
        irpp_micro_foncier_list.append(irpp)

    # Rapport
    generate_rapport(bien_immo, credit, annee_achat, irpp_2044_list, irpp_micro_foncier_list, rendement)
Exemple #8
0
    def testRendementBrut(self):
        self.achat_data['prix_net_vendeur'] = 100000
        self.lots_data[0]['loyer_nu_mensuel'] = 500
        bi = Factory.make_bien_immo(self.achat_data, self.lots_data)
        rdt = Rendement(bi)
        self.assertEqual(rdt.rendement_brut, 0.06)

        self.achat_data['frais_agence'] = 0.06
        bi = Factory.make_bien_immo(self.achat_data, self.lots_data)
        rdt = Rendement(bi)
        self.assertAlmostEqual(rdt.rendement_brut, 0.057, 3)

        self.achat_data['frais_agence'] = 0
        self.achat_data['frais_notaire'] = 0.09
        bi = Factory.make_bien_immo(self.achat_data, self.lots_data)
        rdt = Rendement(bi)
        self.assertAlmostEqual(rdt.rendement_brut, 0.055, 3)

        self.achat_data['frais_agence'] = 0.06
        self.achat_data['frais_notaire'] = 0.09
        bi = Factory.make_bien_immo(self.achat_data, self.lots_data)
        rdt = Rendement(bi)
        self.assertAlmostEqual(rdt.rendement_brut, 0.052, 3)
Exemple #9
0
 def setUp(self):
     super().setUp()
     self.defaut = Factory.make_defaut(self.defaut_data)
Exemple #10
0
 def testSansCharges(self):
     self.achat_data['prix_net_vendeur'] = 115000
     self.lots_data[0]['loyer_nu_mensuel'] = 500
     bi = Factory.make_bien_immo(self.achat_data, self.lots_data)
     rdt = Rendement(bi)
     self.assertAlmostEqual(rdt.rendement_net, 0.052, 3)
Exemple #11
0
 def testRendementMethodeLarcher(self):
     self.achat_data['prix_net_vendeur'] = 100000
     self.lots_data[0]['loyer_nu_mensuel'] = 500
     bi = Factory.make_bien_immo(self.achat_data, self.lots_data)
     rdt = Rendement(bi)
     self.assertEqual(rdt.rendement_methode_larcher, 0.045)
Exemple #12
0
 def testVacanceLocativeTaux(self):
     defaut = Factory.make_defaut(self.defaut_data)
     self.assertEqual(defaut.vacance_locative_taux('T1'), 0.083)
     self.assertEqual(defaut.vacance_locative_taux('T0'), 0)
Exemple #13
0
 def testGestionAgenceTaux(self):
     defaut = Factory.make_defaut(self.defaut_data)
     self.assertEqual(defaut.gestion_agence_taux, 0.08)