test_interest.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:biweeklybudget 作者: jantman 项目源码 文件源码
def test_next_with_transactions(self):
        b = Mock(spec_set=_BillingPeriod)
        b_next = Mock(spec_set=_BillingPeriod)
        type(b).next_period = PropertyMock(return_value=b_next)
        i = Mock(spec_set=_InterestCalculation)
        p = Mock(spec_set=_MinPaymentFormula)
        cls = CCStatement(
            i, Decimal('1.23'), p, b,
            end_balance=Decimal('1.50'), interest_amt=Decimal('0.27')
        )
        mock_stmt = Mock(spec_set=CCStatement)
        with patch('biweeklybudget.interest.CCStatement', autospec=True) as m:
            m.return_value = mock_stmt
            res = cls.next_with_transactions({'foo': 'bar'})
        assert res == mock_stmt
        assert m.mock_calls == [
            call(
                i, Decimal('1.50'), p, b_next, transactions={'foo': 'bar'}
            )
        ]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号