From f4b781169ba609f606f29895190662ca2be297bc Mon Sep 17 00:00:00 2001 From: Anurag42-git Date: Sun, 8 Feb 2026 04:07:16 +0530 Subject: [PATCH] Add edge case test for rate with zero payment --- numpy_financial/tests/test_financial.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/numpy_financial/tests/test_financial.py b/numpy_financial/tests/test_financial.py index 765e1b2..e21c056 100644 --- a/numpy_financial/tests/test_financial.py +++ b/numpy_financial/tests/test_financial.py @@ -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) + @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):