QuantEcon.py icon indicating copy to clipboard operation
QuantEcon.py copied to clipboard

MAINT: Deprecations and Test Warnings

Open mmcky opened this issue 1 year ago • 3 comments

The following deprecation notices and warnings are issued during test runs that should be fixed. @Smit-create would you be able to look into these?

quantecon/markov/tests/test_core.py::test_raises_non_homogeneous_state_values
  /Users/mmcky/work/quantecon/QuantEcon.py/quantecon/markov/core.py:230: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray.
    values = np.asarray(values)

quantecon/markov/tests/test_ddp.py::TestFiniteHorizon::test_backward_induction
quantecon/markov/tests/test_ddp.py::test_ddp_beta_1_not_implemented_error
  /Users/mmcky/work/quantecon/QuantEcon.py/quantecon/markov/ddp.py:430: UserWarning: infinite horizon solution methods are disabled with beta=1
    warnings.warn(msg)

quantecon/tests/test_graph_tools.py::test_raises_non_homogeneous_node_labels
  /Users/mmcky/work/quantecon/QuantEcon.py/quantecon/_graph_tools.py:140: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray.
    values = np.asarray(values)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html

mmcky avatar Mar 03 '24 22:03 mmcky

  • The 2nd one is as intended. Maybe define a custom warning rather than the generic UserWarning?
  • 1st and 3rd should be addressed.

oyamad avatar Mar 04 '24 00:03 oyamad

Thanks, @oyamad @mmcky. I can look into this.

kp992 avatar Mar 04 '24 06:03 kp992

thanks @kp992 and @oyamad

mmcky avatar Mar 04 '24 22:03 mmcky