Exemplo n.º 1
0
    def test_gen_report(self):
        account = self.add_account()

        user_id = account.id

        plan = PlanData.add(gender=1,
                            user_id=user_id,
                            age=25,
                            province_code=u'110000',
                            stock=1,
                            rent=1000,
                            mpayment=1000,
                            insurance=1,
                            tour=1,
                            has_children=1,
                            savings=10000,
                            mincome=10000)
        formula = Formula(plan=plan)
        report = formula.gen_report()

        assert formula.get_theory_children_tour_factor() == 1600
        assert formula.get_practice_children_tour_factor() == 1600
        assert abs(formula.get_this_year_norm_dist() - 0.564386647) < 0.00001
        assert abs(formula.get_raise_quota() -
                   Decimal(0.07233586)) < Decimal(0.00001)
        assert report is not None
        assert report.erfund == 16859
Exemplo n.º 2
0
    def test_add_wxplan(self):
        account = self.add_account()

        user_id = account.id

        plan = PlanData.add(gender=1,
                            user_id=user_id,
                            age=30,
                            province_code=u'110000',
                            stock=1,
                            rent=123,
                            mpayment=123,
                            insurance=1,
                            tour=1,
                            has_children=1,
                            savings=10000,
                            mincome=2000)
        assert plan is not None
        assert plan.user_id == user_id
Exemplo n.º 3
0
    def test_savings_money(self):
        account = self.add_account()

        user_id = account.id

        plan = PlanData.add(gender=1,
                            user_id=user_id,
                            age=30,
                            province_code=u'110000',
                            stock=1,
                            rent=123,
                            mpayment=123,
                            insurance=1,
                            tour=1,
                            has_children=1,
                            savings=10000,
                            mincome=10000)
        formula = Formula(plan=plan)

        assert 75100 in formula.get_five_savings_money()[0]