@@ -137,29 +137,36 @@ def test_npv_decimal(self):
137
137
138
138
139
139
class TestPmt :
140
- def test_pmt (self ):
140
+ def test_pmt_simple (self ):
141
141
res = npf .pmt (0.08 / 12 , 5 * 12 , 15000 )
142
142
tgt = - 304.145914
143
143
assert_allclose (res , tgt )
144
+
145
+ def test_pmt_zero_rate (self ):
144
146
# Test the edge case where rate == 0.0
145
147
res = npf .pmt (0.0 , 5 * 12 , 15000 )
146
148
tgt = - 250.0
147
149
assert_allclose (res , tgt )
150
+
151
+ def test_pmt_broadcast (self ):
148
152
# Test the case where we use broadcast and
149
153
# the arguments passed in are arrays.
150
154
res = npf .pmt ([[0.0 , 0.8 ], [0.3 , 0.8 ]], [12 , 3 ], [2000 , 20000 ])
151
155
tgt = numpy .array ([[- 166.66667 , - 19311.258 ], [- 626.90814 , - 19311.258 ]])
152
156
assert_allclose (res , tgt )
153
157
154
- def test_pmt_decimal (self ):
158
+ def test_pmt_decimal_simple (self ):
155
159
res = npf .pmt (Decimal ('0.08' ) / Decimal ('12' ), 5 * 12 , 15000 )
156
160
tgt = Decimal ('-304.1459143262052370338701494' )
157
161
assert_equal (res , tgt )
162
+
163
+ def test_pmt_decimal_zero_rate (self ):
158
164
# Test the edge case where rate == 0.0
159
165
res = npf .pmt (Decimal ('0' ), Decimal ('60' ), Decimal ('15000' ))
160
166
tgt = - 250
161
167
assert_equal (res , tgt )
162
168
169
+ def test_pmt_decimal_broadcast (self ):
163
170
# Test the case where we use broadcast and
164
171
# the arguments passed in are arrays.
165
172
res = npf .pmt ([[Decimal ('0' ), Decimal ('0.8' )],
0 commit comments