Example #1
0
    def test__calculate_depreciation(self):
        real_estate_calc = RealEstateCalc()

        real_estate_calc.depreciation_years = 10
        real_estate_calc.depreciation_annual = 1000000
        real_estate_calc.calc_year = 9
        real_estate_calc._calculate_depreciation()
        self.assertEquals(real_estate_calc.depreciation, 1000000)

        real_estate_calc.calc_year = 10
        real_estate_calc._calculate_depreciation()
        self.assertEquals(real_estate_calc.depreciation, 0)
Example #2
0
    def test__calculate_cumulative_net_income(self):

        # A bit tricky to test
        real_estate_calc = RealEstateCalc(
            purchase_price=10000000,
            gross_rental_yield=0.05,
            calc_year=0,
            mortgage_loan_to_value=1,
            mortgage_rate=0.01,
            mortgage_tenor=1,
            renewal_income_rate=0,
            rental_management_renewal_fee=0,
            rental_management_rental_fee=0,
        )

        # Mortgage of one year, so year_0_income will be the rental income of 500k - mortgage payment of ~10+m
        year_0_income = real_estate_calc.net_income_after_taxes
        mortgage_payment = int(real_estate_calc.mortgage.monthly_payment * 12)
        self.assertEquals(year_0_income, 500000 - mortgage_payment)

        # Cumulative income will just be first year
        self.assertEquals(real_estate_calc.cumulative_net_income, year_0_income)

        # On second year, cumulative income will be 500k rent + year 0
        real_estate_calc.calc_year = 1
        real_estate_calc.calculate_all_fields()
        year_1_income = real_estate_calc.net_income_after_taxes
        self.assertEquals(year_1_income, 500000)
        self.assertEquals(real_estate_calc.cumulative_net_income, year_0_income + year_1_income)

        # And just to prove its this function doing the job
        real_estate_calc.calc_year = 3
        real_estate_calc._calculate_cumulative_net_income()
        self.assertEquals(real_estate_calc.cumulative_net_income, year_0_income + year_1_income * 3)
Example #3
0
    def test__calculate_sale_price(self):
        real_estate_calc = RealEstateCalc()

        real_estate_calc.sale_price = 50000000
        real_estate_calc.book_value = 45000000
        real_estate_calc._calculate_sale_price()
        self.assertEquals(real_estate_calc.sale_price, 50000000)

        real_estate_calc.sale_price = None
        real_estate_calc._calculate_sale_price()
        self.assertEquals(real_estate_calc.sale_price, 45000000)
Example #4
0
    def test__calculate_purchase_price_and_fees(self):
        real_estate_calc = RealEstateCalc()

        real_estate_calc.purchase_price = 100000000
        real_estate_calc.purchase_agent_fee = 3000000
        real_estate_calc.purchase_other_transaction_fees = 1000000
        real_estate_calc.mortgage_initiation_fees = 20000
        real_estate_calc.renovation_cost = 5000000
        expected = 100000000 + 3000000 + 1000000 + 20000 + 5000000
        real_estate_calc._calculate_purchase_price_and_fees()
        self.assertEquals(real_estate_calc.purchase_price_and_fees, expected)
Example #5
0
    def test__calculate_rental_management_renewal_fee(self):
        real_estate_calc = RealEstateCalc()
        real_estate_calc.rental_management_renewal_fee = None
        real_estate_calc._calculate_rental_management_renewal_fee()
        self.assertEquals(real_estate_calc.rental_management_renewal_fee, (1 / 24 + 0.5 / 24) / 2)

        real_estate_calc.rental_management_renewal_fee = 0.06
        real_estate_calc._calculate_rental_management_renewal_fee()
        self.assertEquals(real_estate_calc.rental_management_renewal_fee, 0.06)
Example #6
0
    def test__calculate_net_profit_on_realestate(self):
        real_estate_calc = RealEstateCalc()

        real_estate_calc.sale_proceeds_net = 50000000
        real_estate_calc.cumulative_net_income = 2000000
        real_estate_calc.purchase_initial_outlay = 10000000
        real_estate_calc.mortgage_amount_outstanding = 39000000
        real_estate_calc._calculate_net_profit_on_realestate()
        self.assertEquals(real_estate_calc.net_profit_on_realestate, 3000000)
Example #7
0
    def test__calculate_total_expense(self):
        real_estate_calc = RealEstateCalc()

        real_estate_calc.maintenance_expense = 100000
        real_estate_calc.monthly_fees_annualized = 200000
        real_estate_calc.rental_management_total_expense = 300000
        real_estate_calc.property_tax_expense = 400000
        real_estate_calc._calculate_total_expense()
        self.assertEquals(real_estate_calc.total_expense, 1000000)
