def test_find_payments(self):
cls = HighestInterestRateFirstMethod(Decimal('100.00'))
s1 = Mock(spec_set=CCStatement)
type(s1).minimum_payment = PropertyMock(return_value=Decimal('2.00'))
type(s1).apr = PropertyMock(return_value=Decimal('0.0100'))
type(s1).principal = PropertyMock(return_value=Decimal('10.00'))
s2 = Mock(spec_set=CCStatement)
type(s2).minimum_payment = PropertyMock(return_value=Decimal('5.00'))
type(s2).apr = PropertyMock(return_value=Decimal('0.0200'))
type(s2).principal = PropertyMock(return_value=Decimal('25.00'))
s3 = Mock(spec_set=CCStatement)
type(s3).minimum_payment = PropertyMock(return_value=Decimal('2.00'))
type(s3).apr = PropertyMock(return_value=Decimal('0.0800'))
type(s3).principal = PropertyMock(return_value=Decimal('1234.56'))
s4 = Mock(spec_set=CCStatement)
type(s4).minimum_payment = PropertyMock(return_value=Decimal('7.00'))
type(s4).apr = PropertyMock(return_value=Decimal('0.0300'))
type(s4).principal = PropertyMock(return_value=Decimal('3.00'))
assert cls.find_payments([s1, s2, s3, s4]) == [
Decimal('2.00'),
Decimal('5.00'),
Decimal('86.00'),
Decimal('7.00')
]
评论列表
文章目录