Your IP : 216.73.217.129


Current Path : /opt/alt/python35/lib64/python3.5/test/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/test/__pycache__/test_bytes.cpython-35.pyc



��Yf���@sRdZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z
ddlZ
ddlZ
ddl	m
Z
mZejjr�dd�Zndd�ZGdd�d�ZGd	d
�d
�ZGdd�deej�ZGd
d�deej�ZGdd�dej�ZGdd�dej�ZGdd�de
jj�ZGdd�deej�ZGdd�deej�ZGdd�d�ZGdd�de�Z Gdd�de!�Z"Gdd �d e!�Z#Gd!d"�d"eej�Z$Gd#d$�d$eej�Z%e&d%krNej'�dS)&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)�bigaddrspacetest�MAX_Py_ssize_tcs%tj���fdd��}|S)Nc
s1tjjdtf���||�SWdQRXdS)N�)�test�support�check_warnings�BytesWarning)�args�kw)�func��4/opt/alt/python35/lib64/python3.5/test/test_bytes.py�wrappersz%check_bytes_warnings.<locals>.wrapper)�	functools�wraps)rrr)rr
�check_bytes_warningss!rcCs|S)Nr)rrrr
rsc@s+eZdZddd�Zdd�ZdS)�	IndexablercCs
||_dS)N)�value)�selfrrrr
�__init__$szIndexable.__init__cCs|jS)N)r)rrrr
�	__index__&szIndexable.__index__N)�__name__�
__module__�__qualname__rrrrrr
r#src@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
edd��Zdd�Z
edd��Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Z d9d:�Z!d;d<�Z"d=d>�Z#d?d@�Z$dAdB�Z%dCdD�Z&dEdF�Z'dGdH�Z(dIdJ�Z)dKdL�Z*dMdN�Z+dOdP�Z,dQdR�Z-dSdT�Z.dUdV�Z/dWdX�Z0dYdZ�Z1d[d\�Z2d]d^�Z3d_d`�Z4dadb�Z5dcdd�Z6dedf�Z7dgdh�Z8didj�Z9dkdl�Z:dmS)n�
BaseBytesTestcCs?|j�}|jt|�|j�|j|j|j�dS)N)�	type2test�assertEqual�type�	__class__)r�brrr
�test_basics,szBaseBytesTest.test_basicscCsh|jd�}xRtjtjfD]>}||�}|j||�|jt|�t|��q"WdS)Nsabcd)r�copy�deepcopyrr)r�a�copy_methodrrrr
�	test_copy1s
zBaseBytesTest.test_copycsZ|j��|jt��d�|jt�fdd��|jt�fdd��|jt�fdd��|jt�fdd��|jt�fdd��|jt�fdd��|jt�fd	d��|jt�fd
d��|jt�fdd��|jt�fdd��|jt�fd
d��dS)Nrcs�dS)Nrrr)rrr
�<lambda>;sz3BaseBytesTest.test_empty_sequence.<locals>.<lambda>cs�dS)N�rr)rrr
r&<scs�tjS)N)�sys�maxsizer)rrr
r&=scs�tjdS)Nr')r(r)r)rrr
r&>scs�dS)N�
�dlDG��d�r���Y�|g�O�s&YR5Irr)rrr
r&?scs�dS)Nr'���rr)rrr
r&@scs�dS)N����rr)rrr
r&Ascs�tjS)N)r(r)r)rrr
r&Bscs�tjdS)Nr')r(r)r)rrr
r&Cscs�tjdS)Nr-)r(r)r)rrr
r&Dscs�dS)Nr*r+lDG��d�r���Y�|g�O�s&YR5Il��DG��d�r���Y�|g�O�s&YR5Irr)rrr
r&Es)rr�len�assertRaises�
IndexError)rr)rr
�test_empty_sequence8sz!BaseBytesTest.test_empty_sequencecCs^ttd��}|jdd�|D��}|jt|�d�|jt|�|�dS)N�css|]}|VqdS)Nr)�.0�irrr
�	<genexpr>Isz/BaseBytesTest.test_from_list.<locals>.<genexpr>)�list�rangerrr/)rZintsrrrr
�test_from_listGszBaseBytesTest.test_from_listcCs�|jt�td�td�td�g�}|jt|�ddddg�|jt|jtd�g�|jt|jtd�g�dS)Nr'��rr3r,)rrrr7r0�
ValueError)rrrrr
�test_from_indexMs
"zBaseBytesTest.test_from_indexcCs�|j|jd�d�|j|jd�d�|j|jd�d�|jt|jd
�|j|jdd�d	�|j|jd	�d	�|jt|jtjd�dS)Nr�r's�s�0�ascii�0r,)rrr0r<�
OverflowErrorr(r))rrrr
�test_from_ssizeTszBaseBytesTest.test_from_ssizecCse|jt|jd�Gdd�d�}|jt|jdg�|jt|jdg�|jt|jdg�|jt|j|�g�|jt|jdd�|jt|jdd�|jt|jddd	�|jt|jddd	�|jt|jd
�|jt|jd
dd	�|jt|jd
d�|jt|jd
dd�dS)
Ngc@seZdZdS)z5BaseBytesTest.test_constructor_type_errors.<locals>.CN)rrrrrrr
�C`srEr@rrAr>�errors�ignorersasciisignore)r0�	TypeErrorr)rrErrr
�test_constructor_type_errors^sz*BaseBytesTest.test_constructor_type_errorscCs|jt|jdg�|jt|jtjg�|jt|jtjdg�|jt|jtjdg�|jt|jd	g�|jt|jdg�|jt|jdg�|jt|jtjg�|jt|jtjdg�|jt|jd
g�dS)Nr'r-r*r+r3ir,lDG��d�r���Y�|g�O�s&YR5Il��DG��d�r���Y�|g�O�s&YR5IlDG��d�r���Y�|g�O�s&YR5I)r0r<rr(r))rrrr
�test_constructor_value_errorsos!! z+BaseBytesTest.test_constructor_value_errorscCsSt}|jttf|j|�yt|d�Wnttfk
rNYnXdS)N�)rr0rC�MemoryErrorr�	bytearray)r�sizerrr
�test_constructor_overflow{sz'BaseBytesTest.test_constructor_overflowcCsv|jdddg�}|jdddg�}|jddg�}|j||�|j||k�|j||k�|j||k�|j||k�|j||k�|j||k�|j||k�|j||k�|j||k�|j||k�|j||k�|j||k�|j||k�|j||k�|j||k�dS)Nr'r-�)rr�
assertTrue�assertFalse)r�b1�b2Zb3rrr
�test_compare�s&zBaseBytesTest.test_comparecCs�|j|jd�dkd�|j|jd�dkd�|j|jd�dkd�|j|jd�dkd�|j|j�t�kd�|j|j�t�kd�dS)Nsabc�abcFsabcsabcsabcT)rr�str)rrrr
�test_compare_to_str�sz!BaseBytesTest.test_compare_to_strcCsTtttd��}|j|�}tt|��}|j�|j||�dS)N�Hello)r7�map�ordr�reversed�reverser)r�inputr�outputrrr
�
test_reversed�s

zBaseBytesTest.test_reversedcs��fdd�}|d�}�j|dd�|d���j|dd�|d���j|dd�|d	���j|dd�|d
���j|dd�|d
���j|dd�|d
���j|dd�|d���j|dd�|d���j|dd�|d	���j|dd�|d
���j|dd�|d
���j|dd�|d
���j|dd�|d��dS)Ncs�jtt|��S)N)rrZr[)�s)rrr
�by�sz'BaseBytesTest.test_getslice.<locals>.byzHello, worldr?rYr'Zello�z, �world�r+�i����i����i����i�������rgrgrgi����)r)rrbrr)rr
�
test_getslice�s            zBaseBytesTest.test_getslicec
Cs�ttd��}|j|�}d
}xm|D]e}x\|D]T}xK|dd�D]9}|j||||�|j||||���qRWq;Wq.WdS)Nr;rr'rP�r+r-�r,r.������)
rNr'rPrir+r,r.rkrl)r7r8rr)r�Lr�indices�start�stop�steprrr
�test_extended_getslice�s

z$BaseBytesTest.test_extended_getslicecCs�d}xBdD]:}|j||�}|j||j|j|���q
W|jt|j|d�|j|dd�}|j||j|dd�d��dS)	NuHello world
ሴ噸骼�utf-8�utf-16zlatin-1rGrP)rsrt���)rr�encoder0�UnicodeEncodeError)r�sample�encrrrr
�
test_encoding�s
&zBaseBytesTest.test_encodingcCs�d}x9dD]1}|j||�}|j|j|�|�q
Wd}|j|d�}|jt|jd�|j|jdd�d�|j|jddd	d�d�|j|jd
�j�d�dS)
NuHello world
ሴ噸骼\def0\def0�utf-8�utf-16uHello world
€þÿzlatin-1rGzHello world
rF�encodings☃u☃)r{r|)rr�decoder0�UnicodeDecodeError)rrxryrrrr
�test_decode�s
zBaseBytesTest.test_decodecCs�|jd�}|j||j��|jd�}|j||jdgd��|jd�}|j||jdgd��dS)Nrr*i')rr)rrrrr
�
test_from_int�s zBaseBytesTest.test_from_intcs�|jd��|jd��|j��d�|j�td�d�|jtd��d�|jt�fdd��|jt�fdd��dS)Nsabcsdefsabcdefsdefabccs�dS)N�defrr)rSrr
r&�sz+BaseBytesTest.test_concat.<locals>.<lambda>csd�S)NrVrr)rTrr
r&�s)rr�bytesr0rH)rr)rSrTr
�test_concat�szBaseBytesTest.test_concatcs�x�d|jd�fD]��|j�dd�|j�dd�|j�d
d�|jt�fdd��|jt�fd	d��|jttf���tj}WdQRX|jttf���tj9�WdQRXqWdS)NsabcrPs	abcabcabcrr>r'cs�dS)Ng��Q�	@rr)rrr
r&�sz+BaseBytesTest.test_repeat.<locals>.<lambda>csd�S)Ng��Q�	@rr)rrr
r&�sr,)rrr0rHrCrLr(r))r�cr)rr
�test_repeat�szBaseBytesTest.test_repeatcCs7|j|jd�d|jtd�gd��dS)N�xr+�x)rrr[)rrrr
�test_repeat_1charszBaseBytesTest.test_repeat_1charcs�|jd��|jtd���|jttd����|jd��|jt�fdd��|jt�fdd��|jt�fdd��|jt�fdd��|jt�fd	d��xtt	fD]�}|j|d
���|j|d���|j|d���|j|d
���|j|d���|j|d���|j|d���|j|d���|j|d���|j|d���|j|d���q�WdS)Nsabcr#��cs
d�kS)Ni,rr)rrr
r&sz-BaseBytesTest.test_contains.<locals>.<lambda>cs
d�kS)Nr'r,rr)rrr
r&scs
d�kS)Nrr)rrr
r&scsttd���kS)Nr#)�floatr[r)rrr
r&scs
d�kS)Nr#rr)rrr
r&sr>�a�b�csabsbcsac�dsdabsabd)
r�assertInr[�intZassertNotInr0r<rHr�rM)r�fr)rr
�
test_contains	s*zBaseBytesTest.test_containscCsT|jt|jj�|jt|jjd�|j|jjd�|j��tdddg�}|j|jjd�|�|j|jjd�|�|j|jjd�d	�|jt|jjd
�|jt|jjd�|jt|jjd�|jt|jjd
�|jt|jjd�|jt|jjd�dS)Nr'r��+�0Z1a2B30z  1A 2B  30   Z0000ss1Br#Zrtz1a b cd�z12      34)r0rHr�fromhexrrMr<)rrrrr
�test_fromhex s"zBaseBytesTest.test_fromhexcCs�|jt|jj�|jt|jjd�|j|jd�j�d�|jtdddg�j�d�|j|jd�j�d�|jtd�j�d�dS)	Nr'r>rr�r�r�Z1a2b30s+0)r0rHr�hexrrM�
memoryview)rrrr
�test_hex/s%zBaseBytesTest.test_hexcCsp|j|jd�jg�d�|j|jd�jdg�d�x�dgddgddgdddggD]�}tt|j|��}|j|jd�j|�d�|j|jd�jt|��d�|j|jd�jt|��d�qrW|jd�j}|j|dd	g�d
�|j|td�d	g�d
�|j|dtd	�g�d
�|j|td�d	g�d
�|j|dtd	�g�d
�dgd}ddd
}|j||�|�|j	t
|jd�jd�|j	t
��|td�ddg�WdQRX|j	t
��|td�ddg�WdQRXdS)Nr>sabcr�sbcsabr�r�s.:scdsab.:cdi�s.:abci�� Zcdsef)rr�joinr7rZ�tuple�iterr�rMr0rH)rZlstZdot_join�seqZexpectedrrr
�	test_join7s*"%1"(,""""
 zBaseBytesTest.test_joincCs�|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
�dS)Nsmississippi�i�p�w�irKsssr-�wr��pr'rPrc�	)rr�count)rrr5�p�wrrr
�
test_countQs"zBaseBytesTest.test_countc
Cs�|jd�}|j|j�jd��|j|jd��|j|jd��|j|jd��|j|jd��|j|jd��|jt��}|jdg�WdQRXt|j�}|jd|�|jd|�dS)	Nshellosanythingshel�hshellowshar�r�)	rrR�
startswithrQr0rHrW�	exceptionr�)rr�cm�excrrr
�test_startswithhszBaseBytesTest.test_startswithc
Cs�|jd�}|jt�jd��|j|jd��|j|jd��|j|jd��|j|jd��|j|jd��|jt��}|jdg�WdQRXt|j�}|j	d|�|j	d|�dS)	Nshellosanythingsllo�oswhellosnor�r�)
rrRrM�endswithrQr0rHrWr�r�)rrr�r�rrr
�
test_endswithvszBaseBytesTest.test_endswithcCs�|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|jddd	�d�|j|j|d�d�|j|j|dd	�d�|j|j|dd	�d�x7dd
tjdfD]}|jtd|j|�qcWdS)Nsmississippir�r�sssr-r�r's
mississippianrPr?rcr�r3zbyte must be in range\(0, 256\)r,r,r,r,r,r,)rr�findr(r)�assertRaisesRegexr<)rrr5r��indexrrr
�	test_find�s$zBaseBytesTest.test_findcCs4|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�dS)Nsmississippir�r�sssr?r�r's
mississippianr*rPrr�r-r�rcr,r,r,r,)rr�rfind)rrr5r�rrr
�
test_rfind�szBaseBytesTest.test_rfindcCsA|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	�dS)
Nsmississippir�r�sssr-r�s
mississippianr'rPr?rcr�)rrr�r0r<)rrr5r�rrr
�
test_index�szBaseBytesTest.test_indexcCs(|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	�dS)Nsmississippir�r�sssr?r�s
mississippianr*rPrr�r-r'r�rc)rr�rindexr0r<)rrr5r�rrr
�test_rindex�szBaseBytesTest.test_rindexcCs�|jd�}|}|d}|j|d�|j|d�|j||k�|jd�}|d}|j|d�|jt|�|j�dS)	Ns
hello, %b!sworlds
hello, world!s%s / 100 = %d%%�seventy-nine�Osseventy-nine / 100 = 79%)r�r�)rrrR�assertIsr)rr�origr#rrr
�test_mod�s

zBaseBytesTest.test_modcCs�|jd�}|}|d;}|j|d�|j|d�|j||k�|jd�}|d;}|j|d�|jt|�|j�dS)	Ns
hello, %b!sworlds
hello, world!s%s / 100 = %d%%�seventy-niner�sseventy-nine / 100 = 79%)r�r�)rrrRr�r)rrr�rrr
�	test_imod�s

zBaseBytesTest.test_imodc
CsQ|jt��t�|jd�WdQRX|j|jd�jd�t�dS)Nsabcz%r)r0rH�objectrr��__rmod__�NotImplemented)rrrr
�	test_rmod�szBaseBytesTest.test_rmodcCsK|jd�}|j|jdd�d�|j|jdd�d�dS)Nsmississippir�r�smassassappasssr�s	mixixippi)rr�replace)rrrrr
�test_replace�szBaseBytesTest.test_replacecCs#|jt|jd�jd�dS)Nsa b� )r0rHr�split)rrrr
�test_split_string_error�sz%BaseBytesTest.test_split_string_errorcCsex6dD].}|j|�}|j|j�|g�qW|jd�}|j|j�dg�dS)N�ab�ab�ab�abs		

s)r�r�r�r�)rrr�)rrrrr
�test_split_unicodewhitespace�s

z*BaseBytesTest.test_split_unicodewhitespacecCs#|jt|jd�jd�dS)Nsa br�)r0rHr�rsplit)rrrr
�test_rsplit_string_errorsz&BaseBytesTest.test_rsplit_string_errorcCs,|jd�}|j|j�dg�dS)Ns		

s)rrr�)rrrrr
�test_rsplit_unicodewhitespacesz+BaseBytesTest.test_rsplit_unicodewhitespacecCsE|jd�}|j|jd�d�|j|jd�d�dS)	N�mississippi�ss�mi�issippir�r>)r�r�r�)r�r>r>)rr�	partition)rrrrr
�test_partition
szBaseBytesTest.test_partitioncCs^|jd�}|j|jd�d	�|j|jd�d
�|j|jd�d�dS)N�mississippi�ss�missi�ippir��
mississippr>r�)r�r�r�)r�r�r>)r>r>r�)rr�
rpartition)rrrrr
�test_rpartitionszBaseBytesTest.test_rpartitioncCssxlttjd�D]W}xNdD]F}|j|�}tj||�}tj|�}|j||�q!WqWdS)Nr'r>r��abc��ab���)r>r�r�r�r�)r8�pickle�HIGHEST_PROTOCOLr�dumps�loadsr)r�protorZps�qrrr
�
test_picklings
zBaseBytesTest.test_picklingcCsxttjd�D]�}x�dD]�}t|j|��}}t|j|��}tj||�}tj|�}|jt	|�t	|��|jt|�|�tj|�}|s�q!t
|�tj||�}tj|�}|jt|�|dd��q!WqWdS)Nr'r>r��abc��ab���)r>r�r�r�r�)r8r�r�r�rr7r�r�rr�next)rr�r�itZitorg�data�drrr
�test_iterator_picklings

z$BaseBytesTest.test_iterator_picklingcCs||j|jd�jtd��d�|j|jd�jtd��d�|j|jd�jtd��d�dS)Nsabcsacr�sbcsab)rr�stripr��lstrip�rstrip)rrrr
�test_strip_bytearray/s((z"BaseBytesTest.test_strip_bytearraycCsa|jt|jd�jd�|jt|jd�jd�|jt|jd�jd�dS)Nsabcr)r0rHrr�r�r�)rrrr
�test_strip_string_error4sz%BaseBytesTest.test_strip_string_errorcCsU|jd�}x?ttfD]1}|j|jd|d��|jd��qWdS)Nsabcrc�-s--abc--)rr�rMr�center)rr�	fill_typerrr
�test_center9szBaseBytesTest.test_centercCsU|jd�}x?ttfD]1}|j|jd|d��|jd��qWdS)Nsabcrcr�sabc----)rr�rMr�ljust)rrr�rrr
�
test_ljust@szBaseBytesTest.test_ljustcCsU|jd�}x?ttfD]1}|j|jd|d��|jd��qWdS)Nsabcrcr�s----abc)rr�rMr�rjust)rrr�rrr
�
test_rjustGszBaseBytesTest.test_rjustcsQ|jd��|j�fdd�tt���D�dddddg�dS)	NsA��cs*g|] }t�||d���qS)r')r[)r4r5)rrr
�
<listcomp>Ps	z*BaseBytesTest.test_ord.<locals>.<listcomp>r�A��r;)rrr8r/)rr)rr
�test_ordNs(zBaseBytesTest.test_ordcCs�d}|j|jjdd�|�d}|j|jjdd�|�|jt|jjdd�|jt|jjdd�dS)	Ns	

 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`xyzdefghijklmnopqrstuvwxyz{|}~�����������������������������������������������������������������������������������������������������������������������������sabcsxyzs	

 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~��������������������������������������������������������������������������������������������������������������������������xyzs���sxyzqrVr�)rr�	maketransr0r<rH)rZ
