Skip to content

Commit

Permalink
change warning to FutureWarning
Browse files Browse the repository at this point in the history
  • Loading branch information
maximlt committed Jul 26, 2023
1 parent 2a4ce47 commit d481965
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions param/parameterized.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions tests/testdeprecations.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}


Expand Down
7 changes: 5 additions & 2 deletions tests/testwatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import unittest

import param
import pytest

from param.parameterized import discard_events

Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down

0 comments on commit d481965

Please sign in to comment.