| Server IP : 35.80.110.71 / Your IP : 216.73.216.52 Web Server : Apache/2.4.58 (Ubuntu) System : Linux ip-172-31-21-44 6.17.0-1019-aws #19~24.04.1-Ubuntu SMP Tue Jun 23 18:53:06 UTC 2026 x86_64 User : ubuntu ( 1000) PHP Version : 8.3.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /usr/lib/python3/dist-packages/numpy/array_api/tests/ |
Upload File : |
from numpy.testing import assert_raises
import numpy as np
from .. import all
from .._creation_functions import asarray
from .._dtypes import float64, int8
from .._manipulation_functions import (
concat,
reshape,
stack
)
def test_concat_errors():
assert_raises(TypeError, lambda: concat((1, 1), axis=None))
assert_raises(TypeError, lambda: concat([asarray([1], dtype=int8),
asarray([1], dtype=float64)]))
def test_stack_errors():
assert_raises(TypeError, lambda: stack([asarray([1, 1], dtype=int8),
asarray([2, 2], dtype=float64)]))
def test_reshape_copy():
a = asarray(np.ones((2, 3)))
b = reshape(a, (3, 2), copy=True)
assert not np.shares_memory(a._array, b._array)
a = asarray(np.ones((2, 3)))
b = reshape(a, (3, 2), copy=False)
assert np.shares_memory(a._array, b._array)
a = asarray(np.ones((2, 3)).T)
b = reshape(a, (3, 2), copy=True)
assert_raises(AttributeError, lambda: reshape(a, (2, 3), copy=False))