transtablerrr
�test_maketransSszBaseBytesTest.test_maketranscCs�|jd�}|jd�}|jd�}|jd�}|jd�}|jd|j|d��|jd|j|dd��|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��dS)Nshello�lr�r�r�r-rPrr'TFr.r.r.r.r.r.r.r.r.r.r.r.r.r.)	rrr�r�r�r�r�r�r�)rr�l�hr��orrr
�test_none_arguments[sBz!BaseBytesTest.test_none_argumentscCs{|jd�}xe|j|j|j|j|jfD]?}|jt|d�|jt|d�|jt|d�q4WdS)Nshellor'r3i'r,)rr�r�r�r�r�r0r<)rr�methodrrr
�(test_integer_arguments_out_of_byte_range�s
+z6BaseBytesTest.test_integer_arguments_out_of_byte_rangecCs|jd�}|jd�}|jtd|j|ddd�|jtd|j|ddd�|jtd|j|ddd�|jtd|j|ddd�|jtd|j|ddd�|jtd|j|ddd�|jtd	|j	|ddd�dS)
Nshellor�z\bfind\bz	\brfind\bz	\bindex\bz
\brindex\bz	\bcount\bz\bstartswith\bz\bendswith\b)
rr�rHr�r�r�r�r�r�r�)rrr�rrr
�*test_find_etc_raise_correct_error_messages�s z8BaseBytesTest.test_find_etc_raise_correct_error_messagescCs6tjj|t|j�tjj|t|j�dS)N)rrZcheck_free_after_iteratingr�rr\)rrrr
�test_free_after_iterating�sz'BaseBytesTest.test_free_after_iteratingN);rrrr r%r2r9r=rDrIrJrrOrUrrXr`rhrrrzr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrr	rrrrrrrrr
r*sl
		
