summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Peuch <cortex@worlddomination.be>2020-04-30 14:06:02 +0200
committerLaurent Peuch <cortex@worlddomination.be>2020-04-30 14:06:02 +0200
commit030b4e354371efe9acf15372636866619ec28c9c (patch)
tree437e56f402b17151a05f63e77bede674b8f85deb
parentda334a857b78de3749dc69a81b074d86c6bbea2b (diff)
downloadlogilab-common-030b4e354371efe9acf15372636866619ec28c9c.tar.gz
[deprecation] 'renamed' function renamed to 'callable_renamed'
-rw-r--r--logilab/common/deprecation.py5
-rw-r--r--test/unittest_deprecation.py4
2 files changed, 6 insertions, 3 deletions
diff --git a/logilab/common/deprecation.py b/logilab/common/deprecation.py
index 1c58970..ba34445 100644
--- a/logilab/common/deprecation.py
+++ b/logilab/common/deprecation.py
@@ -251,7 +251,7 @@ def moved(module_name, object_name, version=None, stacklevel=2):
return callnew
-def renamed(old_name, new_function, version=None):
+def callable_renamed(old_name, new_function, version=None):
"""use to tell that a callable has been renamed.
It returns a callable wrapper, so that when its called a warning is printed
@@ -273,6 +273,9 @@ def renamed(old_name, new_function, version=None):
return wrapped
+renamed = callable_renamed(old_name="renamed", new_function=callable_renamed)
+
+
def class_renamed(old_name, new_class, message=None, version=None):
"""automatically creates a class which fires a DeprecationWarning
when instantiated.
diff --git a/test/unittest_deprecation.py b/test/unittest_deprecation.py
index 7662a23..09ec45a 100644
--- a/test/unittest_deprecation.py
+++ b/test/unittest_deprecation.py
@@ -145,11 +145,11 @@ class RawInputTC(TestCase):
['[logilab.common] argument old of callable some_function has been removed and is '
'deprecated'])
- def test_renamed(self):
+ def test_callable_renamed(self):
def any_func():
pass
- old_func = deprecation.renamed("old_func", any_func)
+ old_func = deprecation.callable_renamed("old_func", any_func)
old_func()
self.assertEqual(self.messages,