diff options
Diffstat (limited to 'numpy/lib/tests/test_function_base.py')
-rw-r--r-- | numpy/lib/tests/test_function_base.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py index 80faf85a6..cdc4285e8 100644 --- a/numpy/lib/tests/test_function_base.py +++ b/numpy/lib/tests/test_function_base.py @@ -1462,6 +1462,7 @@ class TestMeshgrid(TestCase): def test_no_input(self): args = [] assert_array_equal([], meshgrid(*args)) + assert_array_equal([], meshgrid(*args, copy=False)) def test_indexing(self): x = [1, 2, 3] @@ -1495,6 +1496,30 @@ class TestMeshgrid(TestCase): assert_raises(TypeError, meshgrid, [1, 2, 3], [4, 5, 6, 7], indices='ij') + def test_return_type(self): + # Test for appropriate dtype in returned arrays. + # Regression test for issue #5297 + # https://github.com/numpy/numpy/issues/5297 + x = np.arange(0, 10, dtype=np.float32) + y = np.arange(10, 20, dtype=np.float64) + + X, Y = np.meshgrid(x,y) + + assert_(X.dtype == x.dtype) + assert_(Y.dtype == y.dtype) + + # copy + X, Y = np.meshgrid(x,y, copy=True) + + assert_(X.dtype == x.dtype) + assert_(Y.dtype == y.dtype) + + # sparse + X, Y = np.meshgrid(x,y, sparse=True) + + assert_(X.dtype == x.dtype) + assert_(Y.dtype == y.dtype) + class TestPiecewise(TestCase): def test_simple(self): |