+rc@sFeZdZeZdd�Zdd�Zdd�Zdd�Zd	S)
�	BytesTestc	Cs,d}|jt|��
ddWdQRXdS)Nz'byte indices must be integers or slicesspythonr#)r�rH)r�msgrrr
�test_getitem_error�szBytesTest.test_getitem_errorcCsNtjttj�}t|ddd��}|jt|jd�WdQRXdS)N�rb�	bufferingrr>)�os�open�__file__�O_RDONLYr0rH�readinto)r�fdr�rrr
�test_buffer_is_readonly�sz!BytesTest.test_buffer_is_readonlycCs�Gdd�d�}|jt|��d�Gdd�d�}|jtt|��Gdd�d�}|jtt|��Gdd�d�}|jt|��d�Gdd�dt�}|jt|d	��d�|jt|d	�d
�d�Gdd�d�}|jt|��d�|jtt|���t�|jt|��d�|jtt|���t�dS)
Nc@seZdZdd�ZdS)z BytesTest.test_custom.<locals>.AcSsdS)Nsabcr)rrrr
�	__bytes__�sz*BytesTest.test_custom.<locals>.A.__bytes__N)rrrr!rrrr
�A�sr"sabcc@seZdZdS)z BytesTest.test_custom.<locals>.AN)rrrrrrr
r"�sc@seZdZdd�ZdS)z BytesTest.test_custom.<locals>.AcSsdS)Nr)rrrr
r!�sz*BytesTest.test_custom.<locals>.A.__bytes__N)rrrr!rrrr
r"�sc@s(eZdZdd�Zdd�ZdS)z BytesTest.test_custom.<locals>.AcSsdS)Nr�r)rrrr
r!�sz*BytesTest.test_custom.<locals>.A.__bytes__cSsdS)N�*r)rrrr
r�sz*BytesTest.test_custom.<locals>.A.__index__N)rrrr!rrrrr
r"�sr�c@seZdZdd�ZdS)z BytesTest.test_custom.<locals>.AcSsdS)Nsabcr)rrrr
r!�sz*BytesTest.test_custom.<locals>.A.__bytes__N)rrrr!rrrr
r"�su€z
iso8859-15s�c@seZdZdd�ZdS)z BytesTest.test_custom.<locals>.AcSs
td�S)Nsabc)�OtherBytesSubclass)rrrr
r!�sz*BytesTest.test_custom.<locals>.A.__bytes__N)rrrr!rrrr
r"�s)	rr�r0rHrWr�rr$�
BytesSubclass)rr"rrr
�test_custom�s zBytesTest.test_customcCsQtjjd�ddlm}m}m}m}|j}||_	|j
|d�d�|j
|d�d�|j
|d�d�|j
|d�d�|j
|d	�d
�|j
|d|td���d
�|j
|d|d��d�|j
|d|d��d�|jt
|d|d��|jt
|d|d��dS)N�ctypesr)�	pythonapi�	py_object�c_int�c_char_psformat�%s%%s%%ss%ss[%%]s[%]s%%%c�_s%_sc:%cr;sc:�ss:%sscstrss:cstrs%cr'r3r,)rr�
import_moduler'r(r)r*r+�PyBytes_FromFormatZrestyperr[r0rC)rr(r)r*r+r/rrr
�test_from_format�s&"		%		zBytesTest.test_from_formatN)	rrrr�rrr r&r0rrrr
r�s
!rc@s�eZdZeZdd�Zdd�Zdd�Zdd�Zd	d
�Z	dd�Z
d
d�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Z d9d:�Z!d;d<�Z"e#j$j%d=d>��Z&d?d@�Z'e#j(j)j*Z*dAdB�Z+dCS)D�
ByteArrayTestc	Cs2d}|jt|��td�dWdQRXdS)Nz,bytearray indices must be integers or slicesspythonr#)r�rHrM)rrrrr
r�sz ByteArrayTest.test_getitem_errorc
Cs:d}|jt|��td�}d|d<WdQRXdS)Nz,bytearray indices must be integers or slicesspython�pythonr#)r�rHrM)rrrrrr
�test_setitem_error�sz ByteArrayTest.test_setitem_errorcCs|jttt��dS)N)r0rH�hashrM)rrrr
�test_nohash�szByteArrayTest.test_nohashc.Cs=d}|ddt|�}tj�}z�t|d��}|j|�WdQRXt|d��"}td�}|j|�}WdQRX|j|t|��|jt|�t|��t|d��}|j|�WdQRXt|d��}|j|j	�|�WdQRXWdyt
j|�Wntk
r7YnXXdS)NsHello world
s��wbr)
r/�tempfileZmktempr�writerMrrr7�readr�remove�OSError)rZshort_samplerxZtfnr�r�nrrr
�test_bytearray_apis&!
z ByteArrayTest.test_bytearray_apicCs|td�}|j|j�d�|j|d�td�}|j�|j|d�t�}|j�|j|�dS)Nshellosollehshello1s1olleh)rMrr]rR)rrrrr
�test_reverses
	
