Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions numpy_financial/tests/test_financial.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,10 @@ class TestRate:
def test_rate(self):
assert_allclose(npf.rate(10, 0, -3500, 10000), 0.1107, rtol=1e-4)

def test_rate_zero_payment(self):
result = npf.rate(nper=10, pmt=0, pv=-1000, fv=1000)
assert np.isfinite(result)
Comment on lines +177 to +178

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
result = npf.rate(nper=10, pmt=0, pv=-1000, fv=1000)
assert np.isfinite(result)
result = npf.rate(nper=10, pmt=0, pv=-1000, fv=1000)
assert np.isfinite(result)

Probably some more indent is needed (sorry for later review).


@pytest.mark.parametrize("number_type", [Decimal, float])
@pytest.mark.parametrize("when", [0, 1, "end", "begin"])
def test_rate_with_infeasible_solution(self, number_type, when):
Expand Down