From d48196536a9d1c742d2c33c75d8710b6f3c1bb0f Mon Sep 17 00:00:00 2001 From: maximlt Date: Wed, 26 Jul 2023 02:03:11 +0200 Subject: [PATCH] change warning to FutureWarning --- param/parameterized.py | 4 ++-- tests/testdeprecations.py | 4 ++-- tests/testwatch.py | 7 +++++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/param/parameterized.py b/param/parameterized.py index 1f34f88e9..5c44b65f1 100644 --- a/param/parameterized.py +++ b/param/parameterized.py @@ -3804,13 +3804,13 @@ def param(self): #PARAM3_DEPRECATION @property - @_deprecated(extra_msg="Use `inst.param.watchers` instead.", warning_cat=UserWarning) + @_deprecated(extra_msg="Use `inst.param.watchers` instead.", warning_cat=FutureWarning) def _param_watchers(self): return self._param__private.watchers #PARAM3_DEPRECATION @_param_watchers.setter - @_deprecated(extra_msg="Use `inst.param.watchers = ...` instead.", warning_cat=UserWarning) + @_deprecated(extra_msg="Use `inst.param.watchers = ...` instead.", warning_cat=FutureWarning) def _param_watchers(self, value): self._param__private.watchers = value diff --git a/tests/testdeprecations.py b/tests/testdeprecations.py index ac1dc74ab..9d9ebdb6f 100644 --- a/tests/testdeprecations.py +++ b/tests/testdeprecations.py @@ -103,11 +103,11 @@ def test_deprecate_all_equal(self): param.parameterized.all_equal(1, 1) def test_deprecate_param_watchers(self): - with pytest.raises(UserWarning): + with pytest.raises(FutureWarning): param.parameterized.Parameterized()._param_watchers def test_deprecate_param_watchers_setter(self): - with pytest.raises(UserWarning): + with pytest.raises(FutureWarning): param.parameterized.Parameterized()._param_watchers = {} diff --git a/tests/testwatch.py b/tests/testwatch.py index a736131b7..7640d93a0 100644 --- a/tests/testwatch.py +++ b/tests/testwatch.py @@ -5,6 +5,7 @@ import unittest import param +import pytest from param.parameterized import discard_events @@ -550,7 +551,8 @@ def test_watch_watchers_exposed(self): obj.param.watch(lambda: '', ['a', 'b']) - pw = obj._param_watchers + with pytest.warns(FutureWarning): + pw = obj._param_watchers assert isinstance(pw, dict) for pname in ('a', 'b'): assert pname in pw @@ -564,7 +566,8 @@ def test_watch_watchers_modified(self): obj.param.watch(accumulator, ['a', 'b']) - pw = obj._param_watchers + with pytest.warns(FutureWarning): + pw = obj._param_watchers del pw['a'] obj.param.update(a=1, b=1)