zByteArrayTest.test_reversecCs�td�}|j�|j|d�td�}|j�|j|d�td�}|jtd��|j�|jtd��|j|d�dS)Nspythonr>�rr�r�)rM�clearr�appendr[)rrrrr
�
test_clear%s


zByteArrayTest.test_clearcCs�td�}|j�}|j|d�td�}|j�}|j|d�td�}|j�}|j||�|j||�|jtd��|j|d�|j|d�dS)Nsabcr>r�sabcd)rMr!r�assertIsNotrBr[)rrZbbrrr
r%4szByteArrayTest.test_copycCsJdd�}|d�}|jtjd|�|d�|d�g�dS)NcSsttt|��S)N)rMrZr[)rarrr
rbGsz&ByteArrayTest.test_regexps.<locals>.byzHello, worlds\w+rYrd)r�re�findall)rrbrrrr
�test_regexpsFszByteArrayTest.test_regexpsc+Cs�tdddg�}d|d<|j|tdddg��d|d<|j|tdddg��td�|d<|j|tdddg��yd|d<|jd�Wntk
r�YnXyd|d
<|jd�Wntk
r�YnXyd	|d<|jd
�Wntk
r%YnXy!td�|d<|jd
�Wntk
r[YnXyd|d<|jd�Wntk
r�YnXdS)Nr'r-rPr+r�r*rzDidn't raise IndexErrorr3zDidn't raise ValueErrorzDidn't raise TypeErrorr,i����r,)rMrr�failr1r<rH)rrrrr
�test_setitemLs@










zByteArrayTest.test_setitemc
Cs�ttd��}|d=|j|ttdd���|d=|j|ttdd���|d=|j|tdddddd	d
g��dS)Nr*rr'r�rKr-rPr�rc�r,)rMr8r)rrrrr
�test_delitemnszByteArrayTest.test_delitemcCs<ttd��}|jt|�ttd���tdddddg�|dd�<|j|tddddddddddg
��|dd�=|j|tdddddg��tddd	d
dg�|dd�<|j|ttd���tdd
g�|dd�<|j|tddd	dd
dddg��d
dddg|d
d�<|j|ttd���dddg|d
d�<|j|tddd	dddd
ddddddg
��d|d
d�<|j|tddd	dddg��td�|dd
�<|j|tddddddg��g|d
d�<|j|tdddddg��xedd dtd�ddddgddgggg	D]-}|jt��||d
d�<WdQRXq�WxJdddgd!dggD]-}|jt��||d
d�<WdQRXqWdS)"Nr*r'rr?r�rcrJr�r-rPrKr+�er#sfoo�f�ogP����KDrWgffffff@r#rr�r�r:r;r3i(#rgi����rurgi���)	rMr8rr7r�r�r0rHr<)rr�elemrrr
�
test_setslicews6"%4
%%.=((%""zByteArrayTest.test_setslicecCs�ttd��}|jt|�ttd���|dd�=|jt|�ttdd���|jtdd��|jt|�ttdd���dS)Nr+r*�n)rMr8rr7�extend)rrrrr
�test_setslice_extend�s"
%z"ByteArrayTest.test_setslice_extendcCs:td�}|j�|dd�=|td�7}~dS)Nr*r'r-)rM�popr�)rrrrr
�test_fifo_overrun�s