Example #8
0
    def test__calculate_rental_management_rental_fee(self):
        real_estate_calc = RealEstateCalc()
        real_estate_calc.rental_management_renewal_fee = None
        real_estate_calc._calculate_rental_management_renewal_fee()
        self.assertEquals(real_estate_calc.rental_management_rental_fee, 0.05)

        real_estate_calc.rental_management_renewal_fee = 0.04
        real_estate_calc = RealEstateCalc(rental_management_rental_fee=0.04)
        self.assertEquals(real_estate_calc.rental_management_rental_fee, 0.04)
Example #9
0
    def test__calculate_acquisition_cost(self):
        real_estate_calc = RealEstateCalc()

        real_estate_calc.purchase_price = 100000000
        real_estate_calc.purchase_agent_fee = 3000000
        real_estate_calc.purchase_other_transaction_fees = 1000000
        real_estate_calc.renovation_cost = 5000000
        real_estate_calc._calculate_acquisition_cost()
        self.assertEquals(real_estate_calc.acquisition_cost, 109000000)
Example #10
0
    def test__calculate_renewal_income_rate(self):
        real_estate_calc = RealEstateCalc()
        real_estate_calc.renewal_income_rate = None
        real_estate_calc._calculate_renewal_income_rate()
        self.assertEquals(real_estate_calc.renewal_income_rate, 1 / 24)

        real_estate_calc.renewal_income_rate = 0.05
        real_estate_calc._calculate_renewal_income_rate()
        self.assertEquals(real_estate_calc.renewal_income_rate, 0.05)
Example #11
0
    def test__calculate_mortgage(self):
        real_estate_calc = RealEstateCalc()

        real_estate_calc._calculate_mortgage()
        self.assertEquals(real_estate_calc.mortgage, None)

        real_estate_calc.mortgage_rate = 0.01
        real_estate_calc.mortgage_tenor = 30
        real_estate_calc.purchase_price_financed = 10000000
        real_estate_calc._calculate_mortgage()
        self.assertEquals(real_estate_calc.mortgage.rate, 0.01)
        self.assertEquals(real_estate_calc.mortgage.tenor, 30)
        self.assertEquals(real_estate_calc.mortgage.principal, 10000000)
Example #12
0
    def test__calculate_purchase_date(self):
        real_estate_calc = RealEstateCalc()
        real_estate_calc.purchase_date = None
        real_estate_calc._calculate_purchase_date()
        self.assertEquals(real_estate_calc.purchase_date, dt.date.today())

        some_date = dt.date(2016, 12, 24)
        real_estate_calc.purchase_date = some_date
        real_estate_calc._calculate_purchase_date()
        self.assertEquals(real_estate_calc.purchase_date, some_date)
Example #13
0
    def test__calculate_depreciation_percentage(self):
        real_estate_calc = RealEstateCalc()

        real_estate_calc.depreciation_years = 0
        real_estate_calc._calculate_depreciation_percentage()
        self.assertEquals(real_estate_calc.depreciation_percentage, 0)

        real_estate_calc.depreciation_years = 47
        real_estate_calc._calculate_depreciation_percentage()
        self.assertEquals(real_estate_calc.depreciation_percentage, 1 / 47)
Example #14
0
    def test__calculate_income_tax_real_estate(self):
        real_estate_calc = RealEstateCalc()

        real_estate_calc._calculate_income_tax_real_estate()
        self.assertEquals(real_estate_calc.income_tax_real_estate, 0)

        real_estate_calc.income_tax_calculator = IncomeTaxCalc()
        real_estate_calc.income_tax = 11000000
        real_estate_calc.income_tax_calculator.total_income_tax = 10000000
        real_estate_calc._calculate_income_tax_real_estate()
        self.assertEquals(real_estate_calc.income_tax_real_estate, 1000000)
Example #15
0
    def test__calculate_sale_proceeds_after_fees(self):
        real_estate_calc = RealEstateCalc()

        real_estate_calc.sale_price = 30000000
        real_estate_calc.sale_agent_fee = 1000000
        real_estate_calc.sale_other_transaction_fees = 300000
        real_estate_calc._calculate_sale_proceeds_after_fees()
        self.assertEquals(real_estate_calc.sale_proceeds_after_fees, 28700000)
Example #16
0
    def test__calculate_sale_agent_fee(self):
        real_estate_calc = RealEstateCalc()

        real_estate_calc.sale_price = 100000000
        real_estate_calc.agent_fee_variable = 0.03
        real_estate_calc.agent_fee_fixed = 50000
        real_estate_calc._calculate_sale_agent_fee()
        expected = (100000000 * 0.03 + 50000) * (1 + taxconstants.CONSUMPTION_TAX)
        self.assertEquals(real_estate_calc.sale_agent_fee, expected)
Example #17
0
    def test__calculate_mortgage_amount_outstanding(self):
        real_estate_calc = RealEstateCalc()

        self.assertEquals(real_estate_calc.mortgage_amount_outstanding, 0)

        real_estate_calc.mortgage = Mortgage(principal=24000000,
                                             tenor=2,
                                             rate=0)

        real_estate_calc.calc_year = 0
        real_estate_calc._calculate_mortgage_amount_outstanding()
        self.assertEquals(real_estate_calc.mortgage_amount_outstanding,
                          12000000)

        real_estate_calc.calc_year = 1
        real_estate_calc._calculate_mortgage_amount_outstanding()
        self.assertEquals(real_estate_calc.mortgage_amount_outstanding, 0)
