Skip to content

Commit 6521614

Browse files
committed
TST: Seperate large test PMT methods to multiple, smaller methods
1 parent cb1f5c9 commit 6521614

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

numpy_financial/tests/test_financial.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,29 +137,36 @@ def test_npv_decimal(self):
137137

138138

139139
class TestPmt:
140-
def test_pmt(self):
140+
def test_pmt_simple(self):
141141
res = npf.pmt(0.08 / 12, 5 * 12, 15000)
142142
tgt = -304.145914
143143
assert_allclose(res, tgt)
144+
145+
def test_pmt_zero_rate(self):
144146
# Test the edge case where rate == 0.0
145147
res = npf.pmt(0.0, 5 * 12, 15000)
146148
tgt = -250.0
147149
assert_allclose(res, tgt)
150+
151+
def test_pmt_broadcast(self):
148152
# Test the case where we use broadcast and
149153
# the arguments passed in are arrays.
150154
res = npf.pmt([[0.0, 0.8], [0.3, 0.8]], [12, 3], [2000, 20000])
151155
tgt = numpy.array([[-166.66667, -19311.258], [-626.90814, -19311.258]])
152156
assert_allclose(res, tgt)
153157

154-
def test_pmt_decimal(self):
158+
def test_pmt_decimal_simple(self):
155159
res = npf.pmt(Decimal('0.08') / Decimal('12'), 5 * 12, 15000)
156160
tgt = Decimal('-304.1459143262052370338701494')
157161
assert_equal(res, tgt)
162+
163+
def test_pmt_decimal_zero_rate(self):
158164
# Test the edge case where rate == 0.0
159165
res = npf.pmt(Decimal('0'), Decimal('60'), Decimal('15000'))
160166
tgt = -250
161167
assert_equal(res, tgt)
162168

169+
def test_pmt_decimal_broadcast(self):
163170
# Test the case where we use broadcast and
164171
# the arguments passed in are arrays.
165172
res = npf.pmt([[Decimal('0'), Decimal('0.8')],

0 commit comments

Comments
 (0)