diff options
author | Matti Picus <matti.picus@gmail.com> | 2018-09-14 00:00:16 -0700 |
---|---|---|
committer | Eric Wieser <wieser.eric@gmail.com> | 2018-09-14 00:02:27 -0700 |
commit | f6584a5eda17e3002259a453f702f2b3ac453682 (patch) | |
tree | a8c1fe5b5ac482991f744b3e2dbd307c31280abc | |
parent | fc4a457c56c24aa4269de4845b17bea1110e5747 (diff) | |
download | numpy-f6584a5eda17e3002259a453f702f2b3ac453682.tar.gz |
TST: Split TestUfunc.test_signature into lots of smaller tests
-rw-r--r-- | numpy/core/tests/test_ufunc.py | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/numpy/core/tests/test_ufunc.py b/numpy/core/tests/test_ufunc.py index 0e564e305..85d9f41bd 100644 --- a/numpy/core/tests/test_ufunc.py +++ b/numpy/core/tests/test_ufunc.py @@ -286,7 +286,7 @@ class TestUfunc(object): """ pass - def test_signature(self): + def test_signature0(self): # the arguments to test_signature are: nin, nout, core_signature # pass enabled, num_dims, ixs = umt.test_signature(2, 1, "(i),(i)->()") @@ -294,12 +294,21 @@ class TestUfunc(object): assert_equal(num_dims, (1, 1, 0)) assert_equal(ixs, (0, 0)) + def test_signature1(self): # empty core signature; treat as plain ufunc (with trivial core) enabled, num_dims, ixs = umt.test_signature(2, 1, "(),()->()") assert_equal(enabled, 0) assert_equal(num_dims, (0, 0, 0)) assert_equal(ixs, ()) + def test_signature2(self): + # more complicated names for variables + enabled, num_dims, ixs = umt.test_signature(2, 1, "(i1,i2),(J_1)->(_kAB)") + assert_equal(enabled, 1) + assert_equal(num_dims, (2, 1, 1)) + assert_equal(ixs, (0, 1, 2, 3)) + + def test_signature_failure0(self): # in the following calls, a ValueError should be raised because # of error in core signature # FIXME These should be using assert_raises @@ -312,6 +321,7 @@ class TestUfunc(object): except ValueError: pass + def test_signature_failure1(self): # error: parenthesis matching msg = "core_sig: parenthesis matching" try: @@ -320,6 +330,7 @@ class TestUfunc(object): except ValueError: pass + def test_signature_failure2(self): # error: incomplete signature. letters outside of parenthesis are ignored msg = "core_sig: incomplete signature" try: @@ -328,6 +339,7 @@ class TestUfunc(object): except ValueError: pass + def test_signature_failure3(self): # error: incomplete signature. 2 output arguments are specified msg = "core_sig: incomplete signature" try: @@ -336,12 +348,6 @@ class TestUfunc(object): except ValueError: pass - # more complicated names for variables - enabled, num_dims, ixs = umt.test_signature(2, 1, "(i1,i2),(J_1)->(_kAB)") - assert_equal(enabled, 1) - assert_equal(num_dims, (2, 1, 1)) - assert_equal(ixs, (0, 1, 2, 3)) - def test_get_signature(self): assert_equal(umt.inner1d.signature, "(i),(i)->()") |