Skip to content

TST: add edge case tests for npv and irr (gh-58) - #155

Open
Eshan-kumar-jain wants to merge 1 commit into
numpy:mainfrom
Eshan-kumar-jain:tst-npv-irr-edge-cases
Open

Eshan-kumar-jain wants to merge 1 commit into
numpy:mainfrom
Eshan-kumar-jain:tst-npv-irr-edge-cases

Conversation

@Eshan-kumar-jain

Copy link
Copy Markdown

Partially addresses #58 by adding edge case tests for npv and irr.

New tests:

  • npv: zero rate, all-negative cashflows, single cashflow
  • irr: single positive cashflow, zero cashflows in the middle
    (expected value derived analytically rather than hard-coded)

Leaves #58 open, since it covers the other functions too.

While testing I noticed two behaviours that look unintended, so I
did not write tests locking them in:

  • npf.irr([]) raises a bare IndexError (from row[0] on an empty row)
  • npf.irr([-100, np.nan, 110]) raises LinAlgError from np.roots,
    whereas npv returns NaN for NaN input

Happy to add tests for these once the intended behaviour is decided.

@Eshan-kumar-jain

Copy link
Copy Markdown
Author

@Kai-Striega could you approve the CI workflows when you have a moment? Happy to make any changes.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant