diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2017-07-05 10:36:21 -0600 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2017-07-05 11:19:57 -0600 |
commit | ea0115974afa3539bdb21c351034c9e755b02591 (patch) | |
tree | 88812ce227b2a6b1b1daa13faacbab76823dfad8 /numpy/testing | |
parent | 0ad966df24b514f0713e2f32e9b6baa4ad883d5f (diff) | |
download | numpy-ea0115974afa3539bdb21c351034c9e755b02591.tar.gz |
TST: Add test of new `parametrize` decorator.
The new decorator was added to numpy.testing in order to facilitate the
transition to using pytest.
Diffstat (limited to 'numpy/testing')
-rw-r--r-- | numpy/testing/tests/test_decorators.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/numpy/testing/tests/test_decorators.py b/numpy/testing/tests/test_decorators.py index 02cd9fb88..1258a9296 100644 --- a/numpy/testing/tests/test_decorators.py +++ b/numpy/testing/tests/test_decorators.py @@ -1,3 +1,7 @@ +""" +Test the decorators from ``testing.decorators``. + +""" from __future__ import division, absolute_import, print_function import warnings @@ -13,6 +17,7 @@ def test_slow(): assert_(slow_func.slow) + def test_setastest(): @dec.setastest() def f_default(a): @@ -30,6 +35,7 @@ def test_setastest(): assert_(f_istest.__test__) assert_(not f_isnottest.__test__) + class DidntSkipException(Exception): pass @@ -182,5 +188,13 @@ def test_deprecated(): assert_raises(AssertionError, deprecated_func3) +@dec.parametrize('base, power, expected', + [(1, 1, 1), + (2, 1, 2), + (2, 2, 4)]) +def test_parametrize(base, power, expected): + assert_(base**power == expected) + + if __name__ == '__main__': run_module_suite() |