Skip to content

Commit

Permalink
Add tests for deprecate.
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanv committed Oct 25, 2009
1 parent b3f3088 commit 944524f
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions numpy/lib/tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from numpy.testing import *
import numpy.lib.utils as utils
from numpy.lib import deprecate

from StringIO import StringIO

def test_lookfor():
Expand All @@ -8,3 +10,29 @@ def test_lookfor():
import_modules=False)
out = out.getvalue()
assert 'numpy.linalg.eig' in out


@deprecate
def old_func(self, x):
return x

@deprecate(message="Rather use new_func2")
def old_func2(self, x):
return x

def old_func3(self, x):
return x
new_func3 = deprecate(old_func3, old_name="old_func3", new_name="new_func3")

def test_deprecate_decorator():
assert 'deprecated' in old_func.__doc__

def test_deprecate_decorator_message():
assert 'Rather use new_func2' in old_func2.__doc__

def test_deprecate_fn():
assert 'old_func3' in new_func3.__doc__
assert 'new_func3' in new_func3.__doc__

if __name__ == "__main__":
run_module_suite()

0 comments on commit 944524f

Please sign in to comment.