Example #18
0
    def test__calculate_rental_management_total_expense(self):
        real_estate_calc = RealEstateCalc()

        real_estate_calc.rental_management_renewal_expense = 100000
        real_estate_calc.rental_management_rental_expense = 1000000
        real_estate_calc._calculate_rental_management_total_expense()
        self.assertEquals(real_estate_calc.rental_management_total_expense, 1100000)
Example #19
0
    def test__calculate_net_income_after_taxes(self):
        real_estate_calc = RealEstateCalc()

        real_estate_calc.net_income_before_taxes = 1000000
        real_estate_calc.income_tax_real_estate = 200000
        real_estate_calc._calculate_net_income_after_taxes()
        self.assertEquals(real_estate_calc.net_income_after_taxes, 800000)
Example #20
0
    def test_depreciation_for_year(self):
        real_estate_calc = RealEstateCalc()

        real_estate_calc.depreciation_years = 10
        real_estate_calc.depreciation_annual = 1000000
        self.assertEquals(real_estate_calc.depreciation_for_year(9), 1000000)
        self.assertEquals(real_estate_calc.depreciation_for_year(10), 0)
Example #21
0
    def test__calculate_property_tax_expense(self):
        real_estate_calc = RealEstateCalc()

        real_estate_calc.purchase_price = 70000000
        real_estate_calc.property_tax_rate = 0.01
        real_estate_calc._calculate_property_tax_expense()
        self.assertEquals(real_estate_calc.property_tax_expense, 700000)
Example #22
0
    def test__calculate_book_value(self):
        real_estate_calc = RealEstateCalc()

        real_estate_calc.purchase_price_land = 20000000
        real_estate_calc.depreciated_building_value = 10000000
        real_estate_calc._calculate_book_value()
        self.assertEquals(real_estate_calc.book_value, 30000000)
Example #23
0
    def test__calculate_equity_value(self):
        real_estate_calc = RealEstateCalc()

        real_estate_calc.book_value = 20000000
        real_estate_calc.mortgage_amount_outstanding = 5000000
        real_estate_calc._calculate_equity_value()
        self.assertEquals(real_estate_calc.equity_value, 15000000)
Example #24
0
    def test__calculate_depreciated_building_value(self):
        real_estate_calc = RealEstateCalc()

        real_estate_calc.purchase_price_building = 30000000
        real_estate_calc.depreciation_cumulative = 20000000
        real_estate_calc._calculate_depreciated_building_value()
        self.assertEquals(real_estate_calc.depreciated_building_value, 10000000)
Example #25
0
    def test__calculate_sale_other_transaction_fees(self):
        real_estate_calc = RealEstateCalc()

        real_estate_calc.sale_price = 100000000
        real_estate_calc.other_transaction_fees = 0.01
        real_estate_calc._calculate_sale_other_transaction_fees()
        self.assertEquals(real_estate_calc.sale_other_transaction_fees, 1000000)
Example #26
0
    def test__calculate_renewal_income(self):
        real_estate_calc = RealEstateCalc()

        real_estate_calc.renewal_income_rate = 1 / 24
        real_estate_calc.rental_income = 500000
        real_estate_calc._calculate_renewal_income()
        self.assertEquals(real_estate_calc.renewal_income, 20833)
Example #27
0
    def test__calculate_maintenance_expense(self):
        real_estate_calc = RealEstateCalc()

        real_estate_calc.maintenance_per_m2 = 1000
        real_estate_calc.size = 50
        real_estate_calc._calculate_maintenance_expense()
        self.assertEquals(real_estate_calc.maintenance_expense, 50000)
Example #28
0
    def test__calculate_sale_proceeds_net(self):
        real_estate_calc = RealEstateCalc()

        real_estate_calc.sale_proceeds_after_fees = 50000000
        real_estate_calc.capital_gains_tax = 1000000
        real_estate_calc._calculate_sale_proceeds_net()
        self.assertEquals(real_estate_calc.sale_proceeds_net, 49000000)
Example #29
0
    def test__calculate_rental_income(self):
        real_estate_calc = RealEstateCalc()

        real_estate_calc.purchase_price = 10000000
        real_estate_calc.gross_rental_yield = 0.05
        real_estate_calc._calculate_rental_income()
        self.assertEquals(real_estate_calc.rental_income, 500000)
Example #30
0
    def test__calculate_total_income(self):
        real_estate_calc = RealEstateCalc()

        real_estate_calc.rental_income = 500000
        real_estate_calc.renewal_income = 20833
        real_estate_calc._calculate_total_income()
        self.assertEquals(real_estate_calc.total_income, 520833)