Sindbad~EG File Manager

Current Path : /proc/2568807/root/usr/local/lib/python3.12/test/__pycache__/
Upload File :
Current File : //proc/2568807/root/usr/local/lib/python3.12/test/__pycache__/test_bytes.cpython-312.opt-1.pyc

�

&ΜgLB��z�dZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlm
Z
ddlmZddlZddlZddlmZmZddlmZej*j,rd�Znd�ZGd	�d
�ZGd�d�ZGd
�dee
j4�ZGd�dee
j4�ZGd�de
j4�ZGd�de
j4�ZGd�dej>j@�Z!Gd�de!e
j4�Z"Gd�de!e
j4�Z#Gd�d�Z$Gd�de%�Z&Gd�d e%�Z'Gd!�d"e(�Z)Gd#�d$e(�Z*Gd%�d&�Z+Gd'�d(e$e
j4�Z,Gd)�d*e$e
j4�Z-Gd+�d,e$e
j4�Z.e/d-k(re
j`�yy).z�Unit tests for the bytes and bytearray types.

XXX This is a mess.  Common tests should be unified with string_tests.py (and
the latter should be modernized).
�N)�
import_helper)�warnings_helper)�bigaddrspacetest�MAX_Py_ssize_t)�assert_python_failurec�B��tj���fd��}|S)Nc�v��tjdtf�5�|i|��cddd�S#1swYyxYw�N��r�check_warnings�BytesWarning)�args�kw�funcs  ��,/usr/local/lib/python3.12/test/test_bytes.py�wrapperz%check_bytes_warnings.<locals>.wrappers0��� �/�/��\�0B�C��T�(�R�(�D�C�C�s�/�8)�	functools�wraps)rrs` r�check_bytes_warningsrs%���	����	�	)�
�	)���c��|S�N�)rs rrr$s���rc��eZdZdd�Zd�Zy)�	Indexablec��||_yr��value��selfrs  r�__init__zIndexable.__init__)�	����
rc��|jSrr�r!s r�	__index__zIndexable.__index__+����z�z�rN)r)�__name__�
__module__�__qualname__r"r&rrrrr(s���rrc���eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zed��Zd�Zd�Zed��Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!d�Z"d�Z#d �Z$d!�Z%d"�Z&d#�Z'd$�Z(d%�Z)d&�Z*d'�Z+d(�Z,d)�Z-d*�Z.d+�Z/d,�Z0d-�Z1d.�Z2d/�Z3d0�Z4d1�Z5d2�Z6d3�Z7d4�Z8d5�Z9d6�Z:d7�Z;d8�Z<d9�Z=d:�Z>d;�Z?d<�Z@d=�ZAd>�ZBd?�ZCd@�ZDdA�ZEdB�ZFdC�ZGdD�ZHdE�ZIdF�ZJdG�ZKyH)I�
BaseBytesTestc�p�|jt|�t|��|j||�yr)�assertIs�type�assertEqual)r!�actual�expecteds   r�assertTypedEqualzBaseBytesTest.assertTypedEqual1s(���
�
�d�6�l�D��N�3������*rc��|j�}|jt|�|j�|j|j|j�yr)�	type2testr0r/�	__class__�r!�bs  r�test_basicszBaseBytesTest.test_basics5s>���N�N�������a��$�.�.�1�������d�n�n�5rc���|jd�}tjtjfD]@}||�}|j||�|jt	|�t	|���By�N�abcd)r5�copy�deepcopyr0r/�r!�a�copy_methodr8s    r�	test_copyzBaseBytesTest.test_copy:sX���N�N�7�#�� �I�I�t�}�}�5�K��A��A����Q��"����T�!�W�d�1�g�.�6rc���|j��|jt��d�|jt�fd��|jt�fd��|jt�fd��|jt�fd��|jt�fd��|jt�fd��|jt�fd��|jt�fd	��|jt�fd
��|jt�fd��|jt�fd��y)
Nrc����dS�Nrr�r8s�r�<lambda>z3BaseBytesTest.test_empty_sequence.<locals>.<lambda>D�	���a��drc����dS�N�rrFs�rrGz3BaseBytesTest.test_empty_sequence.<locals>.<lambda>ErHrc�*���tjSr��sys�maxsizerFs�rrGz3BaseBytesTest.test_empty_sequence.<locals>.<lambda>Fs
���a����nrc�0���tjdzSrJrMrFs�rrGz3BaseBytesTest.test_empty_sequence.<locals>.<lambda>Gs���a����A�
�.>rc����ddzS�N�
�drrFs�rrGz3BaseBytesTest.test_empty_sequence.<locals>.<lambda>Hs
���a��C��jrc����dS�N���rrFs�rrGz3BaseBytesTest.test_empty_sequence.<locals>.<lambda>I�	���a��erc����dS)N���rrFs�rrGz3BaseBytesTest.test_empty_sequence.<locals>.<lambda>JrXrc�,���tjSrrMrFs�rrGz3BaseBytesTest.test_empty_sequence.<locals>.<lambda>Ks���a�����orc�2���tjdz
SrJrMrFs�rrGz3BaseBytesTest.test_empty_sequence.<locals>.<lambda>L����a�����Q��.?rc�2���tjdz
S)N�rMrFs�rrGz3BaseBytesTest.test_empty_sequence.<locals>.<lambda>Mr]rc����ddzSrRrrFs�rrGz3BaseBytesTest.test_empty_sequence.<locals>.<lambda>Ns���a��S���kr)r5r0�len�assertRaises�
IndexErrorr7s @r�test_empty_sequencez!BaseBytesTest.test_empty_sequenceAs�����N�N�������Q���#����*�l�3����*�l�3����*�&<�=����*�&>�?����*�&8�9����*�m�4����*�m�4����*�&=�>����*�&?�@����*�&?�@����*�&9�:rc��|jtd��}|jt|�d�|jt	|�t	td���|jdh�}|j|d�|jddh�}|jt
|�ddh�|jttd���}|jt|�d�|jt	|�t	td���|jd�td�D��}|jt|�d	�|jt	|�t	td��d
dd��Gd�d
�}|j|��}|j|d�y)N��*�*�+�-)rirj)rjric3�,K�|]}|dzs�	|���y�w)r_Nr)�.0�is  r�	<genexpr>z3BaseBytesTest.test_from_iterable.<locals>.<genexpr>as����:�j��A��E�1�j�s�
��rKr_c��eZdZd�Zy)�+BaseBytesTest.test_from_iterable.<locals>.Sc��d|S)N�rKr_�r)r!rms  r�__getitem__z7BaseBytesTest.test_from_iterable.<locals>.S.__getitem__gs�� ��|�#rN)r(r)r*rurrr�Srqfs��
$rrv�)r5�ranger0ra�list�assertIn�tuple�iter)r!r8rvs   r�test_from_iterablez BaseBytesTest.test_from_iterablePs\���N�N�5��:�&������Q���%�����a��$�u�S�z�"2�3�
�N�N�B�4� ������D�!��N�N�B��8�$���
�
�e�A�h��8� 4�5�
�N�N�4��c�
�+�,������Q���%�����a��$�u�S�z�"2�3�
�N�N�:�e�C�j�:�:������Q���%�����a��$�u�S�z�"2�1�4�a�4�"8�9�	$�	$�
�N�N�1�3�������O�,rc� �|jttd���}|jt	|�d�|jt|�ttd���|jd�}|j|d�y�Nrfrsrw)r5r{rxr0raryr7s  r�test_from_tuplezBaseBytesTest.test_from_tuplelsh���N�N�5��s��,�-������Q���%�����a��$�u�S�z�"2�3��N�N�9�%������O�,rc�$�|jttd���}|jt	|�d�|jt|�ttd���|jgd��}|j|d�yr)r5ryrxr0rar7s  r�test_from_listzBaseBytesTest.test_from_listtsh���N�N�4��c�
�+�,������Q���%�����a��$�u�S�z�"2�3��N�N�9�%������O�,rc����G�fd�d�}|�|�g�|jt��d�G�fd�d�}|�g�|jt��d�y)Nc���eZdZ�fd�Zy)�0BaseBytesTest.test_from_mutating_list.<locals>.Xc�&���j�y�Nrg��clear�r!r@s �rr&z:BaseBytesTest.test_from_mutating_list.<locals>.X.__index__s������	�rN�r(r)r*r&�r@s�r�Xr�~s���
rr�rhc���eZdZ�fd�Zy)�0BaseBytesTest.test_from_mutating_list.<locals>.Yc�D��t��dkr�j|�y)N��rg)ra�appendr�s �rr&z:BaseBytesTest.test_from_mutating_list.<locals>.Y.__index__�s����q�6�D�=��H�H�T�N�rNr�r�s�r�Yr������
rr�s�****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************�r0�bytes)r!r�r�r@s   @r�test_from_mutating_listz%BaseBytesTest.test_from_mutating_list|sY���	�	��S�!�#�J������q��4�(�	�	�
�S�E������q��;�/rc�Z�|jt�td�td�td�g�}|jt|�gd��|j	t
|jtd�g�|j	t
|jtd�g�y)NrK���rrKr�r�rWrf)r5rr0ryrb�
ValueErrorr7s  r�test_from_indexzBaseBytesTest.test_from_index�sz���N�N�I�K��1��y��~�%�c�N�,�
-������a��"2�3����*�d�n�n�y��}�o�F����*�d�n�n�y��~�6F�Grc�(�|jtjdgd���}|j|d�|jd�}|j|d�Gd�dt�}|j|j|d��d�y)N�Brsrwc��eZdZd�Zy)�)BaseBytesTest.test_from_buffer.<locals>.Bc��t�r)�	TypeErrorr%s rr&z3BaseBytesTest.test_from_buffer.<locals>.B.__index__�s���rNr�rrrr�r��s��
 rsfoobar)r5�arrayr0r�)r!r@r�s   r�test_from_bufferzBaseBytesTest.test_from_buffer�st���N�N�5�;�;�s�I�6�7������O�,��N�N�?�+������O�,�	 ��	 �	
�������)��5�y�Arc��|j|jd�d�|j|jd�d�|j|jd�d�|jt|jd�|j|jdd	�d
�|j|jd
�d
�|jt|jt
jdz�y)NrrrK��srW�0�ascii�0)r0r5rbr��
OverflowErrorrNrOr%s r�test_from_ssizezBaseBytesTest.test_from_ssize�s����������*�C�0��������*�G�4��������*�,C�D����*�d�n�n�b�9��������W�5�t�<��������-�t�4����-�������q��Irc�"�|jt|jd�Gd�d�}|jt|jdg�|jt|jdg�|jt|jdg�|jt|j|�g�|jt|jd��|jt|jd��|jt|jd	d�|jt|jd
d�|jt|jd	d��|jt|jd
d��|jt|jd�|jt|jdd��|jt|jdd�|jt|jddd
�y)Ngc��eZdZy)�5BaseBytesTest.test_constructor_type_errors.<locals>.CN�r(r)r*rrr�Cr�����rr�r�r�)�encoding�ignore)�errorsrrrsasciisignore)rbr�r5)r!r�s  r�test_constructor_type_errorsz*BaseBytesTest.test_constructor_type_errors�s�����)�T�^�^�S�9�	�	����)�T�^�^�c�U�;����)�T�^�^�c�U�;����)�T�^�^�d�V�<����)�T�^�^�a�c�U�;����)�T�^�^�g��F����)�T�^�^�H��E����)�T�^�^�Q��@����)�T�^�^�S�'�B����)�T�^�^�Q�x��H����)�T�^�^�S���J����)�T�^�^�R�8����)�T�^�^�R���I����)�T�^�^�R��B����)�T�^�^�R��)�Lrc�^�|jt|jdg�|jt|jtjg�|jt|jtjdz
g�|jt|jtjdz
g�|jt|jddzg�|jt|jdg�|jt|jdg�|jt|jtjg�|jt|jtjdzg�|jt|jddzg�y)NrWrKr_rSrTrfi)rbr�r5rNrOr%s r�test_constructor_value_errorsz+BaseBytesTest.test_constructor_value_errors�s$�����*�d�n�n�r�d�;����*�d�n�n����|�n�E����*�d�n�n����|�A�~�6F�G����*�d�n�n����|�A�~�6F�G����*�d�n�n��C��x�j�A����*�d�n�n�s�e�<����*�d�n�n�s�e�<����*�d�n�n�s�{�{�m�D����*�d�n�n�s�{�{�1�}�o�F����*�d�n�n�r�3�w�i�@rc��t}|jttf|j|�	t|dz
�y#ttf$rYywxYw)N�)rrbr��MemoryErrorr5�	bytearray)r!�sizes  r�test_constructor_overflowz'BaseBytesTest.test_constructor_overflow�sL�������=�+�6�����M�	�
�d�Q�h����{�+�	��	�s�>�A�Ac��Gd�d�}|jt|j|��|jt|j|�g�Gd�d�}|jt|j|��y)Nc��eZdZd�Zy)�9BaseBytesTest.test_constructor_exceptions.<locals>.BadIntc��ddzy�NrKrrr%s rr&zCBaseBytesTest.test_constructor_exceptions.<locals>.BadInt.__index__��	���!�rNr�rrr�BadIntr�����
rr�c��eZdZd�Zy)�>BaseBytesTest.test_constructor_exceptions.<locals>.BadIterablec��ddzyr�rr%s r�__iter__zGBaseBytesTest.test_constructor_exceptions.<locals>.BadIterable.__iter__�r�rN)r(r)r*r�rrr�BadIterabler��r�rr�)rb�ZeroDivisionErrorr5)r!r�r�s   r�test_constructor_exceptionsz)BaseBytesTest.test_constructor_exceptions�sg��	�	�	
���+�T�^�^�V�X�F����+�T�^�^�f�h�Z�H�	�	�	
���+�T�^�^�[�]�Krc���|jgd��}|jgd��}|jddg�}|j||�|j||k7�|j||k�|j||k�|j||k�|j||k\�|j||k\�|j||kD�|j||k7�|j||k(�|j||kD�|j||kD�|j||k\�|j||k�|j||k�|j||k�y)NrsrKrt)r5r0�
assertTrue�assertFalse)r!�b1�b2�b3s    r�test_comparezBaseBytesTest.test_compare�s@��
�^�^�I�
&��
�^�^�I�
&��
�^�^�Q��F�
#������R� �����b��!�����b��!�����b��!�����b��!�����b��!�����b��!�����b��!�����r��"�����r��"�����r��"�����r��"�����r��"�����r��"�����r��"�����r��"rc���|j|jd�dk(d�|j|jd�dk(d�|j|jd�dk(d�|j|jd�dk(d�|j|j�t�k(d�|j|j�t�k7d�y)Nsabc�abcFsabcsabcsabcT)r0r5�strr%s r�test_compare_to_strz!BaseBytesTest.test_compare_to_str�s���
	
�������5��>��F�������(@�A�U�J�!�	#��������5��>��F�������(@�A�U�J�!�	#�������)�S�U�2�E�:�������)�S�U�2�D�9rc���tttd��}|j|�}tt	|��}|j�|j
||�y)N�Hello)ry�map�ordr5�reversed�reverser0)r!�inputr8�outputs    r�
test_reversedzBaseBytesTest.test_reversed	sH���S��g�&�'���N�N�5�!���h�q�k�"��
�
�
�������'rc�����fd�}|d�}�j|dd|d���j|dd|d���j|dd|d���j|dd|d	���j|dd
|d	���j|dd|d	���j|dd|d���j|d
d|d���j|dd|d���j|dd|d	���j|dd
|d	���j|dd|d	���j|dd|d��y)Nc�B���jtt|��Sr)r5r�r�)�sr!s �r�byz'BaseBytesTest.test_getslice.<locals>.bys����>�>�#�c�1�+�.�.r�Hello, worldr�r�rK�ello�z, �world�rT���i����������)r0�r!r�r8s`  r�
test_getslicezBaseBytesTest.test_getslicesd���	/��~�������2�A���7��,�����1�Q���F��,�����1�Q���D��*�����1�2���7��,�����1�R��"�W�+�.�����1�S��2�g�;�/�����3�B���G��-�����3�r��B�v�J�/�����2�b��2�d�8�,�����2�3���G��-�����2�b��2�g�;�/�����2�c��B�w�K�0�����4���B�w�K�0rc��ttd��}|j|�}ddddddtjddd	d
f}|D]@}|D]9}|ddD]/}|j||||�|j||||����1�;�By)Nr�rrKrt�rTrWrZ���r�)ryrxr5rNrOr0)r!�Lr8�indices�start�stop�steps       r�test_extended_getslicez$BaseBytesTest.test_extended_getslice$s�����s�����N�N�1����d�A�q�"�c�3�;�;��B��T�J���E���#�A�B�K�D��$�$�Q�u�T�$��%7�����%�PT�UY�/�HZ�9[�\�(� �rc	�N�d}dD]D}|j||�}|j||j|j|����F|jt|j|d�|j|dd�}|j||j|ddd��y)N�Hello world
ሴ噸骼��utf-8zutf-16�latin-1r����r�)r5r0�encoderb�UnicodeEncodeError�r!�sample�encr8s    r�
test_encodingzBaseBytesTest.test_encoding/s���2��&�C����v�s�+�A����Q����v�}�}�S�/A� B�C�'�	
���,�d�n�n�f�i�P��N�N�6�9�h�7������D�N�N�6�#�2�;��@�Arc���d}dD]5}|j||�}|j|j|�|��7d}|j|d�}|jt|jd�|j|jdd�d�|j|jdd��d�|j|jd	�j�d
�y)Nr�r�uHello world
€þÿr�r�r�zHello world
)r�r�s☃u☃)r5r0�decoderb�UnicodeDecodeErrorrs    r�test_decodezBaseBytesTest.test_decode8s���2��&�C����v�s�+�A����Q�X�X�c�]�F�3�'�1���N�N�6�9�-�����,�a�h�h��@�������'�8�4�o�F��������G��D�(�	*�	
�������8�?�?�A�8�Lrc���d}d}tjd|jj�d|�d|�d|�d|�d|�d	|�d
��}t	ddd
|�}|j|jd|�y)NzBoom, Shaka Laka, Boom!)r��utf8�latin1z0
            import sys
            type2test = z
            encodings = zr

            for data in ('', 'short string'):
                try:
                    type2test(data, encoding=z�)
                except LookupError:
                    pass
                else:
                    sys.exit(21)

                for encoding in encodings:
                    try:
                        type2test(data, encoding=encoding, errors=a>)
                    except LookupError:
                        pass
                    else:
                        sys.exit(22)

            for data in (b'', b'short string'):
                data = type2test(data)
                print(repr(data))
                try:
                    data.decode(encoding=z�)
                except LookupError:
                    sys.exit(10)
                else:
                    sys.exit(23)

                try:
                    data.decode(errors=z�)
                except LookupError:
                    pass
                else:
                    sys.exit(24)

                for encoding in encodings:
                    try:
                        data.decode(encoding=encoding, errors=z�)
                    except LookupError:
                        pass
                    else:
                        sys.exit(25)

            sys.exit(10)
        z-X�devz-crS)�textwrap�dedentr5r(rr0�rc)r!�invalid�	encodings�code�procs     r�test_check_encoding_errorsz(BaseBytesTest.test_check_encoding_errorsFs���,��/�	����$����0�0�1�2�"�
�&.�/6�[�9C�DK�+�
N*�+2��5(�)0�{�3?�@G�k�J	�Q/ �/
��`%�T�5�$��=��������"�d�+rc�>�|jd�}|j||j��|jd�}|j||jdgdz��|jd�}|j||jdgdz��y)NrrSi')r5r0r7s  r�
test_from_intzBaseBytesTest.test_from_int~s����N�N�1�������D�N�N�,�-��N�N�2�������D�N�N�A�3�r�6�2�3��N�N�5�!������D�N�N�A�3�u�9�5�6rc�R���|jd��|jd��|j��zd�|j�td�zd�|jtd��zd�|jt�fd��|jt�fd��y)N�abc�def�abcdefsdefabcc����dzS)N�defr)r�s�rrGz+BaseBytesTest.test_concat.<locals>.<lambda>�s	���R�%�Zrc���d�zS)Nr�r)r�s�rrGz+BaseBytesTest.test_concat.<locals>.<lambda>�s	���U�R�Zr)r5r0r�rbr�)r!r�r�s @@r�test_concatzBaseBytesTest.test_concat�s����
�^�^�F�
#��
�^�^�F�
#������b��)�,�����e�F�m�+�Y�7�����v���+�Y�7����)�%7�8����)�%7�8rc�$��d|jd�fD]��|j�dzd�|j�dzd�|j�dzd�|jt�fd��|jt�fd��|jtt
f�5�tjz}ddd�|jtt
f�5�tjz�ddd���y#1swY�CxYw#1swY��xYw)	Nrrt�	abcabcabcrrrWc����dzS�Ng��Q�	@rrFs�rrGz+BaseBytesTest.test_repeat.<locals>.<lambda>�s	����T�rc���d�zSr#rrFs�rrGz+BaseBytesTest.test_repeat.<locals>.<lambda>�s	�����r)r5r0rbr�r�r�rNrO�r!�cr8s  @r�test_repeatzBaseBytesTest.test_repeat�s���������/�/�A����Q��U�L�1����Q��U�C�(����Q��V�S�)����i�)9�:����i�)9�:��"�"�M�;�#?�@�����O��A��"�"�M�;�#?�@��S�[�[� ��A�@�0�A�@��@�@�s�$C:�D�:D	�D	c��|j|jd�dz|jtd�gdz��y)N�xrT�x)r0r5r�r%s r�test_repeat_1charzBaseBytesTest.test_repeat_1char�s3���������-�c�1�4�>�>�3�s�8�*�S�.�3Q�Rrc�,��|jd��|jtd���|jttd����|j	d��|jt�fd��|jt�fd��|jt�fd��|jt�fd��|jt�fd��|jt�fd	��ttfD�]}|j|d
���|j|d���|j|d���|j|d
���|j|d���|j|d���|j|d���|j	|d���|j	|d���|j	|d���|j	|d�����y)Nrr@��c���d�vS)N�,rrFs�rrGz-BaseBytesTest.test_contains.<locals>.<lambda>�s	���c�Q�hrc���d�vSrVrrFs�rrGz-BaseBytesTest.test_contains.<locals>.<lambda>�s	���b�A�grc�.��tjdz�vSrJrMrFs�rrGz-BaseBytesTest.test_contains.<locals>.<lambda>�s���c�k�k�!�m�q�.@rc���d�vSrrrFs�rrGz-BaseBytesTest.test_contains.<locals>.<lambda>�s	���T�Q�Yrc�0��ttd���vS�Nr@)�floatr�rFs�rrGz-BaseBytesTest.test_contains.<locals>.<lambda>�s���U�3�s�8�_��-Arc���d�vSr4rrFs�rrGz-BaseBytesTest.test_contains.<locals>.<lambda>�s	���S�A�Xrr�a�b�c�ab�bc�ac�dsdabsabd)
r5rzr��int�assertNotInrbr�r�r�r�)r!�fr8s  @r�
test_containszBaseBytesTest.test_contains�s�����N�N�6�"���
�
�c�#�h��"��
�
�c�#�c�(�m�Q�'�����a� ����*�&6�7����*�o�6����*�&@�A����)�%6�7����)�%A�B����)�%5�6��	�!�A��M�M�!�C�&�!�$��M�M�!�D�'�1�%��M�M�!�D�'�1�%��M�M�!�D�'�1�%��M�M�!�E�(�A�&��M�M�!�E�(�A�&��M�M�!�F�)�Q�'����Q�u�X�q�)����Q�t�W�a�(����Q�v�Y��*����Q�v�Y��*�"rc�h�|jt|jj�|jt|jjd�|j	|jjd�|j��tgd��}|j	|jjd�|�|j	|jjd�|�|j	|jjd�|�dD];}|j	|jj|�|j���=dD]-}|jt|jj|��/|j	|jjd	�d
�|jt|jjd�|jt|jjd�|jt|jjd
�|jt|jjd�|jt|jjd�|jt|jjd�dD]f\}}|jt�5}|jj|�ddd�|jd|ztj���hy#1swY�4xYw)NrKr��ri�0�1a2B30z  1A 2B  30   z
 1A
2B	30z	

 u…   
�0000ss1Br@�rtz1a b cd�z12      34))z12 x4 56rt)z12 3x 56r�)z12 xy 56rt)u	12 3ÿ 56r�zat position %s)
rbr�r5�fromhexr0r�r�rzr��	exception)r!r8r&�data�pos�cms      r�test_fromhexzBaseBytesTest.test_fromhex�sH�����)�T�^�^�%;�%;�<����)�T�^�^�%;�%;�Q�?�������/�/��3�T�^�^�5E�F��(�)��������/�/��9�1�=�������/�/�0@�A�1�E�	
������/�/��@�!�D�+�A����T�^�^�3�3�A�6����8H�I�,�=�A����j�$�.�.�*@�*@�!�D�>�	
������/�/��7��A����)�T�^�^�%;�%;�U�C����*�d�n�n�&<�&<�c�B����*�d�n�n�&<�&<�d�C����*�d�n�n�&<�&<�i�H����*�d�n�n�&<�&<�f�E����*�d�n�n�&<�&<�>N�O�	
�I�D�#��"�"�:�.�"����&�&�t�,�/��M�M�*�S�0�#�b�l�l�2C�D�	
�/�.�s�L(�(L1	c��|jt|jj�|jt|jjd�|j	|jd�j�d�|j	tgd��j�d�|j	|jd�j�d�|j	t
d�j�d�y)NrKrrrC�1a2b30�+0)rbr�r5�hexr0r��
memoryviewr%s r�test_hexzBaseBytesTest.test_hex�s������)�T�^�^�%7�%7�8����)�T�^�^�%7�%7��;��������,�0�0�2�B�7�����#5�6�:�:�<�h�G��������8�<�<�>��I�����O�4�8�8�:�H�Erc�>�|jd�}|j|j�d�|jt�5|jd�ddd�|jt�5|jd�ddd�|j|jdd�d�|jt
�5|jdd�ddd�|jt�5|jd�ddd�|jt�5|jd�ddd�|jt�5|jd	�ddd�|jt�5|jt
d
��ddd�|j|jdd�d�|j|jd�d�|j|jd
�d�|j|jd�d�|j|jd�d�|j|jdd�d�|j|jdd�d�|j|jdd�d�|j|jd�d�|j|jd�d�|j|jdd�d�|j|jdd�d�|j|jdd�d�|j|jdd�d�|j|jdd�d�d}|j|jdd �d!�y#1swY��mxYw#1swY��KxYw#1swY��xYw#1swY���xYw#1swY���xYw#1swY���xYw#1swY��uxYw)"Ns���b901efr�xx�:r�ÿ����rfr�zb901efrI�zb901ef�rtr����zb9:01:ef�$zb9$01$efrKrWr_zb9:01ef�*rZzb901*efs {sworldishelloi0�.�zC7b7305000000776f.726c646902000000.730500000068656c.6c6f690100000030)r5r0rSrbr�r��chr)r!�three_bytesrs   r�test_hex_separator_basicsz'BaseBytesTest.test_hex_separator_basics�s���n�n�_�5��������*�H�5�
�
�
�z�
*��O�O�B��+�
�
�
�z�
*��O�O�D�!�+��������a�0�(�;�
�
�
�y�
)��O�O�D�!�$�*�
�
�
�z�
*��O�O�F�#�+�
�
�
�z�
*��O�O�G�$�+�
�
�
�z�
*��O�O�G�$�+�
�
�
�z�
*��O�O�C��J�'�+��������a�0�(�;��������1�3C�D��������0�2B�C��������1�3C�D��������0�2B�C��������a�0�(�;��������a�0�(�;��������b�1�8�<��������-�z�:��������.�
�;��������a�0�*�=��������b�1�:�>��������a�0�)�<��������a�0�*�=��������b�1�9�=�c��������3��*�,q�r�A+�
*��
*�
*��*�
)��
*�
*��
*�
*��
*�
*��
*�
*�sT�O�6O�O�7O+�&O8�P�P�O�O�O(�+O5�8P�P�Pc�z�|jtdd��}|j|j�d�y)N�Z�_�
5a5b5c5d5e�r5rxr0rS)r!�
five_bytess  r�test_hex_separator_five_bytesz+BaseBytesTest.test_hex_separator_five_bytes	s-���^�^�E�"�R�L�1�
�������)�<�8rc��|jd�tdd�D��}|j|j�d�|j|jdd�d�|j|jdd�d	�|j|jd
d�d�|j|jd
d�d�|j|jd
d�d�|j|jd
d�d�|j|jd
d�d�|j|jdd�d�|j|jd
d�d�|j|jdd�d�|j|jd
d�d�|j|jdd�d�y)Nc3�&K�|]	}|dz���y�w)rtNr�rlr*s  rrnz=BaseBytesTest.test_hex_separator_six_bytes.<locals>.<genexpr>s����"<��1�1�Q�3��s�rKr��0306090c0f12rbz03.06.09.0c.0f.12� r_z0306 090c 0f12�-rtz
030609-0c0f12rYr�z
0306:090c0f12r�z
03:06090c0f12�ri�_r��
030609_0c0f12r_z
0306090c:0f12�@r�z
0306090c0f@12i����i����rk)r!�	six_bytess  r�test_hex_separator_six_bytesz*BaseBytesTest.test_hex_separator_six_bytes
sx���N�N�"<��a���"<�<�	��������.�9�������s�A�.�0C�D�������s�A�.�0@�A�������s�A�.��@�������s�A�.��@�������s�A�.��@�������s�A�.��?�������s�B�/��@�������s�B�/��A�������s�B�/��A�������t�R�0�/�B�������s�B�/��@�������s�C�0�.�Arc��|j|jd�jg�d�|j|jd�jdg�d�dgddgddggd�fD]�}tt	|j|��}|j|jd�j|�d�|j|jd�jt|��d�|j|jd�jt
|��d���|jd�j}|j|dd	g�d
�|j|td�d	g�d
�|j|dtd	�g�d
�|j|td�d	g�d
�|j|dtd	�g�d
�dgdz}ddd
zz}|j||�|�dgdz}ddz}|j|jd�j|�|�|jt|jd�jd�|jt�5|td�ddg�ddd�|jt�5|td�ddg�ddd�y#1swY�<xYw#1swYyxYw)Nrrr7r;r:r9)r7r8r9s.:scdsab.:cdi��s.:abci��� �cdsef)r0r5�joinryr�r{r|rTr�rbr�)r!�lst�dot_join�seqr2s     r�	test_joinzBaseBytesTest.test_joins����������,�1�1�"�5�s�;��������,�1�1�3�%�8�#�>��H�t�U�m�e�T�]�<N�O�C��s�4�>�>�3�/�0�C����T�^�^�C�0�5�5�c�:�F�C����T�^�^�C�0�5�5�e�C�j�A�6�J����T�^�^�C�0�5�5�d�3�i�@�&�I�	P�
�>�>�%�(�-�-������5�%�.�1�9�=�����:�e�#4�e�"<�=�y�I�����5�*�U�*;�"<�=�y�I�����9�U�#3�U�";�<�i�H�����5�)�E�*:�";�<�i�H��h�����H�u�,�,������#���1��h�����F�?���������,�1�1�#�6��A����)�T�^�^�D�%9�%>�%>��E��
�
�y�
)��i��&��e�4�5�*�
�
�
�y�
)��j��'��u�5�6�*�
)�*�
)��
)�
)�s�K,�K8�,K5�8Lc��|jd�}d}d}d}|j|jd�d�|j|jd�d�|j|jd	�d
�|j|j|�d�|j|j|�d
�|j|jdd�d�|j|jdd�d�|j|jdd
d�d
�|j|jddd�d
�|j|j|d�d�|j|j|d�d�|j|j|d
d�d
�|j|j|dd�d
�y)N�mississippi�i�p�w�ir��ssr_�wrrt�prKrtr��	)r5r0�count)r!r8rm�p�ws     r�
test_countzBaseBytesTest.test_count;su���N�N�>�*�����������������*����������+����������*���������Q�'���������Q�'��������q�)�1�-��������q�)�1�-��������q�!�,�a�0��������q�!�,�a�0��������A���*��������A���*��������A�q�)�1�-��������A�q�)�1�-rc��|jd�}|j|j�jd��|j|jd��|j|jd��|j|jd��|j|jd��|j|jd��|j	t
�5}|jdg�ddd�t
j�}|jd|�|jd|�y#1swY�CxYw)	N�hello�anythingshel�hshellowshar�r{)	r5r��
startswithr�rbr�r�rKrz�r!r8rN�excs    r�test_startswithzBaseBytesTest.test_startswithRs����N�N�8�$��������)�4�4�[�A�B�������X�.�/�������V�,�-�������T�*�+�������i�0�1�������e�,�-�
�
�
�y�
)�R�
�L�L�$�� �*��"�,�,����
�
�g�s�#��
�
�g�s�#�	*�
)�s�5E
�
Ec��|jd�}|jt�jd��|j	|jd��|j	|jd��|j	|jd��|j|jd��|j|jd��|jt�5}|jdg�ddd�tj�}|jd|�|jd|�y#1swY�CxYw)	Nr�r�sllo�oswhellosnor�r{)
r5r�r��endswithr�rbr�r�rKrzr�s    r�
test_endswithzBaseBytesTest.test_endswith`s����N�N�8�$�������-�-�k�:�;�����
�
�8�,�-�����
�
�6�*�+�����
�
�4�(�)�������I�.�/�������E�*�+�
�
�
�y�
)�R�
�J�J��v��*��"�,�,����
�
�g�s�#��
�
�g�s�#�	*�
)�s�/E�E
c��|jd�}d}d}|j|jd�d�|j|jd�d�|j|jd�d�|j|j|�d	�|j|j|�d�|j|jdd
�d�|j|jdd	d�d�|j|jdd	d
�d�|j|j|d
�d�|j|j|d	d
�d	�|j|j|d	d
�d�ddtjd	zfD]$}|jtd|j|��&y)Nr�r�r�r�r_r�rW�
mississippianrKrtr�r�rtrfzbyte must be in range\(0, 256\))r5r0�findrNrO�assertRaisesRegexr�)r!r8rmr��indexs     r�	test_findzBaseBytesTest.test_findnsq���N�N�>�*���������������*���������r�*������� 0�1�2�6���������A�&���������B�'��������q�)�1�-��������q�!�,�a�0��������q�!�,�b�1��������1��q�)��������1�a��!�,��������1�a��"�-��#�s�{�{�Q��/�E��"�"��>�����
�0rc���|jd�}d}d}|j|jd�d�|j|jd�d�|j|jd�d�|j|j|�d	�|j|j|�d�|j|jdd
�d�|j|jddd�d
�|j|j|dd
�d�|j|j|d
d�d�|j|j|dd
�d�y)Nr�r�r�r�r�r�rWr�rSrtrrtr_rKr�r�)r5r0�rfind�r!r8rmr�s    r�
test_rfindzBaseBytesTest.test_rfind�s#���N�N�>�*���������������+����������+�������!1�2�B�7���������R�(���������R�(���������*�A�.���������1�-�q�1��������A�q�)�1�-��������A�q�)�1�-��������A�q�)�2�.rc��|jd�}d}d}|j|jd�d�|jt|jd�|jt|jd�|j|j|�d�|jt|j|�|j|jdd	�d
�|j|jddd�d�|jt|jddd	�|j|j|d�d�|j|j|dd	�d�|jt|j|dd	�y)
Nr�r�r�r�r_r�r�rKrtr�r�rt)r5r0r�rbr�r�s    r�
test_indexzBaseBytesTest.test_index�s0���N�N�>�*���������������+����*�a�g�g�t�4����*�a�g�g�/?�@���������Q�'����*�a�g�g�q�1���������*�A�.���������1�-�q�1����*�a�g�g�u�a��;��������A���*��������A�q�)�1�-����*�a�g�g�q�!�Q�7rc���|jd�}d}d}|j|jd�d�|jt|jd�|jt|jd�|j|j|�d�|jt|j|�|j|jdd	�d�|j|jdd
d�d�|j|j|d
d	�d
�|j|j|d	d�d�|jt|j|d
d	�y)Nr�r�r�r�r�r�r�rSrtrrtr_rKr�r�)r5r0�rindexrbr�r�s    r�test_rindexzBaseBytesTest.test_rindex�s���N�N�>�*������������%��!�,����*�a�h�h��5����*�a�h�h�0@�A�������!��b�)����*�a�h�h��2�������%��+�Q�/�������%��A�.��2�������!�Q��*�A�.�������!�Q��*�A�.����*�a�h�h��1�a�8rc����jd�}|}|dz}�j|d��j|d��j||u��jd�}|dz}�j|d��jt	|��j��jd�}|dz}�j|d��jt	|��j��fd	�}|d
ddid
�|dddd�d
�|d
ddd�d
�|ddd�|ddd�|ddd�|ddd�|ddd�|dd d!�|d"d#d#�y)$N�
hello, %b!�world�
hello, world!�%s / 100 = %d%%�sseventy-nine�O�seventy-nine / 100 = 79%�
hello,%b!�
hello,world!c����j|�}||z}�j||��jt|��j�yr)r5r0r.r/)�fmt�vals�resultr8r!s    �r�checkz%BaseBytesTest.test_mod.<locals>.check�s@������s�#�A��D��A����Q��'��M�M�$�q�'�4�>�>�2rs
...%(foo)b...�foors	...abc...s...%(f(o)o)b...sbar)sf(o)or��{)r�rs%*b)r�rs  abc)r�rsabc  s%*.*b)r�r_rs   ab)r�rtrs%i %*.*b)rSr�rtrs10   abcs
%i%b %*.*b)rS�3r�rtrs	103   abc�%cr7�r5r0r�r.r/)r!r8�origr@r�s`    r�test_modzBaseBytesTest.test_mod�sd����N�N�=�)����
��L������,�-�����}�-�����d��#��N�N�-�.��
�%�%������7�8��
�
�d�1�g�t�~�~�.��N�N�+�,��
��L������/�0��
�
�d�1�g�t�~�~�.�	3�	������>�
� �F�6�"B�L�Q�
���c� :�L�I�
�f�l�H�-�
�f�m�X�.�
�h���2�
�h���2�
�k�.��<�
�m�6��E�
�e�T�4� rc���|jd�}|}|dz}|j|d�|j|d�|j||u�|jd�}|dz}|j|d�|jt	|�|j�|jd�}|dz}|j|d�|jt	|�|j�y)	Nr�r�r�r�r�r�r�r�r�)r!r8r�s   r�	test_imodzBaseBytesTest.test_imod�s����N�N�=�)����	�X�
������,�-�����}�-�����d��#��N�N�-�.��	�
"�"������7�8��
�
�d�1�g�t�~�~�.��N�N�+�,��	�X�
������/�0��
�
�d�1�g�t�~�~�.rc��|jt�5t�|jd�zddd�|j	|jd�jd�t�y#1swY�>xYw)Nrz%r)rbr��objectr5r.�__rmod__�NotImplementedr%s r�	test_rmodzBaseBytesTest.test_rmod�sS��
�
�
�y�
)��H�t�~�~�f�-�-�*��
�
�d�n�n�V�,�5�5�d�;�^�L�*�
)�s�A0�0A9c��|jd�}|j|jdd�d�|j|jdd�d�y)Nr�r�r7smassassappar�r)s	mixixippi)r5r0�replacer7s  r�test_replacezBaseBytesTest.test_replace�sF���N�N�>�*��������4��.��?�������5�$�/��>rc�f�|jt|jd�jdd�y)N�a b� r)rbr�r5r�r%s r�test_replace_int_errorz$BaseBytesTest.test_replace_int_error�s%�����)�T�^�^�F�%;�%C�%C�R��Mrc���|jt|jd�jd�|jt|jd�jd�y�Nr�rr�rbr�r5�split�rsplitr%s r�test_split_string_errorz%BaseBytesTest.test_split_string_errorsD�����)�T�^�^�F�%;�%A�%A�3�G����)�T�^�^�F�%;�%B�%B�C�Hrc���|jt|jd�jd�|jt|jd�jd�y�Nr�r�r�r%s r�test_split_int_errorz"BaseBytesTest.test_split_int_errorsD�����)�T�^�^�F�%;�%A�%A�2�F����)�T�^�^�F�%;�%B�%B�B�Grc���dD]4}|j|�}|j|j�|g��6|jd�}|j|j�dg�y)N)sabsabsabsab�		

�)r5r0r�r7s  r�test_split_unicodewhitespacez*BaseBytesTest.test_split_unicodewhitespace
s]��=�A����q�!�A����Q�W�W�Y���,�>�
�N�N�B�C���������%8�$9�:rc�h�|jd�}|j|j�dg�y)Nr�r�)r5r0r�r7s  r�test_rsplit_unicodewhitespacez+BaseBytesTest.test_rsplit_unicodewhitespaces+���N�N�B�C���������&9�%:�;rc��|jd�}|j|jd�d�|j|jd�d�y)Nr�r�)smir�sissippir�)r�rr)r5r0�	partitionr7s  r�test_partitionzBaseBytesTest.test_partitionsD���N�N�>�*��������U�+�-G�H�������T�*�,F�Grc���|jd�}|j|jd�d�|j|jd�d�|j|jd�d�y)Nr�r�)smissir�sippir�)s
mississippr�rr�)rrr�)r5r0�
rpartitionr7s  r�test_rpartitionzBaseBytesTest.test_rpartitions^���N�N�>�*��������e�,�.H�I�������d�+�-G�H�������d�+�-G�Hrc���|jt|jd�jd�|jt|jd�jd�yr��rbr�r5r�r�r%s r�test_partition_string_errorz)BaseBytesTest.test_partition_string_error sD�����)�T�^�^�F�%;�%E�%E�s�K����)�T�^�^�F�%;�%F�%F��Lrc���|jt|jd�jd�|jt|jd�jd�yr�r�r%s r�test_partition_int_errorz&BaseBytesTest.test_partition_int_error$sD�����)�T�^�^�F�%;�%E�%E�r�J����)�T�^�^�F�%;�%F�%F��Krc���ttjdz�D]W}dD]P}|j|�}tj||�}tj
|�}|j
||��R�Yy�NrK)rr7rs�ab�s�)rx�pickle�HIGHEST_PROTOCOLr5�dumps�loadsr0)r!�protor8�ps�qs     r�
test_picklingzBaseBytesTest.test_pickling(sc���6�2�2�Q�6�7�E�F���N�N�1�%���\�\�!�U�+���L�L��$��� � ��A�&�	G�8rc�t�ttjdz�D�]}dD�]}t|j	|��x}}t|j	|��}tj||�}tj|�}|jt|�t|��|jt|�|�tj|�}|s��t|�tj||�}tj|�}|jt|�|dd�����yr�)rxr�r�r|r5ryr�r�r0r/�next)r!r�r8�it�itorgrL�ds       r�test_iterator_picklingz$BaseBytesTest.test_iterator_pickling0s����6�2�2�Q�6�7�E�F��!�$�.�.��"3�4�4��U��D�N�N�1�-�.���L�L��U�+���\�\�!�_��� � ��e��d�2�h�7�� � ��b��4�0��\�\�!�_�����R���L�L��U�+���\�\�!�_��� � ��b��4���8�4�G�8rc�Z�|j|jd�jtd��d�|j|jd�j	td��d�|j|jd�jtd��d�y)Nrr<r8r;r:)r0r5�striprT�lstrip�rstripr%s r�test_strip_bytearrayz"BaseBytesTest.test_strip_bytearrayBs}���������/�5�5�j��6G�H�$�O��������/�6�6�z�%�7H�I�5�Q��������/�6�6�z�%�7H�I�5�Qrc�$�|jt|jd�jd�|jt|jd�jd�|jt|jd�j
d�y)Nr�ac�rbr�r5r�r�r�r%s r�test_strip_string_errorz%BaseBytesTest.test_strip_string_errorGse�����)�T�^�^�F�%;�%A�%A�4�H����)�T�^�^�F�%;�%B�%B�D�I����)�T�^�^�F�%;�%B�%B�D�Irc�$�|jt|jd�jd�|jt|jd�jd�|jt|jd�j
d�y)Ns abc r�rr%s r�test_strip_int_errorz"BaseBytesTest.test_strip_int_errorLse�����)�T�^�^�H�%=�%C�%C�R�H����)�T�^�^�H�%=�%D�%D�b�I����)�T�^�^�H�%=�%D�%D�b�Irc	��|jd�}ttfD]9}|j|j	d|d��|jd���;y)Nrr��-s--abc--)r5r�r�r0�center�r!r8�	fill_types   r�test_centerzBaseBytesTest.test_centerQsJ���N�N�6�"����+�I����Q�X�X�a��4��9�!�^�^�J�7�
9�,rc	��|jd�}ttfD]9}|j|j	d|d��|jd���;y)Nrr�rsabc----)r5r�r�r0�ljustrs   r�
test_ljustzBaseBytesTest.test_ljustX�J���N�N�6�"����+�I����Q�W�W�Q�	�$��8�!�^�^�J�7�
9�,rc	��|jd�}ttfD]9}|j|j	d|d��|jd���;y)Nrr�rs----abc)r5r�r�r0�rjustrs   r�
test_rjustzBaseBytesTest.test_rjust_r
rc�*�|jt|jd�jdd�|jt|jd�jdd�|jt|jd�j
dd�y)Nrr�r�)rbr�r5rrrr%s r�test_xjust_int_errorz"BaseBytesTest.test_xjust_int_errorfsk�����)�T�^�^�F�%;�%B�%B�A�r�J����)�T�^�^�F�%;�%A�%A�1�b�I����)�T�^�^�F�%;�%A�%A�1�b�Irc��|jd�}|jtt|��D�cgc]}t	|||dz���c}gd��ycc}w)NsA��rK)r�A�ror�)r5r0rxrar�)r!r8rms   r�test_ordzBaseBytesTest.test_ordksL���N�N�-�.������s�1�v��?��A�#�a��!�A�#�h�-��?�/�	1��?s�Ac�l�d}|j|jjdd�|�d}|j|jjdd�|�|jt|jjdd�|jt
|jjdd�y)	Ns	

 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`xyzdefghijklmnopqrstuvwxyz{|}~�����������������������������������������������������������������������������������������������������������������������������r�xyzs	

 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~��������������������������������������������������������������������������������������������������������������������������xyzs���sxyzqr�r)r0r5�	maketransrbr�r�)r!�
transtables  r�test_maketranszBaseBytesTest.test_maketransps���~�
�������1�1�&�&�A�:�N�u�
�������1�1�/�6�J�J�W����*�d�n�n�&>�&>���P����)�T�^�^�%=�%=�u�e�Lrc�H�|jd�}|jd�}|jd�}|jd�}|jd�}|jd|j|d��|jd|j|dd��|jd|j|dd��|jd	|j|dd��|jd|j|d��|jd|j|dd��|jd|j|dd��|jd	|j|dd��|jd|j	|d��|jd|j	|dd��|jd|j	|dd��|jd	|j	|dd��|jd|j|d��|jd|j|dd��|jd|j|dd��|jd	|j|dd��|jd|j
|d��|jd
|j
|dd��|jd
|j
|dd��|jd	|j
|dd��|jd|j|d��|jd|j|dd��|jd|j|dd��|jd|j|dd��|jd|j|d��|jd|j|dd��|jd|j|dd��|jd|j|dd��y)
Nr��lr�r)r�r_rtrZrrKTF)	r5r0r�r�r�r�r�r�r�)r!r8�l�hr*�os      r�test_none_argumentsz!BaseBytesTest.test_none_argumentsxse���N�N�8�$���N�N�4� ���N�N�4� ���N�N�4� ���N�N�4� ������A�F�F�1�d�O�,�����A�F�F�1�b�$�/�0�����A�F�F�1�d�B�/�0�����A�F�F�1�d�D�1�2�����A�G�G�A�t�,�-�����A�G�G�A�r�4�0�1�����A�G�G�A�t�R�0�1�����A�G�G�A�t�T�2�3�����A�G�G�A�t�,�-�����A�G�G�A�r�4�0�1�����A�G�G�A�t�R�0�1�����A�G�G�A�t�T�2�3�����A�H�H�Q��-�.�����A�H�H�Q��D�1�2�����A�H�H�Q��b�1�2�����A�H�H�Q��d�3�4�����A�G�G�A�t�,�-�����A�G�G�A�r�4�0�1�����A�G�G�A�t�R�0�1�����A�G�G�A�t�T�2�3�����q�z�z�!�T�2�3�����q�z�z�!�R��6�7�����q�z�z�!�T�2�6�7������
�
�1�d�D� 9�:�����q�|�|�A�t�4�5�����q�|�|�A�r�4�8�9�����q�|�|�A�t�R�8�9��������Q��d� ;�<rc�,�|jd�}|j|j|j|j|j
fD]G}|j
t|d�|j
t|d�|j
t|d��Iy)Nr�rWrfi')r5r�r�r�r�r�rbr�)r!r8�methods   r�(test_integer_arguments_out_of_byte_rangez6BaseBytesTest.test_integer_arguments_out_of_byte_range�sp���N�N�8�$���w�w����������!�(�(�C�F����j�&�"�5����j�&�#�6����j�&�$�7�Drc	�N�|jd�}|jd�}|jtd|j|ddd�|jtd|j|ddd�|jtd|j
|ddd�|jtd|j|ddd�|jtd|j|ddd�|jtd|j|ddd�|jtd	|j|ddd�y)
Nr�r)z\bfind\bz	\brfind\bz	\bindex\bz
\brindex\bz	\bcount\bz\bstartswith\bz\bendswith\b)
r5r�r�r�r�r�r�r�r�r�)r!r8r*s   r�*test_find_etc_raise_correct_error_messagesz8BaseBytesTest.test_find_etc_raise_correct_error_messages�s���N�N�8�$���N�N�4� �����y�+�q�v�v� !�4��t�	5����y�,���� !�4��t�	5����y�,���� !�4��t�	5����y�-���� !�4��t�	5����y�,���� !�4��t�	5����y�*;�Q�\�\� !�4��t�	5����y�/�1�:�:� !�4��t�	5rc��tjj|t|j�tjj|t
|j�yr)�test�support�check_free_after_iteratingr|r5r�r%s r�test_free_after_iteratingz'BaseBytesTest.test_free_after_iterating�s6�����/�/��d�D�N�N�K����/�/��h����Orc	���|jd�}ttd��}td�|td�<|j	t
|j�|j	t
|jdd�|j	t|jttd���|j
|d�}|j|d�|j||j�|j
|�}|j
|d�}|j||�|j|d�|j
|d�}|j|d	�|j
dd
�}|j|d�|j
|d��}|j|d�|j
|d��}|j|d	�|j
dd
��}|j|d�y)
Nr�rf�er r�rshellershee�eshllo)�delete)r5r�rxr�rbr��	translater�r�r0�assertIsInstance)r!r8�rosettar&r�s     r�test_translatezBaseBytesTest.test_translate�s����N�N�8�$���E�#�J�'����H���C������)�Q�[�[�1����)�Q�[�[�$��=����*�a�k�k�5��s��3D�E�
�K�K���*������H�%����a����0�
�K�K�� ��
�K�K���%������A������H�%�
�K�K���&������F�#�
�K�K��d�#������G�$�
�K�K���K�,������H�%�
�K�K���K�-������F�#�
�K�K��T�K�*������G�$rc��tjd�}|jd�}|jt�5|j|d�ddd�|jt�5|j|d�ddd�|j
|j|d�d�y#1swY�\xYw#1swY�8xYw)N�	_testcapi)rgrZrKrrg)r�
import_moduler5rbrc�sequence_getitemr0)r!r5�objs   r�test_sq_itemzBaseBytesTest.test_sq_item�s���!�/�/��<�	��n�n�U�#��
�
�
�z�
*��&�&�s�B�/�+�
�
�
�z�
*��&�&�s�A�.�+�����3�3�C��;�R�@�	+�
*��
*�
*�s�B*�,B6�*B3�6B?N)Lr(r)r*r3r9rBrdr}r�r�r�r�r�r�r�r�rr�r�r�rr�r�r�r�rr	rrrr'r+rArOrUrfrmryr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrr	rrrrrr!r$r&r+r3r9rrrr,r,/s���+�6�
/�
;�-�8-�-�0�"H�B�J�M�&
A�����L�#�.�:��:�(�1�(	]�B�M�6,�p7�9�!�S�+�0#E�JF�#s�J9�B� 7�<.�.$�$��2/�&8�(9�&!!�F/�"M�
?�
N�I�H�;�<�H�
I�M�L�'�5�$R�
J�
J�
9�9�9�J�
1�
M�)=�V8�5�&P�%�>Arr,c�:�eZdZeZd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zy)	�	BytesTestc��d}|j|j�|�|jt|j��|j�Gd�dt�}|d�}|j|j�|�|jt|j��|j�y)Nsfoobarc��eZdZy)�/BytesTest.test__bytes__.<locals>.bytes_subclassNr�rrr�bytes_subclassr>�r�rr?sbarfoo)r0�	__bytes__r/r5r�)r!�foor?�bars    r�
test__bytes__zBytesTest.test__bytes__�s������������#�.�����c�m�m�o�.����?�	�U�	��]�+���������#�.�����c�m�m�o�.����?rc�l�d}d}|jt|�5|dddd�y#1swYyxYw)N�pythonz'byte indices must be integers or slicesr@)r�r��r!r8�msgs   r�test_getitem_errorzBytesTest.test_getitem_error�s/����7��
�
#�
#�I�s�
3�
�c�F�4�
3�
3�s�*�3c���tjttj�}t|dd��5}|j	t
|jd�ddd�y#1swYyxYw)N�rbr)�	bufferingr)�os�open�__file__�O_RDONLYrbr��readinto)r!�fdr@s   r�test_buffer_is_readonlyz!BytesTest.test_buffer_is_readonlysF��
�W�W�X�r�{�{�
+��
�"�d�a�
(�A����i����S�9�)�
(�
(�s�"A"�"A+c	��|jttd��d�|jttd��td��|jtt	d��d�|jtt	d��td��Gd�d�}|jtt|��|jttt	d��|jttt	d��Gd�d�}|jt|��d�Gd�d	t�}|jt|d��d�|jt|d�d
�d�|jt|td���d�|jt|d��td��|jt|d�d
�td��|jt|td���td��|jt|td���td��|jtt	td���td��|jtt	td���td��|jtt	td���td��Gd�d
t�}|jt|d��d�|jt|d��td��|jt|td���td��|jt|td���td��|jt|td���td��y)Nrc��eZdZy)�&BytesTest.test_custom.<locals>.NoBytesNr�rrr�NoBytesrUs�rrVr�c��eZdZd�Zd�Zy)�-BytesTest.test_custom.<locals>.IndexWithBytesc��y)Nr7rr%s rr@z7BytesTest.test_custom.<locals>.IndexWithBytes.__bytes__s��rc��yr�rr%s rr&z7BytesTest.test_custom.<locals>.IndexWithBytes.__index__s��rN)r(r)r*r@r&rrr�IndexWithBytesrXs��
�
rr[r7c��eZdZd�Zd�Zy)�+BytesTest.test_custom.<locals>.StrWithBytesc�@�tj|d�}||_|S)Nu€)r��__new__r��clsrr!s   rr_z3BytesTest.test_custom.<locals>.StrWithBytes.__new__s���{�{�3��1��"��
��rc��|jSrrr%s rr@z5BytesTest.test_custom.<locals>.StrWithBytes.__bytes__����z�z�!rN�r(r)r*r_r@rrr�StrWithBytesr]���
�
"rrez
iso8859-15��c��eZdZd�Zd�Zy)�-BytesTest.test_custom.<locals>.BytesWithBytesc�@�tj|d�}||_|S)Nrg)r�r_rr`s   rr_z5BytesTest.test_custom.<locals>.BytesWithBytes.__new__0s���}�}�S�'�2��"��
��rc��|jSrrr%s rr@z7BytesTest.test_custom.<locals>.BytesWithBytes.__bytes__4rcrNrdrrr�BytesWithBytesri/rfrrl)	r0r��
BytesSubclass�OtherBytesSubclass�	WithBytesrbr�r�r3)r!rVr[rerls     r�test_customzBytesTest.test_customs������}�V�4�5�v�>�����'9�&�'A�B�&�v�.�	0�����y��0�1�6�:�����y��'8�9�=��;P�Q������)�U�G�I�6����)�U�I�e�,<�=����)�U�I�d�O�<�	�	�
	
����~�/�0�$�7�	"�3�	"�	
����|�F�3�4�f�=�����|�F�3�\�B�G�L�����|�M�&�,A�B�C�V�L�����|�F�';�<�m�F�>S�T�����|�F�';�\�J�&�w�/�	1�����|�M�&�4I�'J�K�&�v�.�	0�����|�4F�v�4N�'O�P�&�v�.�	0�	
���e�I�m�F�.C�$D�E�}�U[�G\�]����m�I�m�F�6K�,L�M�+�F�3�	5����m�I�6H��6P�,Q�R�+�F�3�	5�	"�U�	"�	
���e�N�6�$:�;�V�D����m�N�6�,B�C�+�F�3�	5����e�N�=��3H�$I�J�+�F�3�	5����m�N�=��;P�,Q�R�+�F�3�	5����m�N�;M�f�;U�,V�W�+�F�3�	5rc�R	��tjd�}tjd�}ddlm}m}ddlm}m}m}m}m	}	m
}
m}|j}|f|_
||_|j|d�d�|j|dd�d	�|j|d
|d��d�|j|d
|t!d���d
�|j|d
|d��d�|j|d|d�|d�|	d��d�|j|d|d�|d�|	d��d�|j|d|d�|d�|	d��d�|j|d|d��d�|j|d|d ��d!�|j|d"|d#��d$�|j#|�}
t$j&d%k(rd&j)d|
z���fd'�}nd(�}d)}|j|d*||��d+||�zj+d,��|j|d-|d.��d/�|	d�j,}d0||j.t0fd0||j2t0fd1||j4t0fd1||j6t0fd2||j8t0fd3|
|j:t0fd3|
|j<t0fd4|	|t0fd5|||ff	D]<\}}}}|j||||��||�j+d,��f�>|j|d6d7�d7�|j|d8d9�d:�|j|d;�d<�|j|d=�d>�|j|d?|t!d@���dA�|j|dB�dC�|j|d<�d<�|j|dD|d�|d��dE�|j?t@|dF|d��|j?t@|dF|dG��|j|dH�dH�|j|dCdH�dH�y)IN�ctypesr5r)�	pythonapi�	py_object)�c_int�c_uint�c_long�c_ulong�c_size_t�	c_ssize_t�c_char_psformats
Hello %s !r�s
Hello world !sc=%csc=�@sc=@r�sc=�sd=%d ld=%ld zd=%zdrKr_rts
d=1 ld=2 zd=3rWrZr�sd=-1 ld=-2 zd=-3su=%u lu=%lu zu=%zur�i�isu=123 lu=456 zu=789si=%isi=123i����si=-123sx=%xi�
sx=abc�ntz0x%0{}Xc����|zSrr)�ptr�
ptr_formats �r�
ptr_formatterz1BytesTest.test_from_format.<locals>.ptr_formatterts���"�S�(�)rc��d|zS)Nz%#xr)rs rr�z1BytesTest.test_from_format.<locals>.ptr_formatterxs���s�{�"ri�ͫsptr=%pzptr=r�ss=%sscstrss=cstrs%ds%lds%lus%zds%zus%ps%5sr7s%.3srrs%%�%s[%%]s[%]s%%%crus%_s%%ss%ssx=%i y=%sx=2 y=%r�rfr)!rr6rrrsrtrurvrwrxryrzr{�PyBytes_FromFormat�argtypes�restyper0r��sizeofrL�name�formatrr�INT_MINr��INT_MAX�LONG_MIN�LONG_MAX�	ULONG_MAX�PY_SSIZE_T_MIN�PY_SSIZE_T_MAXrbr�)r!rrr5rsrtrurvrwrxryrzr{r��
sizeof_ptrr�r�size_max�	formatstr�ctypes_typer�py_formatterr�s                     @r�test_from_formatzBytesTest.test_from_formatAs�����,�,�X�6��!�/�/��<�	�/�	�	�	�'�9�9��'/�k��#�%.��"�	
���+�I�6�"�	$����+�M�8�D�)�	+�	
���+�G�U�1�X�>� �	"����+�G�U�3�s�8�_�E��	!����+�G�U�3�Z�@�"�	$����+�,A�,1�!�H�f�Q�i�,4�Q�K�9�*�	+�	
���+�,A�,1�"�I�v�b�z�,4�R�L�:�-�	.�	
���+�,A�,2�3�K����,4�S�M�;�0�	1�	
���+�G�U�3�Z�@�!�	#����+�G�U�4�[�A�"�	$����+�G�U�5�\�B�!�	#��]�]�8�,�
�
�7�7�d�?�"�)�)�!�j�.�9�J�
*�
#������+�I�x��}�E� �=��#5�5�=�=�g�F�	H����+�G�X�g�5F�G�"�	$��B�<�%�%��
�E�9�,�,�c�2�
�E�9�,�,�c�2�
�V�Y�/�/��5�
�V�Y�/�/��5�
�W�i�1�1�3�7�
�Y�	� 8� 8�#�>�
�Y�	� 8� 8�#�>�
�X�x��-�
�H�h�
�6�
<
�7�I�{�E�<�
���/�	�;�u�;M�N�)�%�0�7�7��@�
B�
C�
<
�	
���+�F�D�9��	����+�G�Y�?��	!�	
���+�E�2��	����+�G�4��	!����+�G�U�3�s�8�_�E��	 ����+�F�3��	 �	
���+�D�1�4�8����+�K��q��5��8�L�#�	%�
	
���-�,�e�U�2�Y�	@����-�,�e�U�3�Z�	A�	
���+�C�0��	����+�E�3�7��	rc�~�Gd�dt�}gd�}|jt|�d�|jtt||��Gd�dt
�}|jtd�d�|jtt|d��Gd	�d
t�}|jtd�d�|jtt|d��Gd�d
t�}t
d�|d�}}|jt|�d�|jtt|�y)Nc��eZdZdZy)�7BytesTest.test_bytes_blocking.<locals>.IterationBlockedN�r(r)r*r@rrr�IterationBlockedr������Irr�)rrKr_rtsc��eZdZdZy)�1BytesTest.test_bytes_blocking.<locals>.IntBlockedNr�rrr�
IntBlockedr��r�rr�rtsc��eZdZdZy)�;BytesTest.test_bytes_blocking.<locals>.BytesSubclassBlockedNr�rrr�BytesSubclassBlockedr��r�rr�r:c��eZdZdZy)�4BytesTest.test_bytes_blocking.<locals>.BufferBlockedNr�rrr�
BufferBlockedr��r�rr�)ryr0r�rbr�r>r�)r!r�rmr�r�r��ba�bbs        r�test_bytes_blockingzBytesTest.test_bytes_blocking�s���	�t�	�������q��#6�7����)�U�,<�Q�,?�@�
	��	�����q��9�-����)�U�J�q�M�:�	�5�	�����u��u�-����)�U�,@��,G�H�	�I�	��5�!�=��#7�B������r��E�*����)�U�B�/rc��d}d}|jt|�t|��|jt|�t|��|jt|�t|dz��|jt|�t|dz��|jt|�t|dz��|jt|�td|z��|jt|�t|dz��Gd�dt�}|d	�}|jt|�t|��|jt|�t|dz��|jt|�t|dz��|jt|�t|dz��|jt|�td|z��|jt|�t|dz��y)
Ns123abc1@s456zyx-+r_rrKr_c��eZdZy)�5BytesTest.test_repeat_id_preserving.<locals>.SubBytesNr�rrr�SubBytesr��r�rr�sqwerty())r0�id�assertNotEqualr�)r!r@r8r�r�s     r�test_repeat_id_preservingz#BytesTest.test_repeat_id_preserving�s�����������A���1��&����B�q�E�2�a�5�)����B�q�E�2�a�"�f�:�.����B�q�E�2�a�!�e�9�-�����A���1�q�5�	�*�����A���1�q�5�	�*����B�q�E�2�a�!�e�9�-�	�u�	�
�[�!������A���1��&����B�q�E�2�a�"�f�:�.����B�q�E�2�a�!�e�9�-����B�q�E�2�a�!�e�9�-����B�q�E�2�a�!�e�9�-����B�q�E�2�a�!�e�9�-rN)r(r)r*r�r5rCrHrRrpr�r�r�rrrr;r;�s.���I�
@��:�
95�xp�d0�<.rr;c�x�eZdZeZejd�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�Zd�Z d�Z!d�Z"d�Z#d�Z$d�Z%e&jNjPd ��Z)d!�Z*e&jVjXjZZ-d"�Z.d#�Z/d$�Z0y%)&�
ByteArrayTestr5c�~�td�}d}|jt|�5|dddd�y#1swYyxYw)NrE�,bytearray indices must be integers or slicesr@�r�r�r�rFs   rrHz ByteArrayTest.test_getitem_error�s4���i� ��<��
�
#�
#�I�s�
3�
�c�F�4�
3�
3���3�<c�~�td�}d}|jt|�5d|d<ddd�y#1swYyxYw)NrEr��pythonr@r�rFs   r�test_setitem_errorz ByteArrayTest.test_setitem_error�s6���i� ��<��
�
#�
#�I�s�
3��A�c�F�4�
3�
3�r�c�J�|jttt��yr)rbr��hashr�r%s r�test_nohashzByteArrayTest.test_nohash�s�����)�T�9�;�7rc�:�d}|ddt|�z
zz}tj�}	t|d�5}|j	|�ddd�t|d�5}td�}|j
|�}ddd�|jt|��|jt�t|��t|d�5}|j	|�ddd�t|d�5}|j|j�|�ddd�	tj|�y#1swY��xYw#1swY��xYw#1swY�mxYw#1swY�DxYw#t$rYywxYw#	tj|�w#t$rYwwxYwxYw)NsHello world
r���wbrJ)
ra�tempfile�mktemprM�writer�rPr0ry�readrL�remove�OSError)r!�short_sampler�tfnr@r8�ns       r�test_bytearray_apiz ByteArrayTest.test_bytearray_api�sH��'����r�C��,=�'=� >�>���o�o���	��c�4��A�����%�!��c�4��A��b�M���J�J�q�M��!�
���Q��L� 1�2����T�!�W�d�6�l�3��c�4��A�����
�!��c�4��A�� � �����6�2�!�
��	�	�#��!!���!���!��� ����
��
��
��	�	�#����
��
�s��E3�D4�
E3�E�;AE3�E� E3�4!E�E3�E$�4D=�9E3�E	�E3�E�E3�E!�E3�$	E0�/E0�3F�5F�
F�	F�F�F�Fc�.�td�}|j|j�d�|j|d�td�}|j�|j|d�t�}|j�|j|�y)Nr�sollehshello1s1olleh)r�r0r�r�r7s  r�test_reversezByteArrayTest.test_reversess���h����������d�+�����H�%��i� ��	�	�	������I�&��K��	�	�	������rc�z�td�}|j�|j|d�td�}|j�|j|d�td�}|jt	d��|j�|jt	d��|j|d�y)NrEr�rr�r�)r�r�r0r�r�r7s  r�
test_clearzByteArrayTest.test_clear!s����i� ��	���	�����C� ��c�N��	���	�����C� ��c�N��	����S���	���	�	����S�������D�!rc��td�}|j�}|j|d�td�}|j�}|j|d�td�}|j�}|j||�|j||�|j	td��|j|d�|j|d�y)Nrrr�r<)r�r=r0�assertIsNotr�r�)r!r8r�s   rrBzByteArrayTest.test_copy0s����f���
�V�V�X������V�$��c�N��
�V�V�X������S�!�
�f���
�V�V�X������B������B��
�	�	�#�c�(������W�%�����F�#rc��d�}|d�}|jtjd|�|d�|d�g�y)Nc�4�ttt|��Sr)r�r�r�)r�s rr�z&ByteArrayTest.test_regexps.<locals>.byCs���S��a�[�)�)rr�s\w+r�r�)r0�re�findallr�s   r�test_regexpszByteArrayTest.test_regexpsBs9��	*��~���������G�Q�/�"�W�+�r�'�{�1K�Lrc����d�}�fd�}�fd�}�jd�5||�ddd��jd�5||�ddd�y#1swY�,xYw#1swYyxYw)Nc��|||<yrr)r8rm�vals   r�setitem_as_mappingz6ByteArrayTest.test_setitem.<locals>.setitem_as_mappingIs���A�a�Drc�@���jj|||�yr)r5�sequence_setitem)r8rmr�r!s   �r�setitem_as_sequencez7ByteArrayTest.test_setitem.<locals>.setitem_as_sequenceLs����N�N�+�+�A�q�#�6rc����tgd��}||dd��j|tgd���||dd��j|tgd���||dtd	���j|tgd
���	||dd��jd�	||d
d��jd�	||dd��jd�	||dtd���jd�	||dt
���jd�y#t$rY��wxYw#t$rY��wxYw#t
$rY�swxYw#t
$rY�]wxYw#t$rYywxYw)NrsrKrT)rKrTrtrWr-)rKrTr-rrS)rSrTr-rtzDidn't raise IndexErrori����rfzDidn't raise ValueErrorzDidn't raise TypeError)r�r0r�failrcr�r�r�)�setitemr8r!s  �r�do_testsz,ByteArrayTest.test_setitem.<locals>.do_testsOsp����)�$�A��A�q�#�����Q�	�+� 6�7��A�r�3�����Q�	�-� 8�9��A�q�)�B�-�(����Q�	�.� 9�:�
���1�a� ��	�	�3�4�
���3��"��	�	�3�4�
���1�c�"��	�	�3�4�
���1�i��m�,��	�	�3�4�
���1�f�h�'��	�	�2�3��'�
��
��
�
��
��
�
��
��
�
��
��
�
��
�sZ�D+�*D:�E	�"$E�#E'�+	D7�6D7�:	E�E�		E�E�	E$�#E$�'	E3�2E3�
tp_as_mapping�tp_as_sequence��subTest)r!r�r�r�s`   r�test_setitemzByteArrayTest.test_setitemHsa���	�	7� 	�D�\�\�/�
*��'�(�+��\�\�*�
+��(�)�,�
+�+�
*��,�
+���	A�	A �A� A)c����d�}�fd�}�fd�}�jd�5||�ddd��jd�5||�ddd�y#1swY�,xYw#1swYyxYw)Nc�
�||=yrr)r8rms  r�del_as_mappingz2ByteArrayTest.test_delitem.<locals>.del_as_mappingxs	���!�rc�>���jj||�yr)r5�sequence_delitem)r8rmr!s  �r�del_as_sequencez3ByteArrayTest.test_delitem.<locals>.del_as_sequence{s����N�N�+�+�A�q�1rc	�2��ttd��}||d��j|ttdd���||d��j|ttdd���||d��j|tgd���y)NrSrrKrWr�r�)rKr_rtr�rtr�rc)r�rxr0)r/r8r!s  �rr�z,ByteArrayTest.test_delitem.<locals>.do_tests~sx����%��)�$�A��1�a�L����Q�	�%��2�,� 7�8��1�b�M����Q�	�%��1�+� 6�7��1�a�L����Q�	�*?� @�Arr�r�r�)r!r�r�r�s`   r�test_delitemzByteArrayTest.test_delitemws_���	�	2�	B��\�\�/�
*��^�$�+��\�\�*�
+��_�%�,�
+�+�
*��,�
+�r�c	�t�ttd��}|jt|�ttd���tgd��|dd|j|tgd���|dd�=|j|tgd���tgd��|dd|j|ttd���td	d
g�|dd|j|tgd
���gd�|dd|j|ttd���gd�|dd|j|tgd���d|dd|j|tgd���t	d�|dd|j|tgd���g|dd|j|tgd���dddtd�ddddgddgggf	D]%}|j
t�5||ddddd��'gd�dd gfD]%}|j
t�5||ddddd��'y#1swY�bxYw#1swY�>xYw)!NrS)rKrKrKrKrKrr�)
rKrKrKrKrKr�rtr�rcr�r�)r�rtr�rcr�)rrKr_rtr�rT�er�r�)rrKr_rTr�r�rcr�)rtr�r�rtrt)rgrgrg)
rrKr_rgrgrgrtr�r�rtr�rcr�r�)rrKr_�f�or�)r�r�r�r�r�r�r�)r�r�r�r�r�gP����KDr�gffffff@r@r8r7r8)r�r�rfi���i(#)	r�rxr0ryrTr>rbr�r�)r!r8�elems   r�
test_setslicezByteArrayTest.test_setslice�s	���e�B�i� ������a��$�u�R�y�/�2��?�+��!�A������I�&D�E�F�
�a��d�G�����I�o�6�7��?�+��!�A������I�e�B�i�0�1��c�3�Z�(��"�R������I�&B�C�D���!�A������I�e�B�i�0�1���!�A������I�&P�Q�R���!�"������I�&>�?�@��6�"��"�1������I�&D�E�F���!�A������I�&?�@�A���A�s�5�z�5�#��3�Z�$����t�5�D��"�"�9�-���!�A��.�-�5�
%�t�T�l�3�D��"�"�:�.���!�A��/�.�4�.�-��/�.�s�!H"�H.�"H+	�.H7	c	�~�ttd��}|jt|�ttd���|dd�=|jt|�ttdd���|j	tdd��|jt|�ttdd���y)NrTrS�n)r�rxr0ry�extendr7s  r�test_setslice_extendz"ByteArrayTest.test_setslice_extend�s����e�C�j�!������a��$�u�S�z�"2�3�
�c�r�c�F�����a��$�u�R��~�"6�7�	����s�C��!�����a��$�u�R��~�"6�7rc�b�td�}|j�|dd�=|td�z
}~y)NrSrKr_)r��popr�r7s  r�test_fifo_overrunzByteArrayTest.test_fifo_overrun�s1��
�b�M��	����
�b�q�b�E�	�U�1�X�
��
rc��td�}tj|�}|dd�=|jtj|�|�y)NrSrK)r�rN�	getsizeof�assertLessEqual)r!r8r�s   r�test_del_expandzByteArrayTest.test_del_expand�s=���b�M���}�}�Q���
�b�q�b�E����S�]�]�1�-�t�4rc��ddddddddztjddd	d
f}|D]�}|D]�}|ddD]�}ttd��}t	|�}||||�}|j�|||||�<|||||�<|j
|t	|��||||�=||||�=|j
|t	|��������y)NrrKrtr�r/iMrWrZr�i���r�)rNrOryrxr�r�r0)r!r�r�r�r�r�r8rLs        r�test_extended_set_del_slicez)ByteArrayTest.test_extended_set_del_slice�s����d�A�q�"�c�1�c�6�3�;�;���C�����E���#�A�B�K�D��U�3�Z�(�A�!�!��A��U�4��_�-�D��L�L�N�)-�A�e�D��o�&�)-�A�e�D��o�&��$�$�Q�	�!��5��%��T�/�*��%��T�/�*��$�$�Q�	�!��5�(� �rc��ttd��}||dd|j|tttd��ttd��z��y)Nrfrc)r�rxr0ryr7s  r�test_setslice_trapz ByteArrayTest.test_setslice_trap�sH��
�e�C�j�!����!�"������I�d�5��8�n�t�E�#�J�7G�&G�H�Irc��td�}|}|dz
}|j|d�|j||�|j||�|dz
}|j|d�	|dz
}|jd�y#t$rYywxYw)Nrrrrs	abcdefxyzrz'bytes += unicode didn't raise TypeError)r�r0r.r�r��r!r8r�s   r�test_iconcatzByteArrayTest.test_iconcat�s����f���
��	�V�������I�&�����B���
�
�a���	�V�������L�)�	A�
��G�A�
�I�I�?�@���	��	�s�!A8�8	B�Bc��td�}|}|dz}|j|d�|j||�|j||�y)Nrrtr!�r�r0r.rs   r�test_irepeatzByteArrayTest.test_irepeat�sH���f���
��	�Q�������L�)�����B���
�
�a��rc��td�}|}|dz}|j|d�|j||�|j||�y)Nr)rTsdxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrrs   r�test_irepeat_1charz ByteArrayTest.test_irepeat_1charsG���d�O��
��	�S�������H�%�����B���
�
�a��rc��t�}|j�}|j|d�|g}td�D]H}|dz
}|j�}|j	|t|��||vs�8|j
|��Jy)NrrTr))r��	__alloc__�assertGreaterEqualrx�
assertGreaterrar�)r!r8�allocr�rms     r�
test_alloczByteArrayTest.test_alloc
su���K�����
������q�)��g���s��A�
��I�A��K�K�M�E����u�c�!�f�-��C���
�
�5�!�rc	�<���t����fd�}�j|���jt��tt	dd����jt��d��j
�}�j|t���y)Nc3��K�tdd�D]�}|��t��}�j|ttdt|�dz����jt��t|���j	t��|��j�}�j
|t�����y�w)NrKrT)rxryr0rar�rr)rmr@rr8r!s   ��r�gz(ByteArrayTest.test_init_alloc.<locals>.gs�������1�c�]������G��� � ��D��q�#�a�&��(�);�$<�=�� � ��Q���Q��0��$�$�S��V�Q�/����
���"�"�5�#�a�&�1�#�s�B=CrKrT�c)r�r"r0ryrxrarr)r!rrr8s`  @r�test_init_alloczByteArrayTest.test_init_allocsp����K��	2�	
�
�
�1�3������a��$�u�Q��}�"5�6�����Q���$����
�����5�#�a�&�)rc	�R�d}t|�}|j|�|j|||z�|j|dd|�td�}|jtt|dz��|jd�|dzD��|j||dz�|j|dd|�td�}|jttt|dz���|j||dz�|j|dd|�td�}|jt
tt|dz���|j||dz�|j|dd|�td�}|jt|jgd��|jt|jgd	��|jt|�d
�td�}|jttd��g�|j|d�y)
Nr�r�r�c3�2K�|]}t|����y�wr)r>rps  rrnz,ByteArrayTest.test_extend.<locals>.<genexpr>0s����+��A��Q���s��2r�)rrKr_rf)rrKr_rWrr@r7)r�r�r0r�r>r|ryrbr�rarr�)r!r�r@s   r�test_extendzByteArrayTest.test_extend's������d�O��	���������D�4�K�(�����1�2���%��c�N��	����S�$��)�$�%�	���+����+�+�����D�2�I�&�����2�3���&��c�N��	����c�#�t�b�y�)�*�+�����D�2�I�&�����2�3���&��c�N��	����c�#�t�b�y�)�*�+�����D�2�I�&�����2�3���&��c�N�����*�a�h�h��?����*�a�h�h�
�>�����Q���#��c�N��	���)�C��H�%�&�'�����D�!rc�\��td���jtd��|j�d��jtd��|j�d�|j	t
�fd��|j	t
�fd��|j	t�fd���jtd���jtd	��|j�d
�|j	t�fd���jttd���|j�d
�tgd��}|jd�|j|tgd���|jd�|j|tddg��y)Nr�rshelosheoc�8���jtd��S)Nr)r�r�rFs�rrGz+ByteArrayTest.test_remove.<locals>.<lambda>Is���a�h�h�s�3�x�.@rc�&���jd�S)Ni��r�rFs�rrGz+ByteArrayTest.test_remove.<locals>.<lambda>Js
���a�h�h�s�mrc�&���jd�S)Nr-rrFs�rrGz+ByteArrayTest.test_remove.<locals>.<lambda>Ks
���Q�X�X�c�]rr rr.c�&���jd�S)Nr.rrFs�rrGz+ByteArrayTest.test_remove.<locals>.<lambda>P�
���Q�X�X�d�^rr-r)�~rro�r)r"ror#r#r"ro)	r�r�r�r0rbr�r�rr�r%s  @r�test_removezByteArrayTest.test_removeCs7����h���	����S�������G�$�	����S�������F�#����*�&@�A����*�&;�<����)�%:�;�	����S���	����S�������D�!����)�%;�<�	����3�s�8�$�%�����C� �
�*�+��	����
�����E�/�2�3�	����
�����E�3��*�-�.rc����td��|j�j�td��|j�jd�td��|j�jd�td��|j	t
�fd��|j	t
d��|jtd	�j�d
�y)Nr�r�rr�rZr�c�&���jd�S)NrS)r�rFs�rrGz(ByteArrayTest.test_pop.<locals>.<lambda>`s
���a�e�e�B�irc�2�t�j�Sr)r�r�rrrrGz(ByteArrayTest.test_pop.<locals>.<lambda>as
��i�k�o�o�.?rr[r�)r�r0r�r�rbrcr7s @r�test_popzByteArrayTest.test_pop[s�����h����������#�c�(�+�������q��3�s�8�,�������r��C��H�-����*�&7�8����*�&?�@�����7�+�/�/�1�4�8rc�2�|jtd��y)Nc�2�t�j�Sr)r��sortrrrrGz+ByteArrayTest.test_nosort.<locals>.<lambda>fs��)�+�2B�2B�2Dr)rb�AttributeErrorr%s r�test_nosortzByteArrayTest.test_nosortes�����.�*D�Erc����td���jtd��|j�d�|j�jd�d�t���jtd��|jt	��d�|jt�fd��t���jttd���|j�d�y)	Nshellr r�rT�ArKc�&���jd�S)Nr�)r�rFs�rrGz+ByteArrayTest.test_append.<locals>.<lambda>pr!r�A)r�r�r�r0rarbr�rr7s @r�test_appendzByteArrayTest.test_appendhs�����g���	����S�������H�%�������#���-��K��	����S�������Q���#����)�%;�<��K��	����3�s�8�$�%�����D�!rc����td���jdtd���jdtd���jdtd���jdtd��|j�d�|j	t
�fd��t���jd	t
td
���|j�d�y)NsmsssspprKrmr�rZr�r�c�(���jdd�S)Nr�1)�insertrFs�rrGz+ByteArrayTest.test_insert.<locals>.<lambda>|s���Q�X�X�a��->rrr/r1)r�r6r�r0rbr�rr7s @r�test_insertzByteArrayTest.test_insertus�����j�!��	����C��H��	����C��H��	����S��X��	����s�3�x� �����N�+����)�%>�?��K��	����I�c�#�h�'�(�����D�!rc��td�}|j||jddd��ttd�D�cgc]}|��c}�}td�}|j||j	|��ycc}w)Nrscderrfr)r�r�r�rxr0)r!r8rm�tr*s     r�test_copiedzByteArrayTest.test_copied�sn��
�f�������A�I�I�f�f�a�8�9��%��*�-�*�Q�q�*�-�.���c�N������A�K�K��N�+��.s�	A>c��td�jd�\}}}|j|d�|j|d�|j||�|dz
}|j|d�td�jd�\}}}|j|d�|j|d�td�j	d�\}}}|j|d�|j|d�|j||�|dz
}|j|d�td�j	d�\}}}|j|d�|j|d�y)Nr)�yr�!)r�r�r0r�r�)r!r@r8r&s    r�0test_partition_bytearray_doesnt_share_nullstringz>ByteArrayTest.test_partition_bytearray_doesnt_share_nullstring�s<���D�/�+�+�D�1���1�a�����C� �����C� �����A��	�T�	������C� ��D�/�+�+�D�1���1�a�����C� �����C� ��D�/�,�,�T�2���1�a�����C� �����C� �����A��	�T�	������C� ��D�/�,�,�T�2���1�a�����C� �����C� rc����ttd���t��}�fd�}|d��dd}|jt|d�|j�|�|jt|d�|j�|�|jt|d�|j�|�|jt�jd�|j�|�|jt�j�d�|j�|��fd�}|jt|�|j�|��fd�}|jt|�|j�|�y)	NrSc�6��t|dzd|zdz
��ddy)NrKr_rW)rx)r�r8s �r�resizez3ByteArrayTest.test_resize_forbidden.<locals>.resize�s!����A��E�1�Q�3��7�+�A�a��Gr�r�rrKc����d=yrJrrFs�r�delitemz4ByteArrayTest.test_resize_forbidden.<locals>.delitem�s
����!�rc���d�ddd�<y)NrrKrWr_rrFs�r�delslicez5ByteArrayTest.test_resize_forbidden.<locals>.delslice�s����A�a��1�f�Ir)r�rxrTrb�BufferErrorr0r�r�)r!�vrAr�rDrFr8s      @r�test_resize_forbiddenz#ByteArrayTest.test_resize_forbidden�s1���

�e�B�i� ���q�M��	,��r�
���t�����+�v�r�2�����D�!����+�v�q�1�����D�!����+�v�q�1�����D�!����+�q�u�u�a�0�����D�!����+�q�x�x��1��6�����D�!�	����+�w�/�����D�!�	����+�x�0�����D�!rc��tjd�}|jt|jt��y)Nr5)rr6rbrG�getbuffer_with_null_viewr�)r!r5s  r�test_obsolete_write_lockz&ByteArrayTest.test_obsolete_write_lock�s,��!�/�/��<�	����+�y�'I�'I�9�;�Wrc��td�}td�}ttjdz�D�]}t|�}tj||f|�}tj|�\}}||dd|jt|�t|��|jt|�|�t|�tj||f|�}tj|�\}}||dd|jt|�t|��|jt|�|dd�tdt|��D]
}t|��tj||f|�}tj|�\}}||dd|jt|�t|��|jt|�|t|�d�|jtt|�tj||f|�}tj|�\}}||dd|jt|�g���y)NrsqwertyrK)r�ryrxr�r�r|r�r�r0r/r�rarb�
StopIteration)	r!r�rLr��itorigr�r�r8rms	         r�test_iterator_pickling2z%ByteArrayTest.test_iterator_pickling2�s����� ���I����6�2�2�Q�6�7�E��$�Z�F����f�d�^�U�3�A��L�L��O�E�B���A�a�D����T�"�X�t�F�|�4����T�"�X�t�,�
��L����f�d�^�U�3�A��L�L��O�E�B���A�a�D����T�"�X�t�F�|�4����T�"�X�t�A�B�x�0��1�c�$�i�(���V��)����f�d�^�U�3�A��L�L��O�E�B���A�a�D����T�"�X�t�F�|�4����T�"�X�t�C��I�J�'7�8�
���m�T�6�:����f�d�^�U�3�A��L�L��O�E�B���A�a�D����T�"�X�r�*�?8rc��td�}t|�}t|�|j�|j	t|�g�y)Nr:)r�r|r�r�r0ry)r!r�r�s   r�test_iterator_length_hintz'ByteArrayTest.test_iterator_length_hint�s9��
�u�
��
�"�X���R��
���
�����b��2�&rc��td�}d|dd|dz}|dz}|j|d�|j||�|j|d�y)Nrr)r_rKrtsxcsxcxcxc�r�r0)r!r8r�r�s    r�test_repeat_after_setslicez(ByteArrayTest.test_repeat_after_setslice�sY���f�����"�1��
��U��
��U������U�#�����Q������Y�'rc����G�fd�d�}|jd�5td��|jt�5|��d<ddd�ddd�|jd�5td��|jt�5|jj�d|��ddd�ddd�y#1swY�wxYw#1swY�{xYw#1swY�*xYw#1swYyxYw)Nc���eZdZ�fd�Zy)�/ByteArrayTest.test_mutating_index.<locals>.Boomc�&���j�yrEr�r7s �rr&z9ByteArrayTest.test_mutating_index.<locals>.Boom.__index__s������	�rNr�rFs�r�BoomrXs���
rrZr�sNow you see me...rr�)r�r�rbrcr5r�)r!rZr8s  @r�test_mutating_indexz!ByteArrayTest.test_mutating_index�s����	�	�
�\�\�/�
*��.�/�A��"�"�:�.��v��!��/�+�
�\�\�*�
+��.�/�A��"�"�:�.����/�/��1�d�f�=�/�,�
+�/�.��+�
*��/�.��,�
+�sG�!C
�C�C
�,!C%�
#C�0C%�C
	�C
�
C�C"	�C%�%C.N)1r(r)r*r�r5rr6r5rHr�r�r�r�r�rBr�r�r�r�r�r�r�rrrrr
rrrr$r(r-r2r7r:r>rIr(r)�cpython_onlyrLrP�
list_tests�
CommonTest�test_exhausted_iteratorrRrUr[rrrr�r��s���I�+�
�+�+�K�8�I���8��4	�
"�$�$M�-*�^&�,&�P8��5�6�*J�A� ��
"�*�""�8/�09�F�"�
"�,�!�*"�@
�\�\���X��X�"+�H#�o�o�8�8�P�P��'�(�>rr�c���eZdZed��Zed��Zd�Zejjd��Z
d�Zed��Zd�Z
d�Zd	�Zd
�Zej$ej(j*d�d��Zy
)�AssortedBytesTestc	��ttfD]�}|j|t��d�|j|tdg��d�|j|tgd���d�|j|d�d�|j|d�d	�|j|d
�d���y)N�bytearray(b'')rzbytearray(b'\x00')r�zbytearray(b'\x00\x01\xfe\xff')rzb'abc'�'zb"'"s'"zb'\'"')r��reprr0r�)r!r@s  r�
test_repr_strzAssortedBytesTest.test_repr_strs����d��A����Q�y�{�^�-=�>����Q�y�!��~�.�0E�F����Q�y�)9�:�;�A�
C����Q�v�Y��1����Q�t�W�j�1����Q�v�Y�
�6�rc
�z�dtd�fD]�}|jt|�t|��|jt|d�t|��|j	t
dt
jt|�j�z�5t|d�ddd���y#1swY��xYw)Nrrz\b%s\br�)
r�r0r�r�r�r�r��escaper/r(r7s  r�test_formatzAssortedBytesTest.test_format!s�����6�*�*�A����V�A�Y��A��/����V�A�r�]�C��F�3��'�'�	�(1�B�I�I�d�1�g�>N�>N�4O�(O�Q��q�#��Q�Q�+�Q�Q�s�
B1�1B:	c��|jdtd�k(d�|jdtd�k7d�|jdtd�kd�|jdtd�kd�|jdtd�k\d�|jdtd�kDd�|jdtd�k7d�|jdtd�k(d�|jdtd�kDd�|jdtd�k\d�|jdtd�kd�|jdtd�kd�|jtd�dk(d�|jtd�dk7d�|jtd�dkd�|jtd�dkd�|jtd�dk\d�|jtd�dkDd�|jtd�dk7d�|jtd�dk(d�|jtd�dkDd�|jtd�dk\d�|jtd�dkd�|jtd�dkd�y)NrTr:Fr�r%s r�test_compare_bytes_to_bytearrayz1AssortedBytesTest.test_compare_bytes_to_bytearray*sZ������5��=�0�$�7�����%��-�/��6�����%��-�/��6������v��.��5�����5��<�/��6�����%��,�.��5�����5��=�0�%�8�����%��-�/��7������v��.��6�����%��-�/��7�����%��,�.��6�����5��<�/��7�����v��&�0�$�7�����u���/��6�����u���/��6�����u���.��5�����v��%�/��6�����v���.��5�����v��&�0�%�8�����u���/��7�����u���.��6�����u���/��7�����v���.��6�����v��%�/��7rc�t�|jtj�|jtjj	d�tj�|jt
j�|jt
jj	d�t
j�y)Nz
bytearray(zbytes()�assertIsNotNoner��__doc__r�r�r�r%s r�test_doczAssortedBytesTest.test_docGsn�����Y�.�.�/����	�)�)�4�4�\�B�I�DU�DU�V����U�]�]�+�����
�
�0�0��:�E�M�M�Jrc�|�td�}t|�}t|�}|j|t|��y)NsHello world
����)r�rTr�r0)r!r�bufr8s    r�test_from_bytearrayz%AssortedBytesTest.test_from_bytearrayNs5���7�8���� ���c�N������I�f�-�.rc�~�|jtd�d�|jtd�d�|jtd�d�|jttd��d�|jttd��d�|jttd��d	�y)
Nrzb''r)zb'x'r\zb'\x80'rczbytearray(b'x')zbytearray(b'\x80'))r0r�r�r%s r�test_to_strzAssortedBytesTest.test_to_strTs�������S��5�)�����T��F�+�����W��z�2�����Y�s�^�,�.>�?�����Y�t�_�-�/@�A�����Y�w�/�0�2G�Hrc	���gd�}|D]!\}}|j|t|d���#tdd�D])}|jtt
dt
|�z��+y)N))sWonderful spamzWonderful spam)sWonderful spam toozWonderful spam too)s��uª€)s\xaa\x00\000\200z\xaa\x00\000\200r�rorfzb"%s")r0r�rxrb�SyntaxError�evalrd)r!�testsr8r�r&s     r�test_literalzAssortedBytesTest.test_literal]s^��
���D�A�q����Q�	�!�Y� 7�8���s�C��A����k�4�%��A��.�
0�!rc�\�|jdjtd��ddg�y�Nr�r{r7r8)r0r�rTr%s r�test_split_bytearrayz&AssortedBytesTest.test_split_bytearrayjs$��������j��&6�7�$���Frc�\�|jdjtd��ddg�yr{)r0r�rTr%s r�test_rsplit_bytearrayz'AssortedBytesTest.test_rsplit_bytearrayms$��������z�$�'7�8�4��,�Grc�\�t�}|j|jdd�|�y)Nr)r�r�r�r7s  r�test_return_selfz"AssortedBytesTest.test_return_selfps$���K��������3��,�a�0rz4BytesWarning is needed for this test: use -bb optionc�p�d�}|�5ddk(ddd�|�5ddk(ddd�|�5ddk7ddd�|�5ddk7ddd�|�5td�dk(ddd�|�5dtd�k(ddd�|�5td�dk7ddd�|�5dtd�k7ddd�|�5ddk(ddd�|�5ddk(ddd�|�5ddk7ddd�|�5ddk7ddd�y#1swY��xYw#1swY��xYw#1swY��xYw#1swY��xYw#1swY��xYw#1swY��xYw#1swY��xYw#1swY��xYw#1swY��xYw#1swY��xYw#1swY��xYw#1swYyxYw)Nc�8�tjdtf�Sr
rrrr�
bytes_warningz5AssortedBytesTest.test_compare.<locals>.bytes_warningxs��"�1�1�2�|�2D�E�Errrr�r�r�)r!r�s  rr�zAssortedBytesTest.test_compareus4��	F�
�_��2�I��
�_��#�I��
�_��2�I��
�_��#�I��
�_��c�N�b� ��
�_��)�C�.� ��
�_��c�N�b� ��
�_��)�C�.� ��
�_��Q�J��
�_�
��J��
�_��Q�J��
�_�
��J��_�-�_��
�_��
�_��
�_��
�_��
�_��
�_��
�_��
�_��
�_��
�_��
�_�s��D%�D2�D?�
E�E�=E$�E0�9E<�F�,F�F �F,�%D/�2D<�?E	�E�E!�$E-�0E9�<F�F�F� F)�,F5N)r(r)r*rrfrirkr(r)�requires_docstringsrorrrtryr|r~r��unittest�
skipUnlessrN�flagsr�r�rrrraras���
�7��7�����8�:
�\�\�%�%�K�&�K�/��I��I�0�G�H�1�
�X������0�0�O�Q��Q�rrac��eZdZd�Zd�Zy)�BytearrayPEP3137Testc��t|�Srr�)r!r*s  r�marshalzBytearrayPEP3137Test.marshal�s����|�rc��|jd�}dD]>}t||�}|d�}|j||�|j|||dz��@dD]5}t	|�}|j||�|j|||dz��7|jd�}|j|g�}|j||�|j||�y)Ns1234)�zfillrrrrtz" returned self on a mutable object)zval.split()[0]zval.rsplit()[0]zval.partition(b".")[0]zval.rpartition(b".")[2]zval.splitlines()[0]zval.replace(b"", b"")z! returned val on a mutable objectr)r��getattrr0r�rwr})r!r��methnamer#�newval�expr�seps       r�test_returns_new_copyz*BytearrayPEP3137Test.test_returns_new_copy�s����l�l�7�#��>�H��S�(�+�F��A�Y�F����S�&�)����S�&�$�%I�I�
K�	>�E�D��$�Z�F����S�&�)����S�&� �!D�D�
F�E��l�l�3������3�%�������f�%�����f�%rN)r(r)r*r�r�rrrr�r��s���&rr�c�"��eZdZ�fd�ZdZ�xZS)�FixedStringTestc���t|t�r |j|jd��St�|�|�S)Nr�)�
isinstancer�r5r�super�fixtype)r!r8r6s  �rr�zFixedStringTest.fixtype�s4����c�3���>�>�#�*�*�W�"5�6�6��w��s�#�#rT)r(r)r*r��contains_bytes�
__classcell__)r6s@rr�r��s���$�
�Nrr�c��eZdZeZy)�ByteArrayAsStringTestN)r(r)r*r�r5rrrr�r��s���Irr�c��eZdZeZy)�BytesAsStringTestN)r(r)r*r�r5rrrr�r��s���Irr�c�*�eZdZd�Zd�Zd�Zd�Zd�Zy)�SubclassTestc���|jt|j|j��|j	|j�|j�d\}}|j|�|j|�}}|j||k(�|j||k7�|j||k�|j||k�|j||k\�|j||kD�|j||�|j
||z||z�|j
||z||z�|j
||z||z�|j|dz|dzk(�y)N)r<�efghr�)r��
issubclassr5�basetyper1r�r0)r!r@r8�_a�_bs     r�
test_basiczSubclassTest.test_basic�s2�����
�4�>�>�4�=�=�A�B����d�n�n�.��
�
�>����1�����"�D�N�N�1�$5�B��	
����b��!�����b��!�����R�� �����b��!�����b��!�����R�� �����Q��	
����Q���R��(�����Q���B��'�����Q���Q��'�	
����!��r�!�t��$rc�V�|jd�}|j�j|g�}|j||�|j	t|�|jt|��|jdg�}|j	t|�|j�yr;)r5r�r}r�r.r/)r!�s1�s2�s3s    rr�zSubclassTest.test_join�s~���^�^�G�
$��
�]�]�_�
!�
!�2�$�
'������R� ��
�
�d�2�h��
�
�t�B�x�8��W�W�g�Y�
���
�
�d�2�h��
�
�.rc���|jd�}d|_|jd�|_ttj
dz�D�]%}t	jt	j||��}|jt|�t|��|j||�|j|j|j�|j|j|j�|jt|�t|��|jt|j�t|j��|jt|d����(y)Nr<rSr�rK�y)r5r*�zrxr�r�r�r�r�r�r0r/r��hasattr)r!r@r�r8s    r�test_picklezSubclassTest.test_pickle�s����N�N�7�#������n�n�W�%����6�2�2�Q�6�7�E����V�\�\�!�U�3�4�A�����1��r�!�u�-����Q��"����Q�S�S�!�#�#�&����Q�S�S�!�#�#�&����T�!�W�d�1�g�.����T�!�#�#�Y��Q�S�S�	�2����W�Q��_�-�8rc��|jd�}d|_|jd�|_tjtjfD�]}||�}|jt
|�t
|��|j||�|j|j|j�|j|j|j�|jt|�t|��|jt|j�t|j��|jt|d����y)Nr<rSr�r�)r5r*r�r=r>r�r�r0r/r�r�r?s    rrBzSubclassTest.test_copys����N�N�7�#������n�n�W�%��� �I�I�t�}�}�5�K��A��A�����1��r�!�u�-����Q��"����Q�S�S�!�#�#�&����Q�S�S�!�#�#�&����T�!�W�d�1�g�.����T�!�#�#�Y��Q�S�S�	�2����W�Q��_�-�6rc�n���jjd�}�j|d��jt	|��j�G�fd�d�j
�}|jd�}�j|d��jt	|�|��j|jd�G�fd�d�j
�}|jd�}�j|d��jt	|�|��j|jd�y)NrFrRc���eZdZ�fd�Zy)�%SubclassTest.test_fromhex.<locals>.B1c�N���jj||�}d|_|S�NrB)r�r_rA)rar�mer!s   �rr_z-SubclassTest.test_fromhex.<locals>.B1.__new__s%����]�]�*�*�3��6������	rN)r(r)r*r_r%s�r�B1r�r�rr�rBc���eZdZ�fd�Zy)�%SubclassTest.test_fromhex.<locals>.B2c�x���jtur �jj|g|��i|��d|_yr�)r�r�r"rA)r�r�kwargsr!s   �rr"z.SubclassTest.test_fromhex.<locals>.B2.__init__ s4����=�=��-�*�D�M�M�*�*�2�?��?��?���rN�r(r)r*r"r%s�r�B2r�s���
rr�)r5rJr0r.r/r�rA)r!r8r�r�s`   rrOzSubclassTest.test_fromhexs�����N�N�"�"�8�,������O�,��
�
�d�1�g�t�~�~�.�	����	�
�J�J�x� ������O�,��
�
�d�1�g�r�"��������&�	����	�
�J�J�x� ������O�,��
�
�d�1�g�r�"��������&rN)r(r)r*r�r�r�rBrOrrrr�r��s��%�0/�.�.�'rr�c��eZdZy)�ByteArraySubclassNr�rrrr�r�+���rr�c��eZdZdZy)�ByteArraySubclassWithSlots)r*r��__dict__N)r(r)r*�	__slots__rrrr�r�.s��&�Irr�c��eZdZy)rmNr�rrrrmrm1r�rrmc��eZdZy)rnNr�rrrrnrn4r�rrnc��eZdZd�Zd�Zy)roc��||_yrrr s  rr"zWithBytes.__init__8r#rc��|jSrrr%s rr@zWithBytes.__bytes__:r'rN)r(r)r*r"r@rrrroro7s���rroc��eZdZeZeZd�Zy)�ByteArraySubclassTestc��Gd�dt�}|dd�}|dd��}|j|d�|dd��}|j|d�y)Nc��eZdZdd�Zy)�:ByteArraySubclassTest.test_init_override.<locals>.subclassc�6�tj|g|��i|��yr)r�r")r��newargrr�s    rr"zCByteArraySubclassTest.test_init_override.<locals>.subclass.__init__Cs���"�"�2�7��7��7rN)rKr�rrr�subclassr�Bs��
8rr�r�r<)�source)r�r�rT)r!r�r*s   r�test_init_overridez(ByteArraySubclassTest.test_init_overrideAsT��	8�y�	8�
�Q�� ���Q�w�'������G�$��A�g�.������G�$rN)r(r)r*r�r�r�r5r�rrrr�r�=s���H�!�I�%rr�c��eZdZeZeZy)�ByteArraySubclassWithSlotsTestN)r(r)r*r�r�r�r5rrrr�r�Ks���H�*�Irr�c��eZdZeZeZy)�BytesSubclassTestN)r(r)r*r�r�rmr5rrrr�r�Os���H��Irr��__main__)1rnr�rLr�rNr=rr�r�rr��test.supportr(rr�test.string_tests�test.list_testsrr�test.support.script_helperrr�r�rrr,�TestCaser;r�rar��string_tests�BaseTestr�r�r�r�r�r�r�r�rmrnror�r�r�r(�mainrrr�<module>r�s����
�	�	�
���
�����&�(���9�<��9�9�������yA�yA�xz.�
�x�0�0�z.�zf>�M�8�#4�#4�f>�R@��)�)�@�b&�8�,�,�&�6�d�'�'�0�0���O�X�->�->�����):�):��\'�\'�~	�	�	�'��'�	�E�	�	��	���%�L�(�*;�*;�%�+�\�8�3D�3D�+���h�&7�&7��
�z���H�M�M�O�r

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists