Skip to content

Commit

Permalink
TST: Ignore warnings in MIRR fuzz test
Browse files Browse the repository at this point in the history
NumPy warns us of arithmetic overflow/underflow
this only occurs when hypothesis generates extremely large values
that are unlikely to ever occur in the real world.
  • Loading branch information
Kai Striega committed May 5, 2024
1 parent d4534f2 commit 88b6fd6
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion numpy_financial/tests/test_financial.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import math
import warnings
from decimal import Decimal

# Don't use 'import numpy as np', to avoid accidentally testing
Expand Down Expand Up @@ -391,7 +392,13 @@ def test_mirr_no_real_solution_exception(self):
)
def test_fuzz(self, values, finance_rate, reinvestment_rate):
assume(finance_rate.size == reinvestment_rate.size)
npf.mirr(values, finance_rate, reinvestment_rate)

# NumPy warns us of arithmetic overflow/underflow
# this only occurs when hypothesis generates extremely large values
# that are unlikely to ever occur in the real world.
with warnings.catch_warnings():
warnings.simplefilter("ignore")
npf.mirr(values, finance_rate, reinvestment_rate)

@given(
values=cashflow_array_like_strategy,
Expand Down

0 comments on commit 88b6fd6

Please sign in to comment.