From 04f2a03948152f2088ea250aa636045c29da5172 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20V=C3=B6r=C3=B6s?= Date: Tue, 8 Oct 2024 20:08:11 +0200 Subject: [PATCH] add take test expected file --- tests/2d/numpy/take.py | 4 +- tests/2d/numpy/take.py.exp | 105 +++++++++++++++++++++++++++++++++++++ 2 files changed, 107 insertions(+), 2 deletions(-) create mode 100644 tests/2d/numpy/take.py.exp diff --git a/tests/2d/numpy/take.py b/tests/2d/numpy/take.py index 5f72f977..3bf5ab8b 100644 --- a/tests/2d/numpy/take.py +++ b/tests/2d/numpy/take.py @@ -10,7 +10,7 @@ a = np.array(range(12), dtype=dtype).reshape((3, 4)) print(np.take(a, (0, 10))) -print('1D arrays') +print('\n1D arrays') for dtype in dtypes: a = np.array(range(12), dtype=dtype) print('\na:', a) @@ -19,7 +19,7 @@ indices = np.array([0, 2, 2, 1], dtype=np.uint8) print(np.take(a, indices)) - +print('\n2D arrays') for dtype in dtypes: a = np.array(range(12), dtype=dtype).reshape((3, 4)) print('\na:', a) diff --git a/tests/2d/numpy/take.py.exp b/tests/2d/numpy/take.py.exp new file mode 100644 index 00000000..b7fe881c --- /dev/null +++ b/tests/2d/numpy/take.py.exp @@ -0,0 +1,105 @@ +flattened array +array([0, 10], dtype=uint8) +array([0, 10], dtype=int8) +array([0, 10], dtype=uint16) +array([0, 10], dtype=int16) +array([0.0, 10.0], dtype=float64) + +1D arrays + +a: array([0, 1, 2, ..., 9, 10, 11], dtype=uint8) +array([0, 2, 2, 1], dtype=uint8) +array([0, 2, 2, 1], dtype=uint8) + +a: array([0, 1, 2, ..., 9, 10, 11], dtype=int8) +array([0, 2, 2, 1], dtype=int8) +array([0, 2, 2, 1], dtype=int8) + +a: array([0, 1, 2, ..., 9, 10, 11], dtype=uint16) +array([0, 2, 2, 1], dtype=uint16) +array([0, 2, 2, 1], dtype=uint16) + +a: array([0, 1, 2, ..., 9, 10, 11], dtype=int16) +array([0, 2, 2, 1], dtype=int16) +array([0, 2, 2, 1], dtype=int16) + +a: array([0.0, 1.0, 2.0, ..., 9.0, 10.0, 11.0], dtype=float64) +array([0.0, 2.0, 2.0, 1.0], dtype=float64) +array([0.0, 2.0, 2.0, 1.0], dtype=float64) + +2D arrays + +a: array([[0, 1, 2, 3], + [4, 5, 6, 7], + [8, 9, 10, 11]], dtype=uint8) + +first axis +array([[0, 1, 2, 3], + [8, 9, 10, 11], + [8, 9, 10, 11], + [4, 5, 6, 7]], dtype=uint8) + +second axis +array([[0, 2, 2, 1], + [2, 3, 4, 5], + [6, 7, 8, 9]], dtype=uint8) + +a: array([[0, 1, 2, 3], + [4, 5, 6, 7], + [8, 9, 10, 11]], dtype=int8) + +first axis +array([[0, 1, 2, 3], + [8, 9, 10, 11], + [8, 9, 10, 11], + [4, 5, 6, 7]], dtype=int8) + +second axis +array([[0, 2, 2, 1], + [2, 3, 4, 5], + [6, 7, 8, 9]], dtype=int8) + +a: array([[0, 1, 2, 3], + [4, 5, 6, 7], + [8, 9, 10, 11]], dtype=uint16) + +first axis +array([[0, 1, 2, 3], + [8, 9, 10, 11], + [8, 9, 10, 11], + [4, 5, 6, 7]], dtype=uint16) + +second axis +array([[0, 2, 2, 1], + [2, 3, 4, 5], + [6, 7, 8, 9]], dtype=uint16) + +a: array([[0, 1, 2, 3], + [4, 5, 6, 7], + [8, 9, 10, 11]], dtype=int16) + +first axis +array([[0, 1, 2, 3], + [8, 9, 10, 11], + [8, 9, 10, 11], + [4, 5, 6, 7]], dtype=int16) + +second axis +array([[0, 2, 2, 1], + [2, 3, 4, 5], + [6, 7, 8, 9]], dtype=int16) + +a: array([[0.0, 1.0, 2.0, 3.0], + [4.0, 5.0, 6.0, 7.0], + [8.0, 9.0, 10.0, 11.0]], dtype=float64) + +first axis +array([[0.0, 1.0, 2.0, 3.0], + [8.0, 9.0, 10.0, 11.0], + [8.0, 9.0, 10.0, 11.0], + [4.0, 5.0, 6.0, 7.0]], dtype=float64) + +second axis +array([[0.0, 2.0, 2.0, 1.0], + [2.0, 3.0, 4.0, 5.0], + [6.0, 7.0, 8.0, 9.0]], dtype=float64)