File: test_numba_numpy.py

package info (click to toggle)
python-vector 1.6.3-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,984 kB
  • sloc: python: 40,200; makefile: 13
file content (28 lines) | stat: -rw-r--r-- 757 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# Copyright (c) 2019-2025, Saransh Chopra, Henry Schreiner, Eduardo Rodrigues, Jonas Eschle, and Jim Pivarski.
#
# Distributed under the 3-clause BSD license, see accompanying file LICENSE
# or https://github.com/scikit-hep/vector for details.

from __future__ import annotations

import pytest

import vector
import vector.backends.object

numba = pytest.importorskip("numba")


import vector.backends.numba_numpy  # noqa: E402

pytestmark = pytest.mark.numba


def test_pass_through():
    @numba.njit
    def pass_through(obj):
        return obj

    array = vector.array({"px": [1, 2, 3], "py": [10, 20, 30]})
    assert isinstance(array, vector.backends.numpy.VectorNumpy)
    assert isinstance(pass_through(array), vector.backends.numpy.VectorNumpy)