Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove assert_almost_equals from tests #92

Closed

Conversation

ArCh12312
Copy link

#66 Fixed the issue
Changed assert_almost_equals to assert_allclose and a custom function(assert_decimal_close).
Had to create assert_decimal_close, which finds the absolute difference in values and compares it to a tolerance level.
Cannot use the assert_allclose because it uses isfinite under the covers which does not support the Decimal type.
See issue: numpy/numpy#9954

Copy link
Member

@Kai-Striega Kai-Striega left a comment

Choose a reason for hiding this comment

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

There's one issue that's coming up in the CI:

tests/test_financial.py:1:1: I001 [*] Import block is un-sorted or un-formatted

But I don't see any changes you have made other than to delete a line. Either way, would you be able to fix it?

@@ -740,4 +748,4 @@ def test_irr_maximum_iterations_exception(self):
cashflows = numpy.array([-40000, 5000, 8000, 12000, 30000])

with pytest.raises(npf.IterationsExceededError):
npf.irr(cashflows, maxiter=1, raise_exceptions=True)
npf.irr(cashflows, maxiter=1, raise_exceptions=True)
Copy link
Member

Choose a reason for hiding this comment

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

You've deleted the ending newline here, please add it back in

Copy link
Author

Choose a reason for hiding this comment

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

Yes, I'll work on it right now!

Sorted the import block and added the new line
@ArCh12312
Copy link
Author

Hey! I have sorted the import block and added the new line back.

@Kai-Striega
Copy link
Member

Thanks, @ArCh12312, I've re-run the tests to make sure everything is ok. If it is, I'm glad to merge this.

used the command ruff format ./test_financial.py to reformat the file.
@ArCh12312
Copy link
Author

Hey @Kai-Striega, I have reformatted the file using the command `ruff format ./test_financial.py'. Please review it.

@ArCh12312 ArCh12312 closed this Dec 21, 2023
@ArCh12312 ArCh12312 deleted the remove_assert_almost_equals_from_tests branch December 21, 2023 14:16
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.

2 participants