zByteArrayTest.test_fifo_overruncCsEtd�}tj|�}|dd�=|jtj|�|�dS)Nr*r')rMr(�	getsizeof�assertLessEqual)rrrNrrr
�test_del_expand�s
zByteArrayTest.test_del_expandcCs�d}x�|D]�}x�|D]�}x�|dd�D]�}ttd	��}t|�}||||�}|j�|||||�<|||||�<|j|t|��||||�=||||�=|j|t|��q1WqWq
WdS)Nrr'rPri�,iMr-rjr;�r,r.�������)rNr'rPrirYrZr,r.r[r\)r7r8rMr]r)rrnrorprqrmrr�rrr
�test_extended_set_del_slice�s


z)ByteArrayTest.test_extended_set_del_slicecCsXttd��}||dd�<|j|tttd��ttd����dS)Nr3rJ)rMr8rr7)rrrrr
�test_setslice_trap�sz ByteArrayTest.test_setslice_trapcCs�td�}|}|d7}|j|d�|j||�|j||k�|d7}|j|d�y|d7}Wntk
r�YnX|jd�dS)Nsabcsdefsabcdefsxyzs	abcdefxyzrz'bytes += unicode didn't raise TypeError)rMrrQrHrH)rrrSrrr
�test_iconcat�s


zByteArrayTest.test_iconcatcCsStd�}|}|d9}|j|d�|j||�|j||k�dS)NsabcrPs	abcabcabc)rMrrQ)rrrSrrr
�test_irepeat�s
zByteArrayTest.test_irepeatcCsWtd�}|}|d9}|j|dd�|j||�|j||k�dS)Nr�r+)rMrrQ)rrrSrrr
�test_irepeat_1char�s
z ByteArrayTest.test_irepeat_1charcCs�t�}|j�}|j|dk�|g}xYtd�D]K}|d7}|j�}|j|t|��||kr>|j|�q>WdS)Nrr+r�)rM�	__alloc__rQr8�
assertGreaterr/rB)rr�allocr�r5rrr
�
test_alloc�s		
zByteArrayTest.test_alloccs�t����fdd�}�j|���jt��ttdd����jt��d��j�}�j|t���dS)Nc3s�x�tdd�D]�}|Vt��}�j|ttdt|�d����jt��t|���jt��|��j�}�j|t���qWdS)Nr'r+)r8r7rr/rWrbrc)r5r#rd)rrrr
�gs)z(ByteArrayTest.test_init_alloc.<locals>.gr'r+�c)rMrrr7r8r/rbrc)rrfrdr)rrr
�test_init_alloc�s		%zByteArrayTest.test_init_alloccCsd}t|�}|j|�|j|||�|j|dd�|�td�}|jtt|d��|jdd�|dD��|j||d�|j|dd�|�td�}|jttt|d���|j||d�|j|dd�|�td�}|jttt|d���|j||d�|j|dd�|�td�}|jt|jdd	d
dg�|jt|jdd	d
dg�|jt	|�d�td�}|jt
td��g�|j|d
�dS)Nshellor?r>�css|]}t|�VqdS)N)r�)r4r�rrr
r6sz,ByteArrayTest.test_extend.<locals>.<genexpr>�2rr'r-r3r#r�rgrgrgr,)rMrRrrZr�r�r7r0r<r/rr[)rr�r#rrr
�test_extends2
  ""zByteArrayTest.test_extendcs�td���jtd��|j�d��jtd��|j�d�|jt�fdd��|jt�fdd��|jt�fdd���jtd	���jtd
��|j�d�|jt�fdd���jttd
���|j�d�tddddg�}|jd�|j|tdddg��|jd�|j|tddg��dS)Nshellor
shelosheocs�jtd��S)Nr
)r;r[r)rrr
r&2sz+ByteArrayTest.test_remove.<locals>.<lambda>cs
�jd�S)Ni�)r;r)rrr
r&3scs
�jd�S)N�e)r;r)rrr
r&4srr�ecs
�jd�S)Nrm)r;r)rrr
r&9srlr>�~rr�)	rMr;r[rr0r<rHrr�)rr�r)rr
�test_remove,s&

zByteArrayTest.test_removecs�td��|j�j�td��|j�jd�td��|j�jd�td��|jt�fdd��|jtd	d��|jtd
�j�d�dS)
Nsworldr�rr�r-r@cs
�jd�S)Nr*)rTr)rrr
r&Isz(ByteArrayTest.test_pop.<locals>.<lambda>cSs
t�j�S)N)rMrTrrrr
r&Jss�r;r.)rMrrTr[r0r1)rr)rr
�test_popDszByteArrayTest.test_popcCs|jtdd��dS)NcSs
t�j�S)N)rM�sortrrrr
r&Osz+ByteArrayTest.test_nosort.<locals>.<lambda>)r0�AttributeError)rrrr
�test_nosortNszByteArrayTest.test_nosortcs�td���jtd��|j�d�|j�jd�d�t���jtd��|jt��d�|jt�fdd��t���jttd���|j�d	�dS)
Nshellrshellor+r"r'cs
�jd�S)Nr�)rBr)rrr
r&Ysz+ByteArrayTest.test_append.<locals>.<lambda>�A)rMrBr[rr/r0rHr)rr)rr
�test_appendQs		zByteArrayTest.test_appendcs�td���jdtd���jdtd���jd
td���jdtd��|j�d�|jt�fdd	��t���jd
ttd���|j�d�dS)Nsmssssppr'r5rKr-i�smississippics�jdd�S)Nr�1)�insertr)rrr
r&esz+ByteArrayTest.test_insert.<locals>.<lambda>rr"rur.)rMrxr[rr0rHr)rr)rr
�test_insert^s	zByteArrayTest.test_insertcCsytd�}|j||jddd�k�tdd�td�D��}td�}|j||j|�k�dS)NsabcscdercSsg|]}|�qSrr)r4r5rrr
rps	z-ByteArrayTest.test_copied.<locals>.<listcomp>r3r>)rMrRr�r8�	translate)rr�tr�rrr
�test_copiedjs
"zByteArrayTest.test_copiedcCsVtd�jd�\}}}|j|d�|j|d�|j||k	�|d7}|j|d�td�jd�\}}}|j|d�|j|d�td�jd�\}}}|j|d�|j|d�|j||k	�|d7}|j|d�td�jd�\}}}|j|d�|j|d�dS)Nr��yr>�!)rMr�rrQr�)rr#rr�rrr
�0test_partition_bytearray_doesnt_share_nullstringts$

