Skip to content

Commit 9917fbe

Browse files
committed
TST: Ignore warnings in MIRR fuzz test
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.
1 parent de63975 commit 9917fbe

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

numpy_financial/tests/test_financial.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import math
2+
import warnings
23
from decimal import Decimal
34

45
# Don't use 'import numpy as np', to avoid accidentally testing
@@ -391,7 +392,13 @@ def test_mirr_no_real_solution_exception(self):
391392
)
392393
def test_fuzz(self, values, finance_rate, reinvestment_rate):
393394
assume(finance_rate.size == reinvestment_rate.size)
394-
npf.mirr(values, finance_rate, reinvestment_rate)
395+
396+
# NumPy warns us of arithmetic overflow/underflow
397+
# this only occurs when hypothesis generates extremely large values
398+
# that are unlikely to ever occur in the real world.
399+
with warnings.catch_warnings():
400+
warnings.simplefilter("ignore")
401+
npf.mirr(values, finance_rate, reinvestment_rate)
395402

396403
@given(
397404
values=cashflow_array_like_strategy,

0 commit comments

Comments
 (0)