summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDCtheTall <dylancutler@google.com>2021-04-05 15:50:16 -0400
committerDCtheTall <dylancutler@google.com>2021-04-05 15:50:16 -0400
commit9f339758e3faeb447a629d600f7640c8735a6c4a (patch)
treebeef8af9553003335afddbdf6f079f55ad70c498
parent2a880214c0ffb9c21b12ab51fbb364d71aa17cd1 (diff)
downloadnumpy-9f339758e3faeb447a629d600f7640c8735a6c4a.tar.gz
review comments
-rw-r--r--numpy/lib/tests/test_function_base.py19
1 files changed, 13 insertions, 6 deletions
diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py
index 8dcbaa034..761ea83a3 100644
--- a/numpy/lib/tests/test_function_base.py
+++ b/numpy/lib/tests/test_function_base.py
@@ -2307,12 +2307,7 @@ class TestMeshgrid:
assert_equal(x[0, :], 0)
assert_equal(x[1, :], X)
- def test_higher_dimensions(self):
- a, b, c = np.meshgrid([0], [1, 1], [2, 2])
- assert_equal(a, [[[0, 0]], [[0, 0]]])
- assert_equal(b, [[[1, 1]], [[1, 1]]])
- assert_equal(c, [[[2, 2]], [[2, 2]]])
-
+ def test_nd_shape(self):
a, b, c, d, e = np.meshgrid(*([0] * i for i in range(1, 6)))
expected_shape = (2, 1, 3, 4, 5)
assert_equal(a.shape, expected_shape)
@@ -2321,6 +2316,18 @@ class TestMeshgrid:
assert_equal(d.shape, expected_shape)
assert_equal(e.shape, expected_shape)
+ def test_nd_values(self):
+ a, b, c = np.meshgrid([0], [1, 2], [3, 4, 5])
+ assert_equal(a, [[[0, 0, 0]], [[0, 0, 0]]])
+ assert_equal(b, [[[1, 1, 1]], [[2, 2, 2]]])
+ assert_equal(c, [[[3, 4, 5]], [[3, 4, 5]]])
+
+ def test_nd_indexing(self):
+ a, b, c = np.meshgrid([0], [1, 2], [3, 4, 5], indexing='ij')
+ assert_equal(a, [[[0, 0, 0], [0, 0, 0]]])
+ assert_equal(b, [[[1, 1, 1], [2, 2, 2]]])
+ assert_equal(c, [[[3, 4, 5], [3, 4, 5]]])
+
class TestPiecewise: