HEX
Server: Apache
System: Linux bd12.noc223.com 4.18.0-553.121.1.lve.el8.x86_64 #1 SMP Thu Apr 30 16:40:41 UTC 2026 x86_64
User: handcraf (1693)
PHP: 8.1.28
Disabled: NONE
Upload Files
File: //opt/alt/python312/lib64/python3.12/test/__pycache__/test_memoryview.cpython-312.opt-2.pyc
�

�h�e
W��J�	ddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlmZGd�d�ZGd�de�Z
Gd�de�ZGd	�d
�ZGd�d�ZGd
�d�ZGd�dej$ee
�ZGd�dej$ee�ZGd�dej$ee
�ZGd�dej$ee�ZGd�dej$ee
�ZGd�dej$ee�ZGd�dej$�Zedk(rej6�yy)�N)�
import_helperc���eZdZdZed��Zed��Zd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
d�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zy)�AbstractMemoryTests�abcdefc��|jS�N)�source_bytes��selfs �;/opt/alt/python312/lib64/python3.12/test/test_memoryview.py�_sourcezAbstractMemoryTests._sources��� � � �c�F�td|j|jg�Sr)�filter�ro_type�rw_typer
s r�_typeszAbstractMemoryTests._typess���d�T�\�\�4�<�<�8�9�9rc�D��||j�}tj|�}|j|��|j	�dtd��|j
�dt�|j	�dtd��|j	�dtd��|j	�dtd��|jt�fd��|jt�fd��|jt�fd	��|jt�fd
��|jt�fd��|jt�fd��|jt�fd
��d�|j	tj|�|�y)Nr�a��f���i����c����dS)N����ms�r�<lambda>z=AbstractMemoryTests.check_getitem_with_type.<locals>.<lambda>*s���a��d�rc����dS)N���rrs�rrz=AbstractMemoryTests.check_getitem_with_type.<locals>.<lambda>+s���a��e�rc�*���tjSr��sys�maxsizers�rrz=AbstractMemoryTests.check_getitem_with_type.<locals>.<lambda>,s���a����n�rc�,���tjSrr"rs�rrz=AbstractMemoryTests.check_getitem_with_type.<locals>.<lambda>-s���a�����o�rc����dSrrrs�rrz=AbstractMemoryTests.check_getitem_with_type.<locals>.<lambda>/s���Q�t�W�rc����dS)N�rrs�rrz=AbstractMemoryTests.check_getitem_with_type.<locals>.<lambda>0����Q�s�V�rc����dS)N�arrs�rrz=AbstractMemoryTests.check_getitem_with_type.<locals>.<lambda>1r)r)r
r#�getrefcount�_view�assertEqual�ord�assertIsInstance�int�assertRaises�
IndexError�	TypeError)r�tp�b�oldrefcountrs    @r�check_getitem_with_typez+AbstractMemoryTests.check_getitem_with_type s0����t�|�|����o�o�a�(���J�J�q�M������1��s�4�y�)����a��d�C�(�����1��s�4�y�)�����2���D�	�*�����2���D�	�*����*�l�3����*�m�4����*�&<�=����*�&=�>����)�_�5����)�^�4����)�^�4����������+�[�9rc�H�|jD]}|j|��yr)rr8)rr5s  r�test_getitemz AbstractMemoryTests.test_getitem5s#���+�+�	-�B��(�(��,�	-rc	���|jD]c}||j�}|j|�}|jt	|�tt
|��D�cgc]}||��	c}��eycc}wr)rr
r-r.�list�range�len�rr5r6r�is     r�	test_iterzAbstractMemoryTests.test_iter9sc���+�+�	E�B��4�<�<� �A��
�
�1�
�A����T�!�W�U�3�q�6�]�&C��q��t�&C�D�	E��'Ds�A4c���|js|jd�|j|j�}tj|�}|j|���fd�}|j
t|d�|j
t|d�|j
t|td��d�|jtj|�|�y)N�no read-only type to testc���|�d<y)Nrr)�valuers �r�setitemz:AbstractMemoryTests.test_setitem_readonly.<locals>.setitemEs����A�a�Drr�A)
r�skipTestr
r#r,r-r2r4�
memoryviewr.)rr6r7rFrs    @r�test_setitem_readonlyz)AbstractMemoryTests.test_setitem_readonly?s�����|�|��M�M�5�6��L�L����&���o�o�a�(���J�J�q�M��	����)�W�d�3����)�W�b�1����)�W�j��.>�?����������+�[�9rc
����|js|jd�|j�|j|j�}tj|�}|j|��t
d��d<|j�|d��d��dd|j�|d��d��dd	|j�|d
��d��dd|j�|d
��d��dd|j�|d��d
d�dd	|j�|d��d��dd�dd	�d
d|j�|d���fd�}|jt|dd�|jt|dd�|jt|tjd�|jt|tjd�|jt|dd�|jt|dd�|jt|tddd�dfd�|jt|dtddd�fd�|jt|dd�|jt|dd�tddd�tddd
�f}|jt||d��jdk(rtnt}|j||dd�|j||dd�|jt|tdd�d�|jt|tdd
�d�d�|j!tj|�|�y)N�no writable type to test�1rs1bcdef�0�s0bcdefs12�s012defrr�rscdedefsababcfc����|��|<yrr)�keyrErr5s  ��rrFz:AbstractMemoryTests.test_setitem_writable.<locals>.setitemfs�����Y�A�c�Frrrr r()rr+�csab)rrHr
r#r,r-r/�_check_contentsr2r3r$r4�slice�NotImplementedError�format�
ValueErrorr.)rr6r7rF�slices�excrr5s      @@r�test_setitem_writablez)AbstractMemoryTests.test_setitem_writableMs�����|�|��M�M�4�5�
�\�\���L�L����&���o�o�a�(���J�J�q�M���4�y��!�����R��I�.��D���!�A�����R��I�.��E���!�A�����R��I�.��C���!�A�����R��I�.��)�}��!�����R��I�.��1�Q���!�A�����R��I�.��)�}��!���1�Q���!�A�����R��I�.�	�	
���*�g�q�$�7����*�g�r�4�8����*�g�s�{�{�D�A����*�g����|�T�B����)�W�c�4�8����)�W�d�D�9����)�W�u�Q�q��|�Q�.?��F����)�W�q�%��!�A�,�.?��F����)�W�d�D�9����)�W�c�4�8���!�A�,��a��!��-�����-�w���E��H�H��O�j������#�w��3�/����#�w��5�1����*�g�u�Q�q�z�4�@����*�g�u�Q�q�z�4�@����������+�[�9rc�$�|jD]i}||j�}|j|�}|jt�5|d=ddd�|jt�5|dd�=ddd��ky#1swY�/xYw#1swY��xYw)NrO�)rr
r-r2r4�rr5r6rs    r�test_delitemz AbstractMemoryTests.test_delitem�s����+�+�	�B��4�<�<� �A��
�
�1�
�A��"�"�9�-�
��a�D�
��"�"�9�-�
��a��c�F�
�
�	�
�
��
�
�s�A:�)B�:B	�B	c����jD]u}�j|�j��}|j�}dj	�fd�dD��}�j||��j
|t��wy)Nrc3�T�K�|]}�jt|g�����!y�wr)�getitem_type�bytes)�.0rTrs  �r�	<genexpr>z3AbstractMemoryTests.test_tobytes.<locals>.<genexpr>�s)����� B�23��!�!�%���*�-� B�s�%(r)rr-r
�tobytes�joinr.r0rd)rr5rr6�expecteds`    r�test_tobytesz AbstractMemoryTests.test_tobytes�sv����+�+�	,�B��
�
�2�d�l�l�+�,�A��	�	��A��x�x� B�7@� B�B�H����Q��)��!�!�!�U�+�	,rc��|jD]N}|j||j��}|j�}|j	|td���Py)Nr)rr-r
�tolistr.r<)rr5r�ls    r�test_tolistzAbstractMemoryTests.test_tolist�sK���+�+�	1�B��
�
�2�d�l�l�+�,�A����
�A����Q��Y��0�	1rc����|jD�]�}|j||j���|jD]�}|j�|d�k(�|j	�|d�k7�|j	�|d�k(�|j�|d�k7�|j	�|d�k(�|j�|d�k7���|j��k(�|j��ddk(�|j�dd�ddk(�|j	�dd�k(�|j	�dk(�|j�dk7�|j	d�k(�|jd�k7��dfD]j�|jt��fd��|jt��fd	��|jt��fd
��|jt��fd���l���y)Nrsabcdesabcde1rrr�abcdefc�����kSrr�rTrs��rrz2AbstractMemoryTests.test_compare.<locals>.<lambda>�����Q��U�rc�����kSrrrrs��rrz2AbstractMemoryTests.test_compare.<locals>.<lambda>�����Q�!�V�rc�����k\Srrrrs��rrz2AbstractMemoryTests.test_compare.<locals>.<lambda>�rurc�����kDSrrrrs��rrz2AbstractMemoryTests.test_compare.<locals>.<lambda>�rsr)rr-r
�
assertTrue�assertFalser2r4)rr5�tp_comprTrs   @@r�test_comparez AbstractMemoryTests.test_compare�s�����+�+�	<�B��
�
�2�d�l�l�+�,�A��;�;�
9������W�Y�%7� 7�8�� � ��g�i�&8�!8�9�� � ��g�h�&7�!7�8�����W�X�%6� 6�7�� � ��g�i�&8�!8�9�����W�Y�%7� 7�8�

9�
�O�O�A��F�#��O�O�A��1��I�&��O�O�A�a��F�a��d�N�+����Q�q��V�q�[�)�
���Q�(�]�+��O�O�A��M�*����X��]�+��O�O�H��M�*���^�
<���!�!�)�]�;��!�!�)�^�<��!�!�)�^�<��!�!�)�]�;�	
<�+	<rc��|j||j��}|j|j|j�|j|j|j�|j|j
d�|j|jd�|jt|�d�|j|j|jf�|j|jd�|S)NrO)rrr)
r-r
r.rX�itemsize�ndim�shaper>�strides�
suboffsets)rr5rs   r�check_attributes_with_typez.AbstractMemoryTests.check_attributes_with_type�s����J�J�r�$�,�,�'�(��������4�;�;�/�������T�]�]�3��������#�������$�'�����Q���#�������T�]�]�$4�5�������r�*��rc��|js|jd�|j|j�}|j|jd�y)NrCT)rrHr�r.�readonly�rrs  r�test_attributes_readonlyz,AbstractMemoryTests.test_attributes_readonly�s>���|�|��M�M�5�6��+�+�D�L�L�9��������T�*rc��|js|jd�|j|j�}|j|jd�y)NrLF)rrHr�r.r�r�s  r�test_attributes_writablez,AbstractMemoryTests.test_attributes_writable�s>���|�|��M�M�4�5��+�+�D�L�L�9��������U�+rc��|jD]�}||j�}tj|�}|j	|�}tj|�}t|d�}|j
|||jd��|jtj|�|�d}|jtj|�|���y)Nzutf-8)	rr
r#r,r-�strrU�encoder.)rr5r6r7r�oldviewrefcount�ss       r�test_getbufferz"AbstractMemoryTests.test_getbuffer�s����+�+�		>�B��4�<�<� �A��/�/�!�,�K��
�
�1�
�A�!�o�o�a�0�O��A�w��A�� � ��Q�����(9�:����S�_�_�Q�/��A��A����S�_�_�Q�/��=�		>rc�h�|jD�]"}t|t�s�Gd�d�}Gd�d|�}Gd�d�}||d��}|j|�}|�}||_||_t
j|�}dx}x}}tj�|j|�du|��||d��}|�}||_||_t
j|�}dx}}tj�|j|�du|����%y)Nc��eZdZd�Zy)�+AbstractMemoryTests.test_gc.<locals>.MyViewc�$�t|�|_yr)rIr)r�bases  r�__init__z4AbstractMemoryTests.test_gc.<locals>.MyView.__init__�s��'��-�D�FrN)�__name__�
__module__�__qualname__r�rrr�MyViewr��s��.rr�c��eZdZy)�-AbstractMemoryTests.test_gc.<locals>.MySourceN�r�r�r�rrr�MySourcer�����rr�c��eZdZy)�-AbstractMemoryTests.test_gc.<locals>.MyObjectNr�rrr�MyObjectr��r�rr��abc)r�
isinstance�typer-r�o�weakref�ref�gc�collectrx�x)	rr5r�r�r�r6rr��wrs	         r�test_gczAbstractMemoryTests.test_gc�s
���+�+�#	0�B��b�$�'��
.�
.�
�2�
�
�
�
��F��$�A��
�
�1�
�A��
�A��A�C��A�C����Q��B���A���A��J�J�L��O�O�B�D�D�L�"�$�/��r�&�z�"�A��
�A��A�C��A�C����Q��B��L�A���J�J�L��O�O�B�D�D�L�"�$�/�G#	0rc��|jtd�}|5t|�ddd�|5|j�ddd�|5|j	�ddd�|5|dddd�|5d|d<ddd�|5t|�ddd�|5|jddd�|5|jddd�|5|jddd�|5|jddd�|5|jddd�|5|jddd�|5|5	ddd�ddd�|jdt|��|jdt|��|j||�|j!|t#||j$���|j!|||j$��y#1swY���xYw#1swY���xYw#1swY���xYw#1swY���xYw#1swY���xYw#1swY���xYw#1swY��xxYw#1swY��nxYw#1swY��dxYw#1swY��ZxYw#1swY��PxYw#1swY��FxYw#1swY��DxYw#1swY��IxYw)N�releasedr�xzreleased memory)�assertRaisesRegexrYrdrgrlr>rXr}r~r�rr��assertInr��reprr.�assertNotEqualrIr
)rrr5�checks    r�_check_releasedz#AbstractMemoryTests._check_releaseds����&�&�z�:�>��
��E�!�H��
��A�I�I�K��
��A�H�H�J��
��A�a�D��
��4�A�a�D��
��C��F��
��A�H�H��
��A�J�J��
��A�F�F��
��A�J�J��
��A�G�G��
��A�I�I��
�	��
��
�	�	
�
�
�'��Q��0��
�
�'��a��1�����A�����A�z�"�T�\�\�*:�;�<����A�r�$�,�,�/�0�)	������������������������������������
�
��	�	�s��G�G�
G*�%G7�5H�H�
H�2
H+�	
H8� 
I�7
I�
I�%I9�(I,�*I9�G�G'�*G4�7H�H�H�H(�+H5�8I�I�I�I)�,I6	�1I9�9Jc�R�|jD]�}||j�}|j|�}|5}|j||�ddd�|j	||�|j|�}|5|j�ddd���y#1swY�JxYw#1swY��xYwr)rr
r-�assertIsr��release)rr5r6r�cms     r�test_contextmanagerz'AbstractMemoryTests.test_contextmanagers����+�+�		�B��4�<�<� �A��
�
�1�
�A��
%�b��
�
�b�!�$�
%�� � ��B�'��
�
�1�
�A��
��	�	��
�
�		�
%�
%��

�
�s�B�5B�B	�B&	c���|jD]i}||j�}|j|�}|j�|j	||�|j�|j	||��kyr)rr
r-r�r�r_s    r�test_releasez AbstractMemoryTests.test_release&sb���+�+�	(�B��4�<�<� �A��
�
�1�
�A�
�I�I�K�� � ��B�'�
�I�I�K�� � ��B�'�	(rc���|j}|�|jd�||j�}|j|�}t	j
d�}|j
t|j|�y)NrCsZZZZ)	rrHr
r-�io�BytesIOr2r4�readintor?s     r�test_writable_readonlyz*AbstractMemoryTests.test_writable_readonly0s^���\�\��
�:��M�M�5�6��t�|�|����J�J�q�M���J�J�w������)�Q�Z�Z��3rc�F�|jt|ji�yr)r2r4r-r
s r�test_getbuf_failz$AbstractMemoryTests.test_getbuf_fail;s�����)�T�Z�Z��4rc��|j}|�|jd�||j�}|j|�}|j	t|�td��|j
�|j	t|�td��|j|�}|j
�|jtt
|�y)NrCr)	rrHr
r-r.�hashr�r2rYr_s    r�	test_hashzAbstractMemoryTests.test_hash>s����\�\��
�:��M�M�5�6��t�|�|����J�J�q�M������a��$�y�/�2�	�	�	������a��$�y�/�2�
�J�J�q�M��	�	�	�����*�d�A�.rc��|j}|�|jd�||j�}|j|�}|j	t
t|�y)NrL)rrHr
r-r2rYr�r_s    r�test_hash_writablez&AbstractMemoryTests.test_hash_writablePsJ��
�\�\��
�:��M�M�4�5��t�|�|����J�J�q�M�����*�d�A�.rc�p��|jD]�}||j�}|j|�}g�|f�fd�	}tj||�}|j|�|�~tjj�|j|�d�|j�d|���y)Nc�(���j|�yr)�append)r�r6�Ls  �r�callbackz2AbstractMemoryTests.test_weakref.<locals>.callback_s�������rr)	rr
r-r�r�r��test�support�
gc_collect)rr5r6rr�r�r�s      @r�test_weakrefz AbstractMemoryTests.test_weakrefYs�����+�+�	#�B��4�<�<� �A��
�
�1�
�A��A� �
����Q��)�B��M�M�"�$��"���L�L�#�#�%��M�M�"�$��%��M�M�!�A�$��"�	#rc
�^�|jD]�}||j�}|j|�}tt	|j���}|j
tt	|��|�|j
tt	|��t|ddd�����y)Nr)rr
r-r<�reversedrlr.)rr5r6r�aslists     r�
test_reversedz!AbstractMemoryTests.test_reversedhs����+�+�	?�B��4�<�<� �A��
�
�1�
�A��(�1�8�8�:�.�/�F����T�(�1�+�.��7����T�(�1�+�.��Q�t��t�W�
�>�	?rc��|jD]�}||j�}|j|�}|j�}|j	|j
�|j	t
|�j
�|j|j�|j��|j�|j���yr)
rr
r-�
toreadonlyrxr�rIr.rlr�)rr5r6r�mms     r�test_toreadonlyz#AbstractMemoryTests.test_toreadonlyps����+�+�	�B��4�<�<� �A��
�
�1�
�A�����B��O�O�B�K�K�(��O�O�J�r�N�3�3�4����R�Y�Y�[�!�(�(�*�5��J�J�L�
�H�H�J�	rc�Z�tjdgd��}t|�}|jd�}|jd�}|dd}t|�}~|j|dd�|j|dd�|j|jd�|j|jd�|jd�}|j|dd�|j|dd�|j|jd�|j|jd�y)N�H)�r�r�r��BrrQr��I)�arrayrI�castr.rX)rr+r�rr6rT�d�_s        r�test_issue22668z#AbstractMemoryTests.test_issue22668{s����K�K��1�2���q�M��
�F�F�3�K��
�F�F�3�K��
�a��F���q�M��
�����1��s�#�����1��s�#�������3�'�������3�'�
�F�F�3�K������1��s�#�����1��s�#�������3�'�������3�'rN) r�r�r�r	�propertyr
rr8r:rArJr\r`rjrnr{r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrs����L�
�!��!��:��:�:�*-�E�:�2:�h�,�1�<�<	�+�,�>�$0�L1�0
�(�	4�5�/�$/�
#�?�	�(rrc� �eZdZeZeZeZdZdZ	y)�BaseBytesMemoryTestsrOr�N)
r�r�r�rdr�	bytearrayrrcr}rXrrrr�r��s���G��G��L��H�
�Frr�c��eZdZdZd�Zd�Zejd�jZdZe	jd�d��Ze	jd�d��Zy)	�BaseArrayMemoryTestsNc�@�tjdt|��S�Nr@)r�r<�rr6s  rrzBaseArrayMemoryTests.<lambda>�s��e�k�k�#�t�A�w�7�rc�\�tjdt|��j�Sr�)r�r<rgr�s  rrzBaseArrayMemoryTests.<lambda>�s��5�;�;�s�D��G�#<�#D�#D�#F�rr@z/XXX test should be adapted for non-byte buffersc��yrrr
s rr�z#BaseArrayMemoryTests.test_getbuffer����rz:XXX NotImplementedError: tolist() only supports byte viewsc��yrrr
s rrnz BaseArrayMemoryTests.test_tolist�r�r)
r�r�r�rrrcr�r}rX�unittest�skipr�rnrrrr�r��sl���G�7�G�F�L��u�{�{�3��(�(�H�
�F��X�]�]�D�E�
�F�
��X�]�]�O�P�
�Q�
rr�c��eZdZd�Zd�Zy)�BaseMemoryviewTestsc��t|�Sr�rI)r�objs  rr-zBaseMemoryviewTests._view�s���#��rc�4�|j|||��yr�r.�rr5r��contentss    rrUz#BaseMemoryviewTests._check_contents�s������b��l�+rN)r�r�r�r-rUrrrr�r��s���,rr�c�"�eZdZdZd�Zd�Zd�Zy)�BaseMemorySliceTests�XabcdefYc�"�t|�}|ddS�NrO�r��rr�rs   rr-zBaseMemorySliceTests._view�s���s�O����1�v�
rc�:�|j|dd||��yr�r�r�s    rrUz$BaseMemorySliceTests._check_contents��������Q�q��2�h�<�0rc���|jD]\}t||j��}tj|�}|dd|jtj|�|��^y)NrOrQ)rrIr
r#r,r.)rr5rr7s    r�	test_refszBaseMemorySliceTests.test_refs�sX���+�+�	>�B��2�d�l�l�+�,�A��/�/�!�,�K�
�a��F����S�_�_�Q�/��=�		>rN)r�r�r�r	r-rUrrrrr�r��s���L��1�>rr�c��eZdZdZd�Zd�Zy)�BaseMemorySliceSliceTestsr�c�(�t|�}|ddddS)NrrOr�rs   rr-zBaseMemorySliceSliceTests._view�s���s�O����!�u�Q�R�y�rc�:�|j|dd||��yr�r�r�s    rrUz)BaseMemorySliceSliceTests._check_contents�rrN)r�r�r�r	r-rUrrrrr�s���L��1rrc��eZdZd�Zy)�BytesMemoryviewTestc��|jD]�}||j�}|jt|��|jt|���|j	t
t�|j	t
t||�|j	t
t|��|j	t
t|d����y)N)�object)�argumentT)rr
rxrIr2r4)rr5�obs   r�test_constructorz$BytesMemoryviewTest.test_constructor�s����+�+�	H�B��D�L�L�!�B��O�O�J�r�N�+��O�O�J�b�1�2����i��4����i��R��<����i��b��A����i��R�$��G�	HrN)r�r�r�rrrrrr�s��Hrrc��eZdZd�Zy)�ArrayMemoryviewTestc���tjdtd��}t|�}tjdtddd��}||dd|j||�y)Nr@�
�	r)r�r=rIr.)rr+r�new_as    r�test_array_assignz%ArrayMemoryviewTest.test_array_assign�sQ���K�K��U�2�Y�'���q�M�����C��q�"�b�!1�2����!������E�"rN)r�r�r�rrrrrr�s��#rrc��eZdZy)�BytesMemorySliceTestNr�rrrrr����rrc��eZdZy)�ArrayMemorySliceTestNr�rrrrr�rrrc��eZdZy)�BytesMemorySliceSliceTestNr�rrrrr�rrrc��eZdZy)�ArrayMemorySliceSliceTestNr�rrrr r �rrr c�0�eZdZd�Zd�Zd�Zd�Zd�Zd�Zy)�	OtherTestc�t�tjd�}t|jd��}|j�}t	|�jd�}|dd|dd|dd|dd|j
|jd�dD]�}|j|�5|j�}t	|�j|�}t	|�j|�dd|ddt	|�j|�dd|dd|j
|jd�ddd���y#1swY��xYw)N�ctypesg333333�?r�rQ�Bbc)	r�
import_modulerd�c_doublerIr�r.rE�subTest)rr$�p6r�rrXs      r�test_ctypes_castzOtherTest.test_ctypes_casts&���,�,�X�6��
�6�?�?�3�'�
(���O�O����q�M���s�#���2�A���"�1���1�2���!�"��������#�&��	/�F����f�%�
/��O�O�%���q�M�&�&�v�.��"�2��+�+�F�3�B�Q�7��"�1��"�2��+�+�F�3�A�B�7��!�"��� � ����#�.�
/�
/�	/�
/�
/�s
�BD.�.D7	c�z�tjdddd�}tjdddd�}t|�jd�}t|�jd�}|j	|j
dz|j
�|j
|j�|j��y)	N�eeer(g��g�?�fff�e�frQ)�struct�packrIr�r.�nbytes�assertListEqualrl)r�	half_data�
float_data�	half_view�
float_views     r�test_half_floatzOtherTest.test_half_floats����K�K��s�D�#�6�	��[�[���T�3�7�
��y�)�.�.�s�3�	��
�+�0�0��5�
�����)�)�A�-�z�/@�/@�A����Y�-�-�/��1B�1B�1D�Erc�z�ddz}t|�}|ddd�}|j|j�ddz�y)NrNi@
r�30)rIr.�hex)rr��m1�m2s    r�test_memoryview_hexzOtherTest.test_memoryview_hexs;���6�M��
��]��
��"��X���������4�&�=�1rc��td�}|jt�5tj|�ddd�y#1swYyxYw)Nr�)rIr2r4�copyr�s  r�	test_copyzOtherTest.test_copy"s:���v���
�
�
�y�
)�	��I�I�a�L�	�	�	�s�A�A	c���td�}ttjdz�D]6}|j	t
�5tj||�ddd��8y#1swY�CxYw)Nr�rO)rIr=�pickle�HIGHEST_PROTOCOLr2r4�dumps)rr�protos   r�test_picklezOtherTest.test_pickle'sa���v����6�2�2�Q�6�7�	'�E��"�"�9�-�
'����Q��&�
'�
'�	'�
'�
'�s�A"�"A+	c�������d����fd��G�fd�d�}G�fd�d�}G�fd�d�}d�ttd	�z���|jt�5�|�ddd�d�ttd	�z���|j	t�d|��d
gdz�d�ttd	�z���|j	t�|�d�d
gdz�d�ttd	�z��j
d
d��|jtd�5�|�dfddd�d�ttd	�z��j
d
d��|jtd�5�d|�fddd�d�ttd	�z���|jtd�5d�|�<ddd�|j	�ddd�d�ttd	�z���|jtd�5d�d|�ddd�|j	�ddd�d�ttd	�z���|jtd�5d�|�dddd�|j	�ddd�d�ttd	�z��j
d
d��|jtd�5d�|�df<ddd�|j	�ddd�d�ttd	�z��j
d
d��|jtd�5d�d|�f<ddd�|j	�ddd�d�ttd	�z���|jtd�5|��d<ddd�|j	�ddd�dD]�}|j|��5d�ttd	�z��j
|��|jtd�5|��d<ddd�|j	�ddd�ddd���dD]�}|j|��5d�ttd	�z��j
|��|jtd�5|��d<ddd�|j	�ddd�ddd���d�ttd	�z��j
d��|jtd�5|��d<ddd�|j	�ddd�y#1swY���xYw#1swY��xYw#1swY���xYw#1swY���xYw#1swY��JxYw#1swY��xYw#1swY���xYw#1swY��HxYw#1swY���xYw#1swY���xYw#1swY��xYw#1swY��xYw#1swY���xYw#1swY��xYw)N�c�<���j�t���yr)r�r�)�bar�sizes���rr�z3OtherTest.test_use_released_memory.<locals>.release2s���
�I�I�K��4��Brc���eZdZ�fd�Zy)�3OtherTest.test_use_released_memory.<locals>.MyIndexc�����y)Nr^r�rr�s �r�	__index__z=OtherTest.test_use_released_memory.<locals>.MyIndex.__index__7s����	�rN)r�r�r�rQ�r�s�r�MyIndexrN6s���
rrSc���eZdZ�fd�Zy)�3OtherTest.test_use_released_memory.<locals>.MyFloatc�����y)Ng@rrPs �r�	__float__z=OtherTest.test_use_released_memory.<locals>.MyFloat.__float__;�����	�rN)r�r�r�rWrRs�r�MyFloatrU:����
rrYc���eZdZ�fd�Zy)�2OtherTest.test_use_released_memory.<locals>.MyBoolc�����y)NTrrPs �r�__bool__z;OtherTest.test_use_released_memory.<locals>.MyBool.__bool__?rXrN)r�r�r�r^rRs�r�MyBoolr\>rZrr_���r^�r�)�@rQzoperation forbiddenr)rQrc�*ssspam��bhilqnBHILQN)�fmt�fd�?)	rIr�r2rYr.r<r�r�r()	rrSrYr_rgrKrr�rLs	     @@@@r�test_use_released_memoryz"OtherTest.test_use_released_memory-s������	!�	�	�	�	�	�	�
���y����.�/��
�
�
�z�
*�	�
�g�i�L�	����y����.�/������a�
���m�,�s�e�a�i�8�
���y����.�/������a��	�!�n�-��u�q�y�9�
���y����.�/�4�4�S�'�B��
�
#�
#�J�0E�
F�	�
�g�i��l�O�	����y����.�/�4�4�S�'�B��
�
#�
#�J�0E�
F�	�
�a���l�O�	����y����.�/��
�
#�
#�J�0E�
F�	��A�g�i�L�	�����B�Q���)�
���y����.�/��
�
#�
#�J�0E�
F�	$�#�A�j�w�y�M�	$�����B�Q���)�
���y����.�/��
�
#�
#�J�0E�
F�	%�$�A�g�i��N�	%�����B�Q���)�
���y����.�/�4�4�S�'�B��
�
#�
#�J�0E�
F�	!� �A�g�i��l�O�	!�����A�b��7�+�
���y����.�/�4�4�S�'�B��
�
#�
#�J�0E�
F�	!� �A�a���l�O�	!�����B�Q���)�
���y����.�/��
�
#�
#�J�0E�
F�	��9�A�a�D�	�����B�Q���)�!�	2�C����#��&�
2����y����6�7�<�<�S�A���+�+�J�8M�N�%�"�9�A�a�D�%�� � ��B�Q���1�
2�
2�	2��	2�C����#��&�
2����y����6�7�<�<�S�A���+�+�J�8M�N�%�"�9�A�a�D�%�� � ��B�Q���1�
2�
2�	2����y����.�/�4�4�S�9��
�
#�
#�J�0E�
F�	��8�A�a�D�	�����B�Q���)�Y	�	��	�	��
	�	��
	�	��	$�	$��	%�	%��	!�	!��
	!�	!��	�	��%�%��
2�
2��%�%��
2�
2��	�	�s�� U�2
U
�
U�
U'�!U4�8V�
V�
V�!V(� ?W�V5�*W�(?W�'W�2W�W)�U
�
U�U$�'U1�4U>�V�V�V%�(V2�5V?�:W�W	�W�W�W&	�)W2N)	r�r�r�r*r8r>rArGrjrrrr"r"�s"��/�&F�2��
'�d*rr"�__main__)r��test.supportr�r#r�r�r�r�r@rCr0rrr�r�r�r�r�TestCaserrrrrr r"r��mainrrr�<module>ros3�����
�	���	��
�
�&�y(�y(�@�.��

�.�

�(,�,�>�>�"1�1�H�(�+�+��-�H�	#�(�+�+��-�	#�	�8�,�,��.�	�	�8�,�,��.�	�	�� 1� 1��3�	�	�� 1� 1��3�	�
R*��!�!�R*�h�z���H�M�M�O�r