Пример #1
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)
Пример #2
0
 def setUp(self):
     super().setUp()
     self.defaut = Factory.make_defaut(self.defaut_data)
Пример #3
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)
Пример #4
0
 def testGestionAgenceTaux(self):
     defaut = Factory.make_defaut(self.defaut_data)
     self.assertEqual(defaut.gestion_agence_taux, 0.08)