def test_pmt(self):
res = np.pmt(0.08/12, 5*12, 15000)
tgt = -304.145914
assert_allclose(res, tgt)
# Test the edge case where rate == 0.0
res = np.pmt(0.0, 5*12, 15000)
tgt = -250.0
assert_allclose(res, tgt)
# Test the case where we use broadcast and
# the arguments passed in are arrays.
res = np.pmt([[0.0, 0.8],[0.3, 0.8]],[12, 3],[2000, 20000])
tgt = np.array([[-166.66667, -19311.258],[-626.90814, -19311.258]])
assert_allclose(res, tgt)
评论列表
文章目录