summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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,