관리-도구
편집 파일: test_dlpack.cpython-311.pyc
� �܋f� � �H � d dl Z d dlZd dlZd dlmZmZ G d� d� � ZdS )� N)�assert_array_equal�IS_PYPYc �. � e Zd Zej � ed�� � d� � � Zd� Zd� Z ej � ed�� � d� � � Z ej � dej ej ej ej ej ej ej ej ej ej ej ej ej ej g� � d� � � Zd � Zd � Zd� Zej � d ed � � � � d� � � Z d� Z!d� Z"d� Z#d� Z$d� Z%d� Z&dS )� TestDLPackzPyPy can't get refcounts.)�reasonc � � t j d� � }|� � � }t j |� � dk sJ �~t j |� � dk sJ �d S �N� � � )�np�arange� __dlpack__�sys�getrefcount��self�x�ys �o/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib64/python3.11/site-packages/numpy/core/tests/test_dlpack.py�test_dunder_dlpack_refcountz&TestDLPack.test_dunder_dlpack_refcount s[ � ��I�a�L�L�� �L�L�N�N����q�!�!�Q�&�&�&�&� ���q�!�!�Q�&�&�&�&�&�&� c �� � t j d� � }|� d �� � t j t � � 5 |� d�� � d d d � � d S # 1 swxY w Y d S )Nr )�stream� )r r r �pytest�raises�RuntimeError�r r s r �test_dunder_dlpack_streamz$TestDLPack.test_dunder_dlpack_stream s� � ��I�a�L�L�� ���D��!�!�!� �]�<� (� (� #� #� �L�L��L�"�"�"� #� #� #� #� #� #� #� #� #� #� #� #���� #� #� #� #� #� #s �A(�(A,�/A,c �* � t j dt j fdt j fg� � }t j d|�� � }|d }t j t � � 5 t j |� � d d d � � d S # 1 swxY w Y d S )N�int�char)r ��dtype) r r% �int32�int8�zerosr r �BufferError�from_dlpack)r �dtr �zs r �%test_strides_not_multiple_of_itemsizez0TestDLPack.test_strides_not_multiple_of_itemsize s� � � �X��r�x�(�6�2�7�*;�<� =� =���H�T��$�$�$�� �e�H�� �]�;� '� '� � ��N�1���� � � � � � � � � � � � ���� � � � � � s �&B�B�Bc � � t j d� � }t j |� � }t j |� � dk sJ �~t j |� � dk sJ �d S r )r r r* r r r s r �test_from_dlpack_refcountz$TestDLPack.test_from_dlpack_refcount s] � ��I�a�L�L���N�1������q�!�!�Q�&�&�&�&� ���q�!�!�Q�&�&�&�&�&�&r r% c � � t j d� � � |� � }t j |� � }|j |j k sJ �t ||� � d S �Nr )r r �astyper* r% r )r r% r r s r �test_dtype_passthroughz!TestDLPack.test_dtype_passthrough( sY � � �I�a�L�L����&�&���N�1�����w�!�'�!�!�!�!��1�a� � � � � r c �� � t j t j d� � � � }t j t � � 5 t j |� � d d d � � d S # 1 swxY w Y d S )Nz 2021-05-27)r �asarray� datetime64r r r) r* r s r �test_invalid_dtypezTestDLPack.test_invalid_dtype6 s� � ��J�r�}�\�2�2�3�3�� �]�;� '� '� � ��N�1���� � � � � � � � � � � � ���� � � � � � s � A"�"A&�)A&c � � t j d� � � � � }t j d|�� � }t j t � � 5 t j |� � d d d � � d S # 1 swxY w Y d S )Nz=i8r r$ )r r% �newbyteorderr r r r) r* )r r+ r s r �test_invalid_byte_swappingz%TestDLPack.test_invalid_byte_swapping<