File: test_utils.py

package info (click to toggle)
python-numpy 1%3A1.4.1-5
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 12,736 kB
  • ctags: 14,035
  • sloc: ansic: 80,776; python: 62,482; makefile: 183; fortran: 121; f90: 42; cpp: 28; perl: 19; sh: 15
file content (38 lines) | stat: -rw-r--r-- 910 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from numpy.testing import *
import numpy.lib.utils as utils
from numpy.lib import deprecate

from StringIO import StringIO

def test_lookfor():
    out = StringIO()
    utils.lookfor('eigenvalue', module='numpy', output=out,
                  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()