PHP 8.2.30
Preview: test_indexing_functions.py Size: 627 B
/opt/cloudlinux/venv/lib/python3.11/site-packages/numpy/array_api/tests/test_indexing_functions.py

import pytest

from numpy import array_api as xp


@pytest.mark.parametrize(
    "x, indices, axis, expected",
    [
        ([2, 3], [1, 1, 0], 0,  [3, 3, 2]),
        ([2, 3], [1, 1, 0], -1, [3, 3, 2]),
        ([[2, 3]], [1], -1, [[3]]),
        ([[2, 3]], [0, 0], 0, [[2, 3], [2, 3]]),
    ],
)
def test_take_function(x, indices, axis, expected):
    """
    Indices respect relative order of a descending stable-sort

    See https://github.com/numpy/numpy/issues/20778
    """
    x = xp.asarray(x)
    indices = xp.asarray(indices)
    out = xp.take(x, indices, axis=axis)
    assert xp.all(out == xp.asarray(expected))

Directory Contents

Dirs: 1 × Files: 10

Name Size Perms Modified Actions
- drwxr-xr-x 2026-02-06 08:01:08
Edit Download
16.64 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
4.91 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
1018 B lrw-r--r-- 2026-01-20 13:01:47
Edit Download
3.71 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
627 B lrw-r--r-- 2026-01-20 13:01:47
Edit Download
1.06 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
546 B lrw-r--r-- 2026-01-20 13:01:47
Edit Download
602 B lrw-r--r-- 2026-01-20 13:01:47
Edit Download
676 B lrw-r--r-- 2026-01-20 13:01:47
Edit Download
282 B lrw-r--r-- 2026-01-20 13:01:47
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).