Skip to content

Commit

Permalink
add take test expected file
Browse files Browse the repository at this point in the history
  • Loading branch information
v923z committed Oct 8, 2024
1 parent 82f74ac commit 04f2a03
Show file tree
Hide file tree
Showing 2 changed files with 107 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/2d/numpy/take.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
105 changes: 105 additions & 0 deletions tests/2d/numpy/take.py.exp
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 04f2a03

Please sign in to comment.