summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnkit Dwivedi <adwivedi@microsoft.com>2021-08-08 20:11:35 +0000
committerAnkit Dwivedi <adwivedi@microsoft.com>2021-08-08 20:11:35 +0000
commitf42da0df031a98bb17d22025a837466450a2e041 (patch)
tree982df1f10d0b7731f187713c57f7eaf18f9c5584
parent2e96755a08cee5651baa5e5da4ce054f4621b237 (diff)
downloadnumpy-f42da0df031a98bb17d22025a837466450a2e041.tar.gz
add a couple of whitespace tests for signature parsing in C code
-rw-r--r--numpy/core/tests/test_ufunc.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/numpy/core/tests/test_ufunc.py b/numpy/core/tests/test_ufunc.py
index dab11d948..38aa06753 100644
--- a/numpy/core/tests/test_ufunc.py
+++ b/numpy/core/tests/test_ufunc.py
@@ -388,6 +388,24 @@ class TestUfunc:
assert_equal(ixs, (0, 0, 0, 1, 2))
assert_equal(flags, (self.can_ignore, self.size_inferred, 0))
assert_equal(sizes, (3, -1, 9))
+
+ def test_signature9(self):
+ enabled, num_dims, ixs, flags, sizes = umt.test_signature(
+ 1, 1, "( 3) -> ( )")
+ assert_equal(enabled, 1)
+ assert_equal(num_dims, (1, 0))
+ assert_equal(ixs, (0,))
+ assert_equal(flags, (0,))
+ assert_equal(sizes, (3,))
+
+ def test_signature10(self):
+ enabled, num_dims, ixs, flags, sizes = umt.test_signature(
+ 3, 1, "( 3? ) , (3? , 3?) ,(n )-> ( 9)")
+ assert_equal(enabled, 1)
+ assert_equal(num_dims, (1, 2, 1, 1))
+ assert_equal(ixs, (0, 0, 0, 1, 2))
+ assert_equal(flags, (self.can_ignore, self.size_inferred, 0))
+ assert_equal(sizes, (3, -1, 9))
def test_signature_failure_extra_parenthesis(self):
with assert_raises(ValueError):