z>ByteArrayTest.test_partition_bytearray_doesnt_share_nullstringcskttd���t��}�fdd�}|d��dd�}|jt|d�|j�|�|jt|d�|j�|�|jt|d�|j�|�|jt�jd�|j�|�|jt�j�d�|j�|��fdd	�}|jt|�|j�|��fd
d�}|jt|�|j�|�dS)Nr*cs)t|dd|d��dd�<dS)Nr'r-r,)r8)r=)rrr
�resize�sz3ByteArrayTest.test_resize_forbidden.<locals>.resizerfr�rr'cs�d=dS)Nr'rr)rrr
�delitem�sz4ByteArrayTest.test_resize_forbidden.<locals>.delitemcsd�ddd�<dS)Nr>r'r-r,rr)rrr
�delslice�sz5ByteArrayTest.test_resize_forbidden.<locals>.delslice)rMr8r�r0�BufferErrorrrTr;)r�vr�r�r�r�r)rr
�test_resize_forbidden�s*
z#ByteArrayTest.test_resize_forbiddencCs*ddlm}|jt|t��dS)Nr)�getbuffer_with_null_view)Z	_testcapir�r0r�rM)rr�rrr
�test_obsolete_write_lock�sz&ByteArrayTest.test_obsolete_write_lockc	CsGtd�}td�}x(ttjd�D]}t|�}tj||f|�}tj|�\}}||dd�<|jt	|�t	|��|jt|�|�t
|�tj||f|�}tj|�\}}||dd�<|jt	|�t	|��|jt|�|dd��x'tdt|��D]}t
|�qFWtj||f|�}tj|�\}}||dd�<|jt	|�t	|��|jt|�|t|�d��|jt
t
|�tj||f|�}tj|�\}}||dd�<|jt|�g�q,WdS)Nsabcsqwertyr')rMr7r8r�r�r�r�r�rrr�r/r0�
StopIteration)	rr�r�r�Zitorigr�r�rr5rrr
�test_iterator_pickling2�s6
 &z%ByteArrayTest.test_iterator_pickling2cCsFtd�}t|�}t|�|j�|jt|�g�dS)Nsab)rMr�r�rArr7)r�bar�rrr
�test_iterator_length_hint�s


z'ByteArrayTest.test_iterator_length_hintN),rrrrMrrr3r5r>r?rCr%rGrIrKrPrSrUrXr]r^r_r`rarerhrkrprqrtrvryr|rr�rrZcpython_onlyr�r�Z
list_testsZ
CommonTestZtest_exhausted_iteratorr�rrrr
r1�sF"	(		


 $r1c@s�eZdZedd��Zedd��Zdd�Zejj	dd��Z
d	d
�Zedd��Zd
d�Z
dd�Zdd�Zdd�Zdd�Zejejjd�dd��ZdS)�AssortedBytesTestcCs�x�ttfD]�}|j|t��d�|j|tdg��d�|j|tddddg��d�|j|d�d	�|j|d
�d�|j|d�d
�q
WdS)Nzbytearray(b'')rzbytearray(b'\x00')r'r:r;zbytearray(b'\x00\x01\xfe\xff')sabczb'abc'�'zb"'"s'"zb'\'"')rW�reprrrM)rr�rrr
�
test_repr_str�s!zAssortedBytesTest.test_repr_strcCs�x�dtd�fD]~}|jt|�t|��|jt|d�t|��|jtdtjt|�j	���t|d�WdQRXqWdS)Nsabcrz\b%s\bra)
rMr�formatrWr�rHrE�escaperr)rrrrr
�test_format�s	 zAssortedBytesTest.test_formatcCs�|jdtd�kd�|jdtd�kd�|jdtd�kd�|jdtd�kd�|jdtd�kd�|jdtd�kd�|jdtd�kd�|jdtd�kd�|jdtd�kd�|jdtd�kd�|jdtd�kd�|jdtd�kd�|jtd�dkd�|jtd�dkd�|jtd�dkd�|jtd�dkd�|jtd�dkd�|jtd�dkd�|jtd�dkd�|jtd�dkd�|jtd�dkd�|jtd�dkd�|jtd�dkd�|jtd�dkd�dS)NsabcTsabF)rr�)rrrr
�test_compare_bytes_to_bytearray�s0z1AssortedBytesTest.test_compare_bytes_to_bytearraycCsb|jtj�|jtjjd�tj�|jtj�|jtjjd�tj�dS)Nz
bytearray(zbytes()ZassertIsNotNonerM�__doc__rQr�r�)rrrr
�test_docszAssortedBytesTest.test_doccCs>td�}t|�}t|�}|j|t|��dS)NsHello world
����)r�r�rMr)rrxZbufrrrr
�test_from_bytearraysz%AssortedBytesTest.test_from_bytearraycCs�|jtd�d�|jtd�d�|jtd�d�|jttd��d�|jttd��d�|jttd��d	�dS)
Nr>zb''r�zb'x's�zb'\x80'zbytearray(b'')zbytearray(b'x')zbytearray(b'\x80'))rrWrM)rrrr
�test_to_str!szAssortedBytesTest.test_to_strcCs}d
dddg}x-|D]%\}}|j|t|d	��qWx4td
d�D]#}|jttdt|��qRWdS)N�Wonderful spam�Wonderful spam�Wonderful spam too�Wonderful spam too����ª€�\xaa\x00\000\200�\xaa\x00\000\200zlatin-1rr3zb"%s")r�r�)r�r�)r�r�)r�r�)rrMr8r0�SyntaxError�eval�chr)rZtestsrrar�rrr
�test_literal*s	zAssortedBytesTest.test_literalcCsd}t|�}ttdd��}td�|td�<|j|d�}|j|d�|j|d�|j|d�}|j|d�|j|d�|jdd�}|j|d	�|jdd�}|j|d	�|jt|jdd�|jt|jdd�dS)
Nshellorr3rlrrsheermshllo)rMr8r[rzrr0rH)rrr�Zrosettar�rrr
�test_translate7s z AssortedBytesTest.test_translatecCs)|jdjtd��ddg�dS)Nsa br�r�r�)rr�r�)rrrr
�test_split_bytearrayIsz&AssortedBytesTest.test_split_bytearraycCs)|jdjtd��ddg�dS)Nsa br�r�r�)rr�r�)rrrr
�test_rsplit_bytearrayLsz'AssortedBytesTest.test_rsplit_bytearraycCs,t�}|j|jdd�|k�dS)Nr>)rMrRr�)rrrrr
�test_return_selfOs	z"AssortedBytesTest.test_return_selfz4BytesWarning is needed for this test: use -bb optioncVCsldd�}|��ddkWdQRX|��ddkWdQRX|��ddkWdQRX|��ddkWdQRX|��td�dkWdQRX|��dtd�kWdQRX|��td�dkWdQRX|��dtd�kWdQRX|��ddkWdQRX|��ddkWdQRX|��ddkWdQRX|��ddkWdQRXdS)NcSstjjdtf�S)Nr)rrrrrrrr
�
bytes_warningWsz5AssortedBytesTest.test_compare.<locals>.bytes_warningr>rsr)rM)rr�rrr
rUTs2











zAssortedBytesTest.test_compareN)rrrrr�r�r�rrZrequires_docstringsr�r�r�r�r�r�r�r��unittestZ
skipUnlessr(�flagsr�rUrrrr
r��s		
r�c@s(eZdZdd�Zdd�ZdS)�BytearrayPEP3137TestcCs
t|�S)N)rM)rr�rrr
�marshal�szBytearrayPEP3137Test.marshalcCs�|jd�}xSdD]K}t||�}|d�}|j||�|j||k	|d�qWxDdD]<}t|�}|j||�|j||k	|d�qlW|jd�}|j|g�}|j||�|j||�dS)Ns1234�zfillrrr�rPz" returned self on a mutable object�val.split()[0]�val.rsplit()[0]�val.partition(b".")[0]�val.rpartition(b".")[2]�val.splitlines()[0]�val.replace(b"", b"")z! returned val on a mutable objectr>)r�rrr�)r�r�r�r�r�r�)r��getattrrrQr�r�rD)r�valZmethnamerZnewval�expr�seprrr
�test_returns_new_copy�s$

z*BytearrayPEP3137Test.test_returns_new_copyN)rrrr�r�rrrr
r��sr�cs(eZdZ�fdd�ZdZ�S)�FixedStringTestcs5t|t�r%|j|jd��St�j|�S)Nzutf-8)�
isinstancerWrrv�super�fixtype)r�obj)rrr
r��szFixedStringTest.fixtypeT)rrrr�Zcontains_bytesrr)rr
r��sr�c@seZdZeZdS)�ByteArrayAsStringTestN)rrrrMrrrrr
r��sr�c@seZdZeZdS)�BytesAsStringTestN)rrrr�rrrrr
r��sr�c@sIeZdZdd�Zdd�Zdd�Zdd�ZejZd	S)
�SubclassTestcCsL|jt|j|j��|j|j�|j�d\}}|j|�|j|�}}|j||k�|j||k�|j||k�|j||k�|j||k�|j||k�|j||k	�|j||||�|j||||�|j||||�|j|d|dk�dS)N�abcd�efghr?)r�r�)rQ�
issubclassr�basetypeZassertIsInstancer)rr#rZ_aZ_brrr
�
test_basic�szSubclassTest.test_basiccCs�|jd�}|j�j|g�}|j||k	�|jt|�|jkt|��|jdg�}|jt|�|jk�dS)Nsabcd)rr�r�rQr)r�s1�s2Zs3rrr
r��s%zSubclassTest.test_joincCs�|jd�}d|_|jd�|_x�ttjd�D]�}tjtj||��}|jt	|�t	|��|j
||�|j
|j|j�|j
|j|j�|j
t|�t|��|j
t|j�t|j��q>WdS)Nsabcdr*sefghr')rr��yr8r�r�r�r��assertNotEqual�idrr)rr#r�rrrr
�test_pickle�s	zSubclassTest.test_picklecCs�|jd�}d|_|jd�|_x�tjtjfD]�}||�}|jt|�t|��|j||�|j|j|j�|j|j|j�|jt|�t|��|jt|j�t|j��q=WdS)Nsabcdr*sefgh)	rr�r�r!r"r�r�rr)rr#r$rrrr
r%�s	zSubclassTest.test_copyN)	rrrr�r�r�r%rr�rrrr
r��s



r�c@seZdZdS)�ByteArraySubclassN)rrrrrrr
r��sr�c@seZdZdS)r%N)rrrrrrr
r%�sr%c@seZdZdS)r$N)rrrrrrr
r$�sr$c@s(eZdZeZeZdd�ZdS)�ByteArraySubclassTestcCspGdd�dt�}|dd�}|ddd�}|j|d�|dddd�}|j|d�dS)Nc@seZdZddd�ZdS)z:ByteArraySubclassTest.test_init_override.<locals>.subclassr'c_stj|||�dS)N)rMr)�me�newargr	�kwargsrrr
r�szCByteArraySubclassTest.test_init_override.<locals>.subclass.__init__N)rrrrrrrr
�subclass�sr�rKsabcd�sourcer�)rMr)rr�r�rrr
�test_init_override�sz(ByteArraySubclassTest.test_init_overrideN)rrrrMr�r�rr�rrrr
r��sr�c@seZdZeZeZdS)�BytesSubclassTestN)rrrr�r�r%rrrrr
r�sr��__main__)(r�rrEr(r!rr�r8r�Ztest.supportrZtest.string_testsZtest.list_testsrrr�r�rrrZTestCaserr1r�r�Zstring_testsZBaseTestr�r�r�r�rMr�r�r%r$r�r�r�mainrrrr
�<module>sF��~I���D