OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
reader
/
hps
/
faces
/
faces
/
lib
/
python3.10
/
site-packages
/
numpy
/
core
/
tests
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
10/26/2024 01:29:21 PM
rwxr-xr-x
📄
__init__.py
0 bytes
10/26/2024 01:28:11 PM
rw-r--r--
📁
__pycache__
-
10/26/2024 01:29:24 PM
rwxr-xr-x
📄
_locales.py
2.15 KB
10/26/2024 01:28:11 PM
rw-r--r--
📁
data
-
10/26/2024 01:29:22 PM
rwxr-xr-x
📁
examples
-
10/26/2024 01:30:05 PM
rwxr-xr-x
📄
test__exceptions.py
2.78 KB
10/26/2024 01:28:11 PM
rw-r--r--
📄
test_abc.py
2.17 KB
10/26/2024 01:28:09 PM
rw-r--r--
📄
test_api.py
21.91 KB
10/26/2024 01:28:09 PM
rw-r--r--
📄
test_argparse.py
1.93 KB
10/26/2024 01:28:09 PM
rw-r--r--
📄
test_array_coercion.py
31.51 KB
10/26/2024 01:28:09 PM
rw-r--r--
📄
test_array_interface.py
7.42 KB
10/26/2024 01:28:09 PM
rw-r--r--
📄
test_arraymethod.py
3.49 KB
10/26/2024 01:28:09 PM
rw-r--r--
📄
test_arrayprint.py
36.29 KB
10/26/2024 01:28:09 PM
rw-r--r--
📄
test_casting_floatingpoint_errors.py
4.94 KB
10/26/2024 01:28:09 PM
rw-r--r--
📄
test_casting_unittests.py
33.49 KB
10/26/2024 01:28:09 PM
rw-r--r--
📄
test_conversion_utils.py
6.41 KB
10/26/2024 01:28:09 PM
rw-r--r--
📄
test_cpu_dispatcher.py
1.49 KB
10/26/2024 01:28:09 PM
rw-r--r--
📄
test_cpu_features.py
7 KB
10/26/2024 01:28:09 PM
rw-r--r--
📄
test_custom_dtypes.py
7.5 KB
10/26/2024 01:28:09 PM
rw-r--r--
📄
test_cython.py
3.54 KB
10/26/2024 01:28:09 PM
rw-r--r--
📄
test_datetime.py
112.48 KB
10/26/2024 01:28:09 PM
rw-r--r--
📄
test_defchararray.py
24.03 KB
10/26/2024 01:28:09 PM
rw-r--r--
📄
test_deprecations.py
44.43 KB
10/26/2024 01:28:09 PM
rw-r--r--
📄
test_dlpack.py
3.42 KB
10/26/2024 01:28:09 PM
rw-r--r--
📄
test_dtype.py
70.86 KB
10/26/2024 01:28:09 PM
rw-r--r--
📄
test_einsum.py
49 KB
10/26/2024 01:28:09 PM
rw-r--r--
📄
test_errstate.py
2.17 KB
10/26/2024 01:28:09 PM
rw-r--r--
📄
test_extint128.py
5.51 KB
10/26/2024 01:28:09 PM
rw-r--r--
📄
test_function_base.py
14.07 KB
10/26/2024 01:28:09 PM
rw-r--r--
📄
test_getlimits.py
5.18 KB
10/26/2024 01:28:09 PM
rw-r--r--
📄
test_half.py
23.66 KB
10/26/2024 01:28:09 PM
rw-r--r--
📄
test_hashtable.py
1011 bytes
10/26/2024 01:28:09 PM
rw-r--r--
📄
test_indexerrors.py
5.01 KB
10/26/2024 01:28:09 PM
rw-r--r--
📄
test_indexing.py
53.04 KB
10/26/2024 01:28:09 PM
rw-r--r--
📄
test_item_selection.py
3.5 KB
10/26/2024 01:28:09 PM
rw-r--r--
📄
test_limited_api.py
1.14 KB
10/26/2024 01:28:09 PM
rw-r--r--
📄
test_longdouble.py
12.74 KB
10/26/2024 01:28:10 PM
rw-r--r--
📄
test_machar.py
1.04 KB
10/26/2024 01:28:10 PM
rw-r--r--
📄
test_mem_overlap.py
28.41 KB
10/26/2024 01:28:10 PM
rw-r--r--
📄
test_mem_policy.py
15.57 KB
10/26/2024 01:28:10 PM
rw-r--r--
📄
test_memmap.py
7.31 KB
10/26/2024 01:28:10 PM
rw-r--r--
📄
test_multiarray.py
361.83 KB
10/26/2024 01:28:10 PM
rw-r--r--
📄
test_nditer.py
126.52 KB
10/26/2024 01:28:10 PM
rw-r--r--
📄
test_nep50_promotions.py
6.31 KB
10/26/2024 01:28:10 PM
rw-r--r--
📄
test_numeric.py
134.44 KB
10/26/2024 01:28:10 PM
rw-r--r--
📄
test_numerictypes.py
20.76 KB
10/26/2024 01:28:10 PM
rw-r--r--
📄
test_overrides.py
21.57 KB
10/26/2024 01:28:10 PM
rw-r--r--
📄
test_print.py
6.58 KB
10/26/2024 01:28:10 PM
rw-r--r--
📄
test_protocols.py
1.14 KB
10/26/2024 01:28:10 PM
rw-r--r--
📄
test_records.py
19.79 KB
10/26/2024 01:28:10 PM
rw-r--r--
📄
test_regression.py
89.1 KB
10/26/2024 01:28:10 PM
rw-r--r--
📄
test_scalar_ctors.py
5.97 KB
10/26/2024 01:28:10 PM
rw-r--r--
📄
test_scalar_methods.py
7.69 KB
10/26/2024 01:28:10 PM
rw-r--r--
📄
test_scalarbuffer.py
5.46 KB
10/26/2024 01:28:10 PM
rw-r--r--
📄
test_scalarinherit.py
2.32 KB
10/26/2024 01:28:10 PM
rw-r--r--
📄
test_scalarmath.py
41.81 KB
10/26/2024 01:28:10 PM
rw-r--r--
📄
test_scalarprint.py
18.26 KB
10/26/2024 01:28:10 PM
rw-r--r--
📄
test_shape_base.py
28.97 KB
10/26/2024 01:28:10 PM
rw-r--r--
📄
test_simd.py
42.6 KB
10/26/2024 01:28:10 PM
rw-r--r--
📄
test_simd_module.py
3.72 KB
10/26/2024 01:28:11 PM
rw-r--r--
📄
test_strings.py
3.75 KB
10/26/2024 01:28:11 PM
rw-r--r--
📄
test_ufunc.py
113.7 KB
10/26/2024 01:28:11 PM
rw-r--r--
📄
test_umath.py
168.45 KB
10/26/2024 01:28:11 PM
rw-r--r--
📄
test_umath_accuracy.py
3.81 KB
10/26/2024 01:28:11 PM
rw-r--r--
📄
test_umath_complex.py
22.7 KB
10/26/2024 01:28:11 PM
rw-r--r--
📄
test_unicode.py
12.35 KB
10/26/2024 01:28:11 PM
rw-r--r--
Editing: test_arraymethod.py
Close
""" This file tests the generic aspects of ArrayMethod. At the time of writing this is private API, but when added, public API may be added here. """ from __future__ import annotations import sys import types from typing import Any import pytest import numpy as np from numpy.core._multiarray_umath import _get_castingimpl as get_castingimpl class TestResolveDescriptors: # Test mainly error paths of the resolve_descriptors function, # note that the `casting_unittests` tests exercise this non-error paths. # Casting implementations are the main/only current user: method = get_castingimpl(type(np.dtype("d")), type(np.dtype("f"))) @pytest.mark.parametrize("args", [ (True,), # Not a tuple. ((None,)), # Too few elements ((None, None, None),), # Too many ((None, None),), # Input dtype is None, which is invalid. ((np.dtype("d"), True),), # Output dtype is not a dtype ((np.dtype("f"), None),), # Input dtype does not match method ]) def test_invalid_arguments(self, args): with pytest.raises(TypeError): self.method._resolve_descriptors(*args) class TestSimpleStridedCall: # Test mainly error paths of the resolve_descriptors function, # note that the `casting_unittests` tests exercise this non-error paths. # Casting implementations are the main/only current user: method = get_castingimpl(type(np.dtype("d")), type(np.dtype("f"))) @pytest.mark.parametrize(["args", "error"], [ ((True,), TypeError), # Not a tuple (((None,),), TypeError), # Too few elements ((None, None), TypeError), # Inputs are not arrays. (((None, None, None),), TypeError), # Too many (((np.arange(3), np.arange(3)),), TypeError), # Incorrect dtypes (((np.ones(3, dtype=">d"), np.ones(3, dtype="<f")),), TypeError), # Does not support byte-swapping (((np.ones((2, 2), dtype="d"), np.ones((2, 2), dtype="f")),), ValueError), # not 1-D (((np.ones(3, dtype="d"), np.ones(4, dtype="f")),), ValueError), # different length (((np.frombuffer(b"\0x00"*3*2, dtype="d"), np.frombuffer(b"\0x00"*3, dtype="f")),), ValueError), # output not writeable ]) def test_invalid_arguments(self, args, error): # This is private API, which may be modified freely with pytest.raises(error): self.method._simple_strided_call(*args) @pytest.mark.skipif(sys.version_info < (3, 9), reason="Requires python 3.9") @pytest.mark.parametrize( "cls", [np.ndarray, np.recarray, np.chararray, np.matrix, np.memmap] ) class TestClassGetItem: def test_class_getitem(self, cls: type[np.ndarray]) -> None: """Test `ndarray.__class_getitem__`.""" alias = cls[Any, Any] assert isinstance(alias, types.GenericAlias) assert alias.__origin__ is cls @pytest.mark.parametrize("arg_len", range(4)) def test_subscript_tup(self, cls: type[np.ndarray], arg_len: int) -> None: arg_tup = (Any,) * arg_len if arg_len in (1, 2): assert cls[arg_tup] else: match = f"Too {'few' if arg_len == 0 else 'many'} arguments" with pytest.raises(TypeError, match=match): cls[arg_tup] @pytest.mark.skipif(sys.version_info >= (3, 9), reason="Requires python 3.8") def test_class_getitem_38() -> None: match = "Type subscription requires python >= 3.9" with pytest.raises(TypeError, match=match): np.ndarray[Any, Any]