diff options
author | robot-piglet <robot-piglet@yandex-team.com> | 2023-11-17 02:01:41 +0300 |
---|---|---|
committer | robot-piglet <robot-piglet@yandex-team.com> | 2023-11-17 02:24:06 +0300 |
commit | 32b5c7f0dc79d7273495e0c99ca3d740c6bd3692 (patch) | |
tree | 1225a585712c8d065a35bb3ab99e1e71e34aff4c | |
parent | e41b57c58ab010e277155bc6dcf13c56f26cb606 (diff) | |
download | ydb-32b5c7f0dc79d7273495e0c99ca3d740c6bd3692.tar.gz |
Intermediate changes
11 files changed, 513 insertions, 237 deletions
diff --git a/contrib/python/numpy/py3/numpy/core/tests/test_longdouble.py b/contrib/python/numpy/py3/numpy/core/tests/test_longdouble.py index 7b4e6e59cb..d56cbb17bc 100644 --- a/contrib/python/numpy/py3/numpy/core/tests/test_longdouble.py +++ b/contrib/python/numpy/py3/numpy/core/tests/test_longdouble.py @@ -7,7 +7,7 @@ from numpy.testing import ( assert_, assert_equal, assert_raises, assert_warns, assert_array_equal, temppath, IS_MUSL ) -from __tests__.core.tests._locales import CommaDecimalPointLocale +from __tests__.numpy.core.tests._locales import CommaDecimalPointLocale LD_INFO = np.finfo(np.longdouble) diff --git a/contrib/python/numpy/py3/numpy/core/tests/test_multiarray.py b/contrib/python/numpy/py3/numpy/core/tests/test_multiarray.py index c80d8d3ff6..fc3b871532 100644 --- a/contrib/python/numpy/py3/numpy/core/tests/test_multiarray.py +++ b/contrib/python/numpy/py3/numpy/core/tests/test_multiarray.py @@ -33,7 +33,7 @@ from numpy.testing import ( runstring, temppath, suppress_warnings, break_cycles, _SUPPORTS_SVE, ) from numpy.testing._private.utils import requires_memory, _no_tracing -from __tests__.core.tests._locales import CommaDecimalPointLocale +from __tests__.numpy.core.tests._locales import CommaDecimalPointLocale from numpy.lib.recfunctions import repack_fields from numpy.core.multiarray import _get_ndarray_c_version diff --git a/contrib/python/numpy/py3/numpy/core/tests/test_print.py b/contrib/python/numpy/py3/numpy/core/tests/test_print.py index e94dfdbb16..148f231eca 100644 --- a/contrib/python/numpy/py3/numpy/core/tests/test_print.py +++ b/contrib/python/numpy/py3/numpy/core/tests/test_print.py @@ -4,7 +4,7 @@ import pytest import numpy as np from numpy.testing import assert_, assert_equal, IS_MUSL -from __tests__.core.tests._locales import CommaDecimalPointLocale +from __tests__.numpy.core.tests._locales import CommaDecimalPointLocale from io import StringIO diff --git a/contrib/python/numpy/py3/numpy/core/tests/test_records.py b/contrib/python/numpy/py3/numpy/core/tests/test_records.py index 0cf81a98c2..425d7761e6 100644 --- a/contrib/python/numpy/py3/numpy/core/tests/test_records.py +++ b/contrib/python/numpy/py3/numpy/core/tests/test_records.py @@ -12,8 +12,6 @@ from numpy.testing import ( ) from numpy.compat import pickle -import yatest.common - class TestFromrecords: def test_fromrecords(self): @@ -75,7 +73,8 @@ class TestFromrecords: assert_equal(r.a, np.array([1, 2, 3, 4])) def test_recarray_fromfile(self): - data_dir = path.join(yatest.common.source_path('contrib/python/numpy/py3/numpy/core/tests'), 'data') + import yatest.common as yc + data_dir = yc.source_path(path.join(path.dirname(__file__), 'data')) filename = path.join(data_dir, 'recarray_from_file.fits') fd = open(filename, 'rb') fd.seek(2880 * 2) diff --git a/contrib/python/numpy/py3/numpy/core/tests/test_regression.py b/contrib/python/numpy/py3/numpy/core/tests/test_regression.py index defe3d6f15..4348ff93e8 100644 --- a/contrib/python/numpy/py3/numpy/core/tests/test_regression.py +++ b/contrib/python/numpy/py3/numpy/core/tests/test_regression.py @@ -17,8 +17,6 @@ from numpy.testing import ( from numpy.testing._private.utils import _no_tracing, requires_memory from numpy.compat import asbytes, asunicode, pickle -import yatest.common - class TestRegression: def test_invalid_round(self): @@ -1085,7 +1083,8 @@ class TestRegression: # Ticket #788, changeset r5155 # The test data file was generated by scipy.io.savemat. # The dtype is float64, but the isbuiltin attribute is 0. - data_dir = path.join(yatest.common.source_path('contrib/python/numpy/py3/numpy/core/tests'), 'data') + import yatest.common as yc + data_dir = yc.source_path(path.join(path.dirname(__file__), 'data')) filename = path.join(data_dir, "astype_copy.pkl") with open(filename, 'rb') as f: xp = pickle.load(f, encoding='latin1') diff --git a/contrib/python/numpy/py3/numpy/core/tests/test_umath_accuracy.py b/contrib/python/numpy/py3/numpy/core/tests/test_umath_accuracy.py index ebd3d67700..90f71dae03 100644 --- a/contrib/python/numpy/py3/numpy/core/tests/test_umath_accuracy.py +++ b/contrib/python/numpy/py3/numpy/core/tests/test_umath_accuracy.py @@ -13,8 +13,6 @@ UNARY_UFUNCS = [obj for obj in np.core.umath.__dict__.values() if UNARY_OBJECT_UFUNCS = [uf for uf in UNARY_UFUNCS if "O->O" in uf.types] UNARY_OBJECT_UFUNCS.remove(getattr(np, 'invert')) -import yatest.common - IS_AVX = __cpu_features__.get('AVX512F', False) or \ (__cpu_features__.get('FMA3', False) and __cpu_features__.get('AVX2', False)) # only run on linux with AVX, also avoid old glibc (numpy/numpy#20448). @@ -43,7 +41,8 @@ class TestAccuracy: @platform_skip def test_validate_transcendentals(self): with np.errstate(all='ignore'): - data_dir = path.join(yatest.common.source_path('contrib/python/numpy/py3/numpy/core/tests'), 'data') + import yatest.common as yc + data_dir = yc.source_path(path.join(path.dirname(__file__), 'data')) files = os.listdir(data_dir) files = list(filter(lambda f: f.endswith('.csv'), files)) for filename in files: diff --git a/contrib/python/numpy/py3/numpy/lib/tests/test_format.py b/contrib/python/numpy/py3/numpy/lib/tests/test_format.py index 766c499c28..da6c89f676 100644 --- a/contrib/python/numpy/py3/numpy/lib/tests/test_format.py +++ b/contrib/python/numpy/py3/numpy/lib/tests/test_format.py @@ -1,3 +1,279 @@ +# doctest +r''' Test the .npy file format. + +Set up: + + >>> import sys + >>> from io import BytesIO + >>> from numpy.lib import format + >>> + >>> scalars = [ + ... np.uint8, + ... np.int8, + ... np.uint16, + ... np.int16, + ... np.uint32, + ... np.int32, + ... np.uint64, + ... np.int64, + ... np.float32, + ... np.float64, + ... np.complex64, + ... np.complex128, + ... object, + ... ] + >>> + >>> basic_arrays = [] + >>> + >>> for scalar in scalars: + ... for endian in '<>': + ... dtype = np.dtype(scalar).newbyteorder(endian) + ... basic = np.arange(15).astype(dtype) + ... basic_arrays.extend([ + ... np.array([], dtype=dtype), + ... np.array(10, dtype=dtype), + ... basic, + ... basic.reshape((3,5)), + ... basic.reshape((3,5)).T, + ... basic.reshape((3,5))[::-1,::2], + ... ]) + ... + >>> + >>> Pdescr = [ + ... ('x', 'i4', (2,)), + ... ('y', 'f8', (2, 2)), + ... ('z', 'u1')] + >>> + >>> + >>> PbufferT = [ + ... ([3,2], [[6.,4.],[6.,4.]], 8), + ... ([4,3], [[7.,5.],[7.,5.]], 9), + ... ] + >>> + >>> + >>> Ndescr = [ + ... ('x', 'i4', (2,)), + ... ('Info', [ + ... ('value', 'c16'), + ... ('y2', 'f8'), + ... ('Info2', [ + ... ('name', 'S2'), + ... ('value', 'c16', (2,)), + ... ('y3', 'f8', (2,)), + ... ('z3', 'u4', (2,))]), + ... ('name', 'S2'), + ... ('z2', 'b1')]), + ... ('color', 'S2'), + ... ('info', [ + ... ('Name', 'U8'), + ... ('Value', 'c16')]), + ... ('y', 'f8', (2, 2)), + ... ('z', 'u1')] + >>> + >>> + >>> NbufferT = [ + ... ([3,2], (6j, 6., ('nn', [6j,4j], [6.,4.], [1,2]), 'NN', True), 'cc', ('NN', 6j), [[6.,4.],[6.,4.]], 8), + ... ([4,3], (7j, 7., ('oo', [7j,5j], [7.,5.], [2,1]), 'OO', False), 'dd', ('OO', 7j), [[7.,5.],[7.,5.]], 9), + ... ] + >>> + >>> + >>> record_arrays = [ + ... np.array(PbufferT, dtype=np.dtype(Pdescr).newbyteorder('<')), + ... np.array(NbufferT, dtype=np.dtype(Ndescr).newbyteorder('<')), + ... np.array(PbufferT, dtype=np.dtype(Pdescr).newbyteorder('>')), + ... np.array(NbufferT, dtype=np.dtype(Ndescr).newbyteorder('>')), + ... ] + +Test the magic string writing. + + >>> format.magic(1, 0) + b'\x93NUMPY\x01\x00' + >>> format.magic(0, 0) + b'\x93NUMPY\x00\x00' + >>> format.magic(255, 255) + b'\x93NUMPY\xff\xff' + >>> format.magic(2, 5) + b'\x93NUMPY\x02\x05' + +Test the magic string reading. + + >>> format.read_magic(BytesIO(format.magic(1, 0))) + (1, 0) + >>> format.read_magic(BytesIO(format.magic(0, 0))) + (0, 0) + >>> format.read_magic(BytesIO(format.magic(255, 255))) + (255, 255) + >>> format.read_magic(BytesIO(format.magic(2, 5))) + (2, 5) + +Test the header writing. + + >>> for arr in basic_arrays + record_arrays: # doctest: +SKIP + ... f = BytesIO() + ... format.write_array_header_1_0(f, arr) # XXX: arr is not a dict, items gets called on it + ... print(repr(f.getvalue())) + ... + "F\x00{'descr': '|u1', 'fortran_order': False, 'shape': (0,)} \n" + "F\x00{'descr': '|u1', 'fortran_order': False, 'shape': ()} \n" + "F\x00{'descr': '|u1', 'fortran_order': False, 'shape': (15,)} \n" + "F\x00{'descr': '|u1', 'fortran_order': False, 'shape': (3, 5)} \n" + "F\x00{'descr': '|u1', 'fortran_order': True, 'shape': (5, 3)} \n" + "F\x00{'descr': '|u1', 'fortran_order': False, 'shape': (3, 3)} \n" + "F\x00{'descr': '|u1', 'fortran_order': False, 'shape': (0,)} \n" + "F\x00{'descr': '|u1', 'fortran_order': False, 'shape': ()} \n" + "F\x00{'descr': '|u1', 'fortran_order': False, 'shape': (15,)} \n" + "F\x00{'descr': '|u1', 'fortran_order': False, 'shape': (3, 5)} \n" + "F\x00{'descr': '|u1', 'fortran_order': True, 'shape': (5, 3)} \n" + "F\x00{'descr': '|u1', 'fortran_order': False, 'shape': (3, 3)} \n" + "F\x00{'descr': '|i1', 'fortran_order': False, 'shape': (0,)} \n" + "F\x00{'descr': '|i1', 'fortran_order': False, 'shape': ()} \n" + "F\x00{'descr': '|i1', 'fortran_order': False, 'shape': (15,)} \n" + "F\x00{'descr': '|i1', 'fortran_order': False, 'shape': (3, 5)} \n" + "F\x00{'descr': '|i1', 'fortran_order': True, 'shape': (5, 3)} \n" + "F\x00{'descr': '|i1', 'fortran_order': False, 'shape': (3, 3)} \n" + "F\x00{'descr': '|i1', 'fortran_order': False, 'shape': (0,)} \n" + "F\x00{'descr': '|i1', 'fortran_order': False, 'shape': ()} \n" + "F\x00{'descr': '|i1', 'fortran_order': False, 'shape': (15,)} \n" + "F\x00{'descr': '|i1', 'fortran_order': False, 'shape': (3, 5)} \n" + "F\x00{'descr': '|i1', 'fortran_order': True, 'shape': (5, 3)} \n" + "F\x00{'descr': '|i1', 'fortran_order': False, 'shape': (3, 3)} \n" + "F\x00{'descr': '<u2', 'fortran_order': False, 'shape': (0,)} \n" + "F\x00{'descr': '<u2', 'fortran_order': False, 'shape': ()} \n" + "F\x00{'descr': '<u2', 'fortran_order': False, 'shape': (15,)} \n" + "F\x00{'descr': '<u2', 'fortran_order': False, 'shape': (3, 5)} \n" + "F\x00{'descr': '<u2', 'fortran_order': True, 'shape': (5, 3)} \n" + "F\x00{'descr': '<u2', 'fortran_order': False, 'shape': (3, 3)} \n" + "F\x00{'descr': '>u2', 'fortran_order': False, 'shape': (0,)} \n" + "F\x00{'descr': '>u2', 'fortran_order': False, 'shape': ()} \n" + "F\x00{'descr': '>u2', 'fortran_order': False, 'shape': (15,)} \n" + "F\x00{'descr': '>u2', 'fortran_order': False, 'shape': (3, 5)} \n" + "F\x00{'descr': '>u2', 'fortran_order': True, 'shape': (5, 3)} \n" + "F\x00{'descr': '>u2', 'fortran_order': False, 'shape': (3, 3)} \n" + "F\x00{'descr': '<i2', 'fortran_order': False, 'shape': (0,)} \n" + "F\x00{'descr': '<i2', 'fortran_order': False, 'shape': ()} \n" + "F\x00{'descr': '<i2', 'fortran_order': False, 'shape': (15,)} \n" + "F\x00{'descr': '<i2', 'fortran_order': False, 'shape': (3, 5)} \n" + "F\x00{'descr': '<i2', 'fortran_order': True, 'shape': (5, 3)} \n" + "F\x00{'descr': '<i2', 'fortran_order': False, 'shape': (3, 3)} \n" + "F\x00{'descr': '>i2', 'fortran_order': False, 'shape': (0,)} \n" + "F\x00{'descr': '>i2', 'fortran_order': False, 'shape': ()} \n" + "F\x00{'descr': '>i2', 'fortran_order': False, 'shape': (15,)} \n" + "F\x00{'descr': '>i2', 'fortran_order': False, 'shape': (3, 5)} \n" + "F\x00{'descr': '>i2', 'fortran_order': True, 'shape': (5, 3)} \n" + "F\x00{'descr': '>i2', 'fortran_order': False, 'shape': (3, 3)} \n" + "F\x00{'descr': '<u4', 'fortran_order': False, 'shape': (0,)} \n" + "F\x00{'descr': '<u4', 'fortran_order': False, 'shape': ()} \n" + "F\x00{'descr': '<u4', 'fortran_order': False, 'shape': (15,)} \n" + "F\x00{'descr': '<u4', 'fortran_order': False, 'shape': (3, 5)} \n" + "F\x00{'descr': '<u4', 'fortran_order': True, 'shape': (5, 3)} \n" + "F\x00{'descr': '<u4', 'fortran_order': False, 'shape': (3, 3)} \n" + "F\x00{'descr': '>u4', 'fortran_order': False, 'shape': (0,)} \n" + "F\x00{'descr': '>u4', 'fortran_order': False, 'shape': ()} \n" + "F\x00{'descr': '>u4', 'fortran_order': False, 'shape': (15,)} \n" + "F\x00{'descr': '>u4', 'fortran_order': False, 'shape': (3, 5)} \n" + "F\x00{'descr': '>u4', 'fortran_order': True, 'shape': (5, 3)} \n" + "F\x00{'descr': '>u4', 'fortran_order': False, 'shape': (3, 3)} \n" + "F\x00{'descr': '<i4', 'fortran_order': False, 'shape': (0,)} \n" + "F\x00{'descr': '<i4', 'fortran_order': False, 'shape': ()} \n" + "F\x00{'descr': '<i4', 'fortran_order': False, 'shape': (15,)} \n" + "F\x00{'descr': '<i4', 'fortran_order': False, 'shape': (3, 5)} \n" + "F\x00{'descr': '<i4', 'fortran_order': True, 'shape': (5, 3)} \n" + "F\x00{'descr': '<i4', 'fortran_order': False, 'shape': (3, 3)} \n" + "F\x00{'descr': '>i4', 'fortran_order': False, 'shape': (0,)} \n" + "F\x00{'descr': '>i4', 'fortran_order': False, 'shape': ()} \n" + "F\x00{'descr': '>i4', 'fortran_order': False, 'shape': (15,)} \n" + "F\x00{'descr': '>i4', 'fortran_order': False, 'shape': (3, 5)} \n" + "F\x00{'descr': '>i4', 'fortran_order': True, 'shape': (5, 3)} \n" + "F\x00{'descr': '>i4', 'fortran_order': False, 'shape': (3, 3)} \n" + "F\x00{'descr': '<u8', 'fortran_order': False, 'shape': (0,)} \n" + "F\x00{'descr': '<u8', 'fortran_order': False, 'shape': ()} \n" + "F\x00{'descr': '<u8', 'fortran_order': False, 'shape': (15,)} \n" + "F\x00{'descr': '<u8', 'fortran_order': False, 'shape': (3, 5)} \n" + "F\x00{'descr': '<u8', 'fortran_order': True, 'shape': (5, 3)} \n" + "F\x00{'descr': '<u8', 'fortran_order': False, 'shape': (3, 3)} \n" + "F\x00{'descr': '>u8', 'fortran_order': False, 'shape': (0,)} \n" + "F\x00{'descr': '>u8', 'fortran_order': False, 'shape': ()} \n" + "F\x00{'descr': '>u8', 'fortran_order': False, 'shape': (15,)} \n" + "F\x00{'descr': '>u8', 'fortran_order': False, 'shape': (3, 5)} \n" + "F\x00{'descr': '>u8', 'fortran_order': True, 'shape': (5, 3)} \n" + "F\x00{'descr': '>u8', 'fortran_order': False, 'shape': (3, 3)} \n" + "F\x00{'descr': '<i8', 'fortran_order': False, 'shape': (0,)} \n" + "F\x00{'descr': '<i8', 'fortran_order': False, 'shape': ()} \n" + "F\x00{'descr': '<i8', 'fortran_order': False, 'shape': (15,)} \n" + "F\x00{'descr': '<i8', 'fortran_order': False, 'shape': (3, 5)} \n" + "F\x00{'descr': '<i8', 'fortran_order': True, 'shape': (5, 3)} \n" + "F\x00{'descr': '<i8', 'fortran_order': False, 'shape': (3, 3)} \n" + "F\x00{'descr': '>i8', 'fortran_order': False, 'shape': (0,)} \n" + "F\x00{'descr': '>i8', 'fortran_order': False, 'shape': ()} \n" + "F\x00{'descr': '>i8', 'fortran_order': False, 'shape': (15,)} \n" + "F\x00{'descr': '>i8', 'fortran_order': False, 'shape': (3, 5)} \n" + "F\x00{'descr': '>i8', 'fortran_order': True, 'shape': (5, 3)} \n" + "F\x00{'descr': '>i8', 'fortran_order': False, 'shape': (3, 3)} \n" + "F\x00{'descr': '<f4', 'fortran_order': False, 'shape': (0,)} \n" + "F\x00{'descr': '<f4', 'fortran_order': False, 'shape': ()} \n" + "F\x00{'descr': '<f4', 'fortran_order': False, 'shape': (15,)} \n" + "F\x00{'descr': '<f4', 'fortran_order': False, 'shape': (3, 5)} \n" + "F\x00{'descr': '<f4', 'fortran_order': True, 'shape': (5, 3)} \n" + "F\x00{'descr': '<f4', 'fortran_order': False, 'shape': (3, 3)} \n" + "F\x00{'descr': '>f4', 'fortran_order': False, 'shape': (0,)} \n" + "F\x00{'descr': '>f4', 'fortran_order': False, 'shape': ()} \n" + "F\x00{'descr': '>f4', 'fortran_order': False, 'shape': (15,)} \n" + "F\x00{'descr': '>f4', 'fortran_order': False, 'shape': (3, 5)} \n" + "F\x00{'descr': '>f4', 'fortran_order': True, 'shape': (5, 3)} \n" + "F\x00{'descr': '>f4', 'fortran_order': False, 'shape': (3, 3)} \n" + "F\x00{'descr': '<f8', 'fortran_order': False, 'shape': (0,)} \n" + "F\x00{'descr': '<f8', 'fortran_order': False, 'shape': ()} \n" + "F\x00{'descr': '<f8', 'fortran_order': False, 'shape': (15,)} \n" + "F\x00{'descr': '<f8', 'fortran_order': False, 'shape': (3, 5)} \n" + "F\x00{'descr': '<f8', 'fortran_order': True, 'shape': (5, 3)} \n" + "F\x00{'descr': '<f8', 'fortran_order': False, 'shape': (3, 3)} \n" + "F\x00{'descr': '>f8', 'fortran_order': False, 'shape': (0,)} \n" + "F\x00{'descr': '>f8', 'fortran_order': False, 'shape': ()} \n" + "F\x00{'descr': '>f8', 'fortran_order': False, 'shape': (15,)} \n" + "F\x00{'descr': '>f8', 'fortran_order': False, 'shape': (3, 5)} \n" + "F\x00{'descr': '>f8', 'fortran_order': True, 'shape': (5, 3)} \n" + "F\x00{'descr': '>f8', 'fortran_order': False, 'shape': (3, 3)} \n" + "F\x00{'descr': '<c8', 'fortran_order': False, 'shape': (0,)} \n" + "F\x00{'descr': '<c8', 'fortran_order': False, 'shape': ()} \n" + "F\x00{'descr': '<c8', 'fortran_order': False, 'shape': (15,)} \n" + "F\x00{'descr': '<c8', 'fortran_order': False, 'shape': (3, 5)} \n" + "F\x00{'descr': '<c8', 'fortran_order': True, 'shape': (5, 3)} \n" + "F\x00{'descr': '<c8', 'fortran_order': False, 'shape': (3, 3)} \n" + "F\x00{'descr': '>c8', 'fortran_order': False, 'shape': (0,)} \n" + "F\x00{'descr': '>c8', 'fortran_order': False, 'shape': ()} \n" + "F\x00{'descr': '>c8', 'fortran_order': False, 'shape': (15,)} \n" + "F\x00{'descr': '>c8', 'fortran_order': False, 'shape': (3, 5)} \n" + "F\x00{'descr': '>c8', 'fortran_order': True, 'shape': (5, 3)} \n" + "F\x00{'descr': '>c8', 'fortran_order': False, 'shape': (3, 3)} \n" + "F\x00{'descr': '<c16', 'fortran_order': False, 'shape': (0,)} \n" + "F\x00{'descr': '<c16', 'fortran_order': False, 'shape': ()} \n" + "F\x00{'descr': '<c16', 'fortran_order': False, 'shape': (15,)} \n" + "F\x00{'descr': '<c16', 'fortran_order': False, 'shape': (3, 5)} \n" + "F\x00{'descr': '<c16', 'fortran_order': True, 'shape': (5, 3)} \n" + "F\x00{'descr': '<c16', 'fortran_order': False, 'shape': (3, 3)} \n" + "F\x00{'descr': '>c16', 'fortran_order': False, 'shape': (0,)} \n" + "F\x00{'descr': '>c16', 'fortran_order': False, 'shape': ()} \n" + "F\x00{'descr': '>c16', 'fortran_order': False, 'shape': (15,)} \n" + "F\x00{'descr': '>c16', 'fortran_order': False, 'shape': (3, 5)} \n" + "F\x00{'descr': '>c16', 'fortran_order': True, 'shape': (5, 3)} \n" + "F\x00{'descr': '>c16', 'fortran_order': False, 'shape': (3, 3)} \n" + "F\x00{'descr': 'O', 'fortran_order': False, 'shape': (0,)} \n" + "F\x00{'descr': 'O', 'fortran_order': False, 'shape': ()} \n" + "F\x00{'descr': 'O', 'fortran_order': False, 'shape': (15,)} \n" + "F\x00{'descr': 'O', 'fortran_order': False, 'shape': (3, 5)} \n" + "F\x00{'descr': 'O', 'fortran_order': True, 'shape': (5, 3)} \n" + "F\x00{'descr': 'O', 'fortran_order': False, 'shape': (3, 3)} \n" + "F\x00{'descr': 'O', 'fortran_order': False, 'shape': (0,)} \n" + "F\x00{'descr': 'O', 'fortran_order': False, 'shape': ()} \n" + "F\x00{'descr': 'O', 'fortran_order': False, 'shape': (15,)} \n" + "F\x00{'descr': 'O', 'fortran_order': False, 'shape': (3, 5)} \n" + "F\x00{'descr': 'O', 'fortran_order': True, 'shape': (5, 3)} \n" + "F\x00{'descr': 'O', 'fortran_order': False, 'shape': (3, 3)} \n" + "v\x00{'descr': [('x', '<i4', (2,)), ('y', '<f8', (2, 2)), ('z', '|u1')],\n 'fortran_order': False,\n 'shape': (2,)} \n" + "\x16\x02{'descr': [('x', '<i4', (2,)),\n ('Info',\n [('value', '<c16'),\n ('y2', '<f8'),\n ('Info2',\n [('name', '|S2'),\n ('value', '<c16', (2,)),\n ('y3', '<f8', (2,)),\n ('z3', '<u4', (2,))]),\n ('name', '|S2'),\n ('z2', '|b1')]),\n ('color', '|S2'),\n ('info', [('Name', '<U8'), ('Value', '<c16')]),\n ('y', '<f8', (2, 2)),\n ('z', '|u1')],\n 'fortran_order': False,\n 'shape': (2,)} \n" + "v\x00{'descr': [('x', '>i4', (2,)), ('y', '>f8', (2, 2)), ('z', '|u1')],\n 'fortran_order': False,\n 'shape': (2,)} \n" + "\x16\x02{'descr': [('x', '>i4', (2,)),\n ('Info',\n [('value', '>c16'),\n ('y2', '>f8'),\n ('Info2',\n [('name', '|S2'),\n ('value', '>c16', (2,)),\n ('y3', '>f8', (2,)),\n ('z3', '>u4', (2,))]),\n ('name', '|S2'),\n ('z2', '|b1')]),\n ('color', '|S2'),\n ('info', [('Name', '>U8'), ('Value', '>c16')]),\n ('y', '>f8', (2, 2)),\n ('z', '|u1')],\n 'fortran_order': False,\n 'shape': (2,)} \n" +''' import sys import os import warnings @@ -12,7 +288,7 @@ from numpy.testing import ( from numpy.testing._private.utils import requires_memory from numpy.lib import format -import yatest.common +import yatest.common as yc # Generate some basic arrays to test with. @@ -256,7 +532,7 @@ def test_load_padded_dtype(tmpdir, dt): @pytest.mark.xfail(IS_WASM, reason="Emscripten NODEFS has a buggy dup") def test_python2_python3_interoperability(): fname = 'win64python2.npy' - path = os.path.join(yatest.common.source_path('contrib/python/numpy/py3/numpy/lib/tests'), 'data', fname) + path = yc.source_path(os.path.join(os.path.dirname(__file__), 'data', fname)) with pytest.warns(UserWarning, match="Reading.*this warning\\."): data = np.load(path) assert_array_equal(data, np.ones(2)) @@ -264,7 +540,7 @@ def test_python2_python3_interoperability(): def test_pickle_python2_python3(): # Test that loading object arrays saved on Python 2 works both on # Python 2 and Python 3 and vice versa - data_dir = os.path.join(yatest.common.source_path('contrib/python/numpy/py3/numpy/lib/tests'), 'data') + data_dir = yc.source_path(os.path.join(os.path.dirname(__file__), 'data')) expected = np.array([None, range, '\u512a\u826f', b'\xe4\xb8\x8d\xe8\x89\xaf'], @@ -309,7 +585,7 @@ def test_pickle_python2_python3(): def test_pickle_disallow(tmpdir): - data_dir = os.path.join(yatest.common.source_path('contrib/python/numpy/py3/numpy/lib/tests'), 'data') + data_dir = yc.source_path(os.path.join(os.path.dirname(__file__), 'data')) path = os.path.join(data_dir, 'py2-objarr.npy') assert_raises(ValueError, np.load, path, diff --git a/contrib/python/numpy/py3/numpy/matrixlib/tests/test_matrix_linalg.py b/contrib/python/numpy/py3/numpy/matrixlib/tests/test_matrix_linalg.py index 0c53b98add..5965e73d70 100644 --- a/contrib/python/numpy/py3/numpy/matrixlib/tests/test_matrix_linalg.py +++ b/contrib/python/numpy/py3/numpy/matrixlib/tests/test_matrix_linalg.py @@ -1,7 +1,7 @@ """ Test functions for linalg module using the matrix class.""" import numpy as np -from __tests__.linalg.tests.test_linalg import ( +from __tests__.numpy.linalg.tests.test_linalg import ( LinalgCase, apply_tag, TestQR as _TestQR, LinalgTestCase, _TestNorm2D, _TestNormDoubleBase, _TestNormSingleBase, _TestNormInt64Base, SolveCases, InvCases, EigvalsCases, EigCases, SVDCases, CondCases, diff --git a/contrib/python/numpy/py3/numpy/random/tests/test_direct.py b/contrib/python/numpy/py3/numpy/random/tests/test_direct.py index 1b2f681b59..9718660759 100644 --- a/contrib/python/numpy/py3/numpy/random/tests/test_direct.py +++ b/contrib/python/numpy/py3/numpy/random/tests/test_direct.py @@ -33,8 +33,8 @@ if sys.flags.optimize > 1: MISSING_CFFI = True -import yatest.common -pwd = yatest.common.source_path('contrib/python/numpy/py3/numpy/random/tests') +import yatest.common as yc +pwd = yc.source_path(os.path.dirname(__file__)) def assert_state_equal(actual, target): diff --git a/contrib/python/numpy/py3/numpy/tests/test_reloading.py b/contrib/python/numpy/py3/numpy/tests/test_reloading.py index ff61326887..5a6606b23c 100644 --- a/contrib/python/numpy/py3/numpy/tests/test_reloading.py +++ b/contrib/python/numpy/py3/numpy/tests/test_reloading.py @@ -44,7 +44,6 @@ def test_novalue(): protocol=proto)) is np._NoValue) -import pytest @pytest.mark.skip @pytest.mark.skipif(IS_WASM, reason="can't start subprocess") def test_full_reimport(): diff --git a/contrib/python/numpy/py3/tests/ya.make b/contrib/python/numpy/py3/tests/ya.make index 7750eb421c..c279671d9e 100644 --- a/contrib/python/numpy/py3/tests/ya.make +++ b/contrib/python/numpy/py3/tests/ya.make @@ -1,239 +1,243 @@ PY3TEST() +REQUIREMENTS( + cpu:4 + ram:25 +) + SIZE(MEDIUM) +FORK_TESTS() + PEERDIR( contrib/python/numpy contrib/python/hypothesis contrib/python/typing-extensions + contrib/python/pytz ) DATA( arcadia/contrib/python/numpy/py3/numpy ) -FORK_TESTS() +NO_LINT() SRCDIR( - contrib/python/numpy/py3/numpy + contrib/python/numpy/py3 ) TEST_SRCS( - array_api/tests/__init__.py - array_api/tests/test_array_object.py - array_api/tests/test_creation_functions.py - array_api/tests/test_data_type_functions.py - array_api/tests/test_elementwise_functions.py - array_api/tests/test_indexing_functions.py - array_api/tests/test_manipulation_functions.py - array_api/tests/test_set_functions.py - array_api/tests/test_sorting_functions.py - array_api/tests/test_validation.py - compat/tests/__init__.py - compat/tests/test_compat.py - conftest.py - core/tests/__init__.py - core/tests/_locales.py - core/tests/test__exceptions.py - core/tests/test_abc.py - core/tests/test_api.py - core/tests/test_argparse.py - core/tests/test_array_coercion.py - #core/tests/test_array_interface.py - core/tests/test_arraymethod.py - core/tests/test_arrayprint.py - core/tests/test_casting_floatingpoint_errors.py - core/tests/test_casting_unittests.py - core/tests/test_conversion_utils.py - core/tests/test_cpu_dispatcher.py - core/tests/test_cpu_features.py - core/tests/test_custom_dtypes.py - core/tests/test_cython.py - core/tests/test_datetime.py - core/tests/test_defchararray.py - core/tests/test_deprecations.py - core/tests/test_dlpack.py - core/tests/test_dtype.py - core/tests/test_einsum.py - core/tests/test_errstate.py - core/tests/test_extint128.py - core/tests/test_function_base.py - core/tests/test_getlimits.py - core/tests/test_half.py - core/tests/test_hashtable.py - core/tests/test_indexerrors.py - core/tests/test_indexing.py - core/tests/test_item_selection.py - core/tests/test_limited_api.py - core/tests/test_longdouble.py - core/tests/test_machar.py - core/tests/test_mem_overlap.py - #core/tests/test_mem_policy.py - core/tests/test_memmap.py - core/tests/test_multiarray.py - core/tests/test_nditer.py - core/tests/test_nep50_promotions.py - core/tests/test_numeric.py - core/tests/test_numerictypes.py - core/tests/test_overrides.py - core/tests/test_print.py - core/tests/test_protocols.py - core/tests/test_records.py - core/tests/test_regression.py - core/tests/test_scalar_ctors.py - core/tests/test_scalar_methods.py - core/tests/test_scalarbuffer.py - core/tests/test_scalarinherit.py - core/tests/test_scalarmath.py - core/tests/test_scalarprint.py - core/tests/test_shape_base.py - core/tests/test_simd.py - core/tests/test_simd_module.py - core/tests/test_strings.py - core/tests/test_ufunc.py - core/tests/test_umath.py - core/tests/test_umath_accuracy.py - core/tests/test_umath_complex.py - core/tests/test_unicode.py - #distutils/tests/__init__.py - #distutils/tests/test_build_ext.py - #distutils/tests/test_ccompiler_opt.py - #distutils/tests/test_ccompiler_opt_conf.py - #distutils/tests/test_exec_command.py - #distutils/tests/test_fcompiler.py - #distutils/tests/test_fcompiler_gnu.py - #distutils/tests/test_fcompiler_intel.py - #distutils/tests/test_fcompiler_nagfor.py - #distutils/tests/test_from_template.py - #distutils/tests/test_log.py - #distutils/tests/test_mingw32ccompiler.py - #distutils/tests/test_misc_util.py - #distutils/tests/test_npy_pkg_config.py - #distutils/tests/test_shell_utils.py - #distutils/tests/test_system_info.py - #f2py/tests/__init__.py - #f2py/tests/test_abstract_interface.py - #f2py/tests/test_array_from_pyobj.py - #f2py/tests/test_assumed_shape.py - #f2py/tests/test_block_docstring.py - #f2py/tests/test_callback.py - #f2py/tests/test_character.py - #f2py/tests/test_common.py - #f2py/tests/test_compile_function.py - #f2py/tests/test_crackfortran.py - #f2py/tests/test_docs.py - #f2py/tests/test_f2cmap.py - #f2py/tests/test_f2py2e.py - #f2py/tests/test_kind.py - #f2py/tests/test_mixed.py - #f2py/tests/test_module_doc.py - #f2py/tests/test_parameter.py - #f2py/tests/test_quoted_character.py - #f2py/tests/test_regression.py - #f2py/tests/test_return_character.py - #f2py/tests/test_return_complex.py - #f2py/tests/test_return_integer.py - #f2py/tests/test_return_logical.py - #f2py/tests/test_return_real.py - #f2py/tests/test_semicolon_split.py - #f2py/tests/test_size.py - #f2py/tests/test_string.py - #f2py/tests/test_symbolic.py - #f2py/tests/test_value_attrspec.py - #f2py/tests/util.py - fft/tests/__init__.py - fft/tests/test_helper.py - fft/tests/test_pocketfft.py - lib/tests/__init__.py - lib/tests/test__datasource.py - lib/tests/test__iotools.py - lib/tests/test__version.py - lib/tests/test_arraypad.py - lib/tests/test_arraysetops.py - lib/tests/test_arrayterator.py - lib/tests/test_financial_expired.py - lib/tests/test_format.py - lib/tests/test_function_base.py - lib/tests/test_histograms.py - lib/tests/test_index_tricks.py - lib/tests/test_io.py - lib/tests/test_loadtxt.py - lib/tests/test_mixins.py - lib/tests/test_nanfunctions.py - lib/tests/test_packbits.py - lib/tests/test_polynomial.py - lib/tests/test_recfunctions.py - lib/tests/test_regression.py - lib/tests/test_shape_base.py - lib/tests/test_stride_tricks.py - lib/tests/test_twodim_base.py - lib/tests/test_type_check.py - lib/tests/test_ufunclike.py - lib/tests/test_utils.py - linalg/tests/__init__.py - linalg/tests/test_deprecations.py - linalg/tests/test_linalg.py - linalg/tests/test_regression.py - ma/tests/__init__.py - ma/tests/test_core.py - ma/tests/test_deprecations.py - ma/tests/test_extras.py - ma/tests/test_mrecords.py - ma/tests/test_old_ma.py - ma/tests/test_regression.py - ma/tests/test_subclassing.py - matrixlib/tests/__init__.py - matrixlib/tests/test_defmatrix.py - matrixlib/tests/test_interaction.py - matrixlib/tests/test_masked_matrix.py - matrixlib/tests/test_matrix_linalg.py - matrixlib/tests/test_multiarray.py - matrixlib/tests/test_numeric.py - matrixlib/tests/test_regression.py - polynomial/tests/__init__.py - polynomial/tests/test_chebyshev.py - polynomial/tests/test_classes.py - polynomial/tests/test_hermite.py - polynomial/tests/test_hermite_e.py - polynomial/tests/test_laguerre.py - polynomial/tests/test_legendre.py - polynomial/tests/test_polynomial.py - polynomial/tests/test_polyutils.py - polynomial/tests/test_printing.py - polynomial/tests/test_symbol.py - random/tests/__init__.py - random/tests/data/__init__.py - random/tests/test_direct.py - random/tests/test_extending.py - random/tests/test_generator_mt19937.py - random/tests/test_generator_mt19937_regressions.py - random/tests/test_random.py - random/tests/test_randomstate.py - random/tests/test_randomstate_regression.py - random/tests/test_regression.py - random/tests/test_seed_sequence.py - random/tests/test_smoke.py - testing/tests/__init__.py - testing/tests/test_utils.py - tests/__init__.py - tests/test__all__.py - #tests/test_ctypeslib.py - tests/test_lazyloading.py - tests/test_matlib.py - tests/test_numpy_config.py - tests/test_numpy_version.py - tests/test_public_api.py - tests/test_reloading.py - #tests/test_scripts.py - tests/test_warnings.py - typing/tests/__init__.py - #typing/tests/test_isfile.py - #typing/tests/test_runtime.py - typing/tests/test_typing.py + numpy/array_api/tests/__init__.py + numpy/array_api/tests/test_array_object.py + numpy/array_api/tests/test_creation_functions.py + numpy/array_api/tests/test_data_type_functions.py + numpy/array_api/tests/test_elementwise_functions.py + numpy/array_api/tests/test_indexing_functions.py + numpy/array_api/tests/test_manipulation_functions.py + numpy/array_api/tests/test_set_functions.py + numpy/array_api/tests/test_sorting_functions.py + numpy/array_api/tests/test_validation.py + numpy/compat/tests/__init__.py + numpy/compat/tests/test_compat.py + numpy/conftest.py + numpy/core/tests/__init__.py + numpy/core/tests/_locales.py + numpy/core/tests/test__exceptions.py + numpy/core/tests/test_abc.py + numpy/core/tests/test_api.py + numpy/core/tests/test_argparse.py + numpy/core/tests/test_array_coercion.py + #numpy/core/tests/test_array_interface.py + numpy/core/tests/test_arraymethod.py + numpy/core/tests/test_arrayprint.py + numpy/core/tests/test_casting_floatingpoint_errors.py + numpy/core/tests/test_casting_unittests.py + numpy/core/tests/test_conversion_utils.py + numpy/core/tests/test_cpu_dispatcher.py + numpy/core/tests/test_cpu_features.py + numpy/core/tests/test_custom_dtypes.py + numpy/core/tests/test_cython.py + numpy/core/tests/test_datetime.py + numpy/core/tests/test_defchararray.py + numpy/core/tests/test_deprecations.py + numpy/core/tests/test_dlpack.py + numpy/core/tests/test_dtype.py + numpy/core/tests/test_einsum.py + numpy/core/tests/test_errstate.py + numpy/core/tests/test_extint128.py + numpy/core/tests/test_function_base.py + numpy/core/tests/test_getlimits.py + numpy/core/tests/test_half.py + numpy/core/tests/test_hashtable.py + numpy/core/tests/test_indexerrors.py + numpy/core/tests/test_indexing.py + numpy/core/tests/test_item_selection.py + numpy/core/tests/test_limited_api.py + numpy/core/tests/test_longdouble.py + numpy/core/tests/test_machar.py + numpy/core/tests/test_mem_overlap.py + #numpy/core/tests/test_mem_policy.py + numpy/core/tests/test_memmap.py + numpy/core/tests/test_multiarray.py + numpy/core/tests/test_nditer.py + numpy/core/tests/test_nep50_promotions.py + numpy/core/tests/test_numeric.py + numpy/core/tests/test_numerictypes.py + numpy/core/tests/test_overrides.py + numpy/core/tests/test_print.py + numpy/core/tests/test_protocols.py + numpy/core/tests/test_records.py + numpy/core/tests/test_regression.py + numpy/core/tests/test_scalar_ctors.py + numpy/core/tests/test_scalar_methods.py + numpy/core/tests/test_scalarbuffer.py + numpy/core/tests/test_scalarinherit.py + numpy/core/tests/test_scalarmath.py + numpy/core/tests/test_scalarprint.py + numpy/core/tests/test_shape_base.py + numpy/core/tests/test_simd.py + numpy/core/tests/test_simd_module.py + numpy/core/tests/test_strings.py + numpy/core/tests/test_ufunc.py + numpy/core/tests/test_umath.py + numpy/core/tests/test_umath_accuracy.py + numpy/core/tests/test_umath_complex.py + numpy/core/tests/test_unicode.py + #numpy/distutils/tests/__init__.py + #numpy/distutils/tests/test_build_ext.py + #numpy/distutils/tests/test_ccompiler_opt.py + #numpy/distutils/tests/test_ccompiler_opt_conf.py + #numpy/distutils/tests/test_exec_command.py + #numpy/distutils/tests/test_fcompiler.py + #numpy/distutils/tests/test_fcompiler_gnu.py + #numpy/distutils/tests/test_fcompiler_intel.py + #numpy/distutils/tests/test_fcompiler_nagfor.py + #numpy/distutils/tests/test_from_template.py + #numpy/distutils/tests/test_log.py + #numpy/distutils/tests/test_mingw32ccompiler.py + #numpy/distutils/tests/test_misc_util.py + #numpy/distutils/tests/test_npy_pkg_config.py + #numpy/distutils/tests/test_shell_utils.py + #numpy/distutils/tests/test_system_info.py + #numpy/f2py/tests/__init__.py + #numpy/f2py/tests/test_abstract_interface.py + #numpy/f2py/tests/test_array_from_pyobj.py + #numpy/f2py/tests/test_assumed_shape.py + #numpy/f2py/tests/test_block_docstring.py + #numpy/f2py/tests/test_callback.py + #numpy/f2py/tests/test_character.py + #numpy/f2py/tests/test_common.py + #numpy/f2py/tests/test_compile_function.py + #numpy/f2py/tests/test_crackfortran.py + #numpy/f2py/tests/test_docs.py + #numpy/f2py/tests/test_f2cmap.py + #numpy/f2py/tests/test_f2py2e.py + #numpy/f2py/tests/test_kind.py + #numpy/f2py/tests/test_mixed.py + #numpy/f2py/tests/test_module_doc.py + #numpy/f2py/tests/test_parameter.py + #numpy/f2py/tests/test_quoted_character.py + #numpy/f2py/tests/test_regression.py + #numpy/f2py/tests/test_return_character.py + #numpy/f2py/tests/test_return_complex.py + #numpy/f2py/tests/test_return_integer.py + #numpy/f2py/tests/test_return_logical.py + #numpy/f2py/tests/test_return_real.py + #numpy/f2py/tests/test_semicolon_split.py + #numpy/f2py/tests/test_size.py + #numpy/f2py/tests/test_string.py + #numpy/f2py/tests/test_symbolic.py + #numpy/f2py/tests/test_value_attrspec.py + #numpy/f2py/tests/util.py + numpy/fft/tests/__init__.py + numpy/fft/tests/test_helper.py + numpy/fft/tests/test_pocketfft.py + numpy/lib/tests/__init__.py + numpy/lib/tests/test__datasource.py + numpy/lib/tests/test__iotools.py + numpy/lib/tests/test__version.py + numpy/lib/tests/test_arraypad.py + numpy/lib/tests/test_arraysetops.py + numpy/lib/tests/test_arrayterator.py + numpy/lib/tests/test_financial_expired.py + numpy/lib/tests/test_format.py + numpy/lib/tests/test_function_base.py + numpy/lib/tests/test_histograms.py + numpy/lib/tests/test_index_tricks.py + numpy/lib/tests/test_io.py + numpy/lib/tests/test_loadtxt.py + numpy/lib/tests/test_mixins.py + numpy/lib/tests/test_nanfunctions.py + numpy/lib/tests/test_packbits.py + numpy/lib/tests/test_polynomial.py + numpy/lib/tests/test_recfunctions.py + numpy/lib/tests/test_regression.py + numpy/lib/tests/test_shape_base.py + numpy/lib/tests/test_stride_tricks.py + numpy/lib/tests/test_twodim_base.py + numpy/lib/tests/test_type_check.py + numpy/lib/tests/test_ufunclike.py + numpy/lib/tests/test_utils.py + numpy/linalg/tests/__init__.py + numpy/linalg/tests/test_deprecations.py + numpy/linalg/tests/test_linalg.py + numpy/linalg/tests/test_regression.py + numpy/ma/tests/__init__.py + numpy/ma/tests/test_core.py + numpy/ma/tests/test_deprecations.py + numpy/ma/tests/test_extras.py + numpy/ma/tests/test_mrecords.py + numpy/ma/tests/test_old_ma.py + numpy/ma/tests/test_regression.py + numpy/ma/tests/test_subclassing.py + numpy/matrixlib/tests/__init__.py + numpy/matrixlib/tests/test_defmatrix.py + numpy/matrixlib/tests/test_interaction.py + numpy/matrixlib/tests/test_masked_matrix.py + numpy/matrixlib/tests/test_matrix_linalg.py + numpy/matrixlib/tests/test_multiarray.py + numpy/matrixlib/tests/test_numeric.py + numpy/matrixlib/tests/test_regression.py + numpy/polynomial/tests/__init__.py + numpy/polynomial/tests/test_chebyshev.py + numpy/polynomial/tests/test_classes.py + numpy/polynomial/tests/test_hermite.py + numpy/polynomial/tests/test_hermite_e.py + numpy/polynomial/tests/test_laguerre.py + numpy/polynomial/tests/test_legendre.py + numpy/polynomial/tests/test_polynomial.py + numpy/polynomial/tests/test_polyutils.py + numpy/polynomial/tests/test_printing.py + numpy/polynomial/tests/test_symbol.py + numpy/random/tests/__init__.py + numpy/random/tests/data/__init__.py + numpy/random/tests/test_direct.py + numpy/random/tests/test_extending.py + numpy/random/tests/test_generator_mt19937.py + numpy/random/tests/test_generator_mt19937_regressions.py + numpy/random/tests/test_random.py + numpy/random/tests/test_randomstate.py + numpy/random/tests/test_randomstate_regression.py + numpy/random/tests/test_regression.py + numpy/random/tests/test_seed_sequence.py + numpy/random/tests/test_smoke.py + numpy/testing/tests/__init__.py + numpy/testing/tests/test_utils.py + numpy/tests/__init__.py + numpy/tests/test__all__.py + #numpy/tests/test_ctypeslib.py + numpy/tests/test_lazyloading.py + numpy/tests/test_matlib.py + numpy/tests/test_numpy_config.py + numpy/tests/test_numpy_version.py + numpy/tests/test_public_api.py + numpy/tests/test_reloading.py + #numpy/tests/test_scripts.py + numpy/tests/test_warnings.py + numpy/typing/tests/__init__.py + #numpy/typing/tests/test_isfile.py + #numpy/typing/tests/test_runtime.py + numpy/typing/tests/test_typing.py ) -NO_LINT() - -REQUIREMENTS(ram:25) - END() |