Your IP : 216.73.216.213


Current Path : /proc/242857/root/opt/alt/python34/lib64/python3.4/test/__pycache__/
Upload File :
Current File : //proc/242857/root/opt/alt/python34/lib64/python3.4/test/__pycache__/test_bytes.cpython-34.pyc

�
g f
��@s^dZddlZddlZddlZddlZddlZddlZddlZddlZddl	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�deje
jj�ZGdd�de
jj�ZGdd�deej�ZGdd�deej�ZGdd�d�Z Gdd�de!�Z"Gdd�de#�Z$Gdd �d e#�Z%Gd!d"�d"e ej�Z&Gd#d$�d$e ej�Z'e(d%krZej)�ndS)&z�Unit tests for the bytes and bytearray types.

XXX This is a mess.  Common tests should be moved to buffer_tests.py,
which itself ought to be unified with string_tests.py (and the latter
should be modernized).
�N)�bigaddrspacetest�MAX_Py_ssize_tcs%tj���fdd��}|S)Nc
s0tjjdtf���||�SWdQXdS)N�)�test�support�check_warnings�BytesWarning)�args�kw)�func��4/opt/alt/python34/lib64/python3.4/test/test_bytes.py�wrappersz%check_bytes_warnings.<locals>.wrapper)�	functools�wraps)rrr)rr
�check_bytes_warningss!rcCs|S)Nr)rrrr
r sc@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:dmdn�Z;dodp�Z<dqdr�Z=dsS)t�
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_copy2s
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&Ascs�dS)N����rr)rrr
r&Bscs�tjS)N)r(r)r)rrr
r&Cscs�tjdS)Nr')r(r)r)rrr
r&Dscs�tjdS)Nr-)r(r)r)rrr
r&Escs�dS)Nr*r+lDG��d�r���Y�|g�O�s&YR5Il��DG��d�r���Y�|g�O�s&YR5Irr)rrr
r&Fs)rr�len�assertRaises�
IndexError)rr)rr
�test_empty_sequence9sz!BaseBytesTest.test_empty_sequencecCs^ttd��}|jdd�|D��}|jt|�d�|jt|�|�dS)N�css|]}|VqdS)Nr)�.0�irrr
�	<genexpr>Jsz/BaseBytesTest.test_from_list.<locals>.<genexpr>)�list�rangerrr/)rZintsrrrr
�test_from_listHszBaseBytesTest.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_indexNs
"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_ssizeUszBaseBytesTest.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
�Cas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_errorsps!! 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}WdQX|jttf���tj9�WdQXqWdS)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_fromhexcCsn|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�WdQX|j	t
��|td�ddg�WdQXdS)Nr>sabcr�sbcsabr�r�s.:scdsab.:cdi�s.:abci�� Zcdsef)rr�joinr7rZ�tuple�iter�
memoryviewrMr0rH)rZlstZdot_join�seqZexpectedrrr
�	test_join0s*"%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_countJs"zBaseBytesTest.test_countc	Cs�|jd�}|j|j�jd��|j|jd��|j|jd��|j|jd��|j|jd��|j|jd��|jt��}|jdg�WdQXt|j�}|jd|�|jd|�dS)	Nshellosanythingshel�hshellowshar�r�)	rrR�
startswithrQr0rHrW�	exceptionr�)rr�cm�excrrr
�test_startswithaszBaseBytesTest.test_startswithc	Cs�|jd�}|jt�jd��|j|jd��|j|jd��|j|jd��|j|jd��|j|jd��|jt��}|jdg�WdQXt|j�}|j	d|�|j	d|�dS)	Nshellosanythingsllo�oswhellosnor�r�)
rrRrM�endswithrQr0rHrWr�r�)rrr�r�rrr
�
test_endswithoszBaseBytesTest.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_rindexcCsK|jd�}|j|jdd�d�|j|jdd�d�dS)Nsmississippir�r�smassassappasssr�s	mixixippi)rr�replace)rrrrr
�test_replace�szBaseBytesTest.test_replacecCsV|jd�}|j|jd�dddddg�|j|jd�dddg�|j|jd	�|g�|jd
�}|j|jdd�d
dddg�|j|jddd�d
dg�|j|jdddd�d
dg�|j|jdddd�d
dg�|jd�}|j|jdd�d
dg�dS)Nsmississippir��mssssppr>smisippir�sa|b|c|d�sep�|r�r�r�r��maxsplitr'sb|c|dsa b c dsb c d)rr�split)rrrrr
�
test_split�s("(%((zBaseBytesTest.test_splitcCsixzdD]r}|j|�}|j|j�ddg�|j|jd�ddg�|j|jdd	�ddg�qWx6dD].}|j|�}|j|j�|g�q�W|j|jd�jdd�dg�|j|jd�jdd�ddg�|j|jd�jdd	�dddg�|j|jd�jdd�dddg�dS)N�
  arf  barf  �arf	barf�arf
barf�arf
barf�arfbarf�arfbarfsarfsbarfr-�ab�ab�ab�abs  a  bb  c  rs
a  bb  c  r'r�sbb  c  sbbsc  rPr�)r�r�r�r�r�r�)r�r�r�r�)rrr�)rrrrr
�test_split_whitespace�s
&
(+.z#BaseBytesTest.test_split_whitespacecCs#|jt|jd�jd�dS)Nsa b� )r0rHrr�)rrrr
�test_split_string_error�sz%BaseBytesTest.test_split_string_errorcCs,|jd�}|j|j�dg�dS)Ns		

s)rrr�)rrrrr
�test_split_unicodewhitespace�sz*BaseBytesTest.test_split_unicodewhitespacecCsV|jd�}|j|jd�dddddg�|j|jd�dddg�|j|jd	�|g�|jd
�}|j|jdd�d
dddg�|j|jddd�ddg�|j|jdddd�ddg�|j|jdddd�ddg�|jd�}|j|jdd�ddg�dS)Nsmississippir�r�ssssppr>smisippir�sa|b|c|dr�r�r�r�r�r�r�r'sa|b|csa b c dsa b c)rr�rsplit)rrrrr
�test_rsplit�s("(%((zBaseBytesTest.test_rsplitcCs0xzdD]r}|j|�}|j|j�ddg�|j|jd�ddg�|j|jdd	�ddg�qW|j|jd
�jdd�dg�|j|jd
�jdd
�ddg�|j|jd
�jdd	�dddg�|j|jd
�jdd�dddg�dS)N�
  arf  barf  �arf	barf�arf
barf�arf
barf�arfbarf�arfbarfsarfsbarfr-s  a  bb  c  rs
  a  bb  cr's  a  bbr�s  asbbrPr�)r�r�r�r�r�r�)rrr�)rrrrr
�test_rsplit_whitespaces
&(+.z$BaseBytesTest.test_rsplit_whitespacecCs#|jt|jd�jd�dS)Nsa br�)r0rHrr�)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_partitionszBaseBytesTest.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_pickling%s
zBaseBytesTest.test_picklingcCs*x#ttjd�D]}xdD]�}t|j|��}}t|j|��}tj||�}tj|�}|jt	|�t	|��|jt|�|�tj|�}yt
|�Wntk
r�w!YnXtj||�}tj|�}|jt|�|dd��q!WqWdS)Nr'r>r��abc��ab���)r>r�r�r�r�)r8r�r�r�rr7r�r�rr�next�
StopIteration)rr�r�itZitorg�data�drrr
�test_iterator_pickling-s 

z$BaseBytesTest.test_iterator_picklingcCs�|jd�}|j|jd�d�|j|jd�d�|j|jd�d�|j|jd�d	�|j|jd
�d�|j|j|�d�dS)
Nsmississippir�s
mississippr�s
ississippispismississsimsssissippspimsssissr>)rr�strip)rrrrr
�
test_strip@szBaseBytesTest.test_stripcCs�|jd�}|j|jd�d�|j|jd�d�|j|jd�d�|j|jd�d�|j|jd�d�dS)	Nsmississippir�r�s
ississippispisims	ssissippispim)rr�lstrip)rrrrr
�test_lstripIszBaseBytesTest.test_lstripcCs�|jd�}|j|jd�d�|j|jd�d�|j|jd�d�|j|jd�d�|j|jd�d�dS)	Nsmississippir�s
mississippr�spismississsimspim)rr�rstrip)rrrrr
�test_rstripQszBaseBytesTest.test_rstripcCsU|jd�}|j|j�d�|j|j�d�|j|j�d�dS)Ns 	

abc 	

sabcs	abc 	

s	 	

abc)rrrrr)rrrrr
�test_strip_whitespaceYsz#BaseBytesTest.test_strip_whitespacecCs||j|jd�jtd��d�|j|jd�jtd��d�|j|jd�jtd��d�dS)Nsabcsacr�sbcsab)rrrr�rr)rrrr
�test_strip_bytearray_s((z"BaseBytesTest.test_strip_bytearraycCsa|jt|jd�jd�|jt|jd�jd�|jt|jd�jd�dS)Nsabcr)r0rHrrrr)rrrr
�test_strip_string_errordsz%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_centeriszBaseBytesTest.test_centercCsU|jd�}x?ttfD]1}|j|jd|d��|jd��qWdS)Nsabcrcr	sabc----)rr�rMr�ljust)rrrrrr
�
test_ljustpszBaseBytesTest.test_ljustcCsU|jd�}x?ttfD]1}|j|jd|d��|jd��qWdS)Nsabcrcr	s----abc)rr�rMr�rjust)rrrrrr
�
test_rjustwszBaseBytesTest.test_rjustcsQ|jd��|j�fdd�tt���D�dddddg�dS)	NsA��cs*g|] }t�||d���qS)r')r[)r4r5)rrr
�
<listcomp>�s	z*BaseBytesTest.test_ord.<locals>.<listcomp>r�A��r;)rrr8r/)rr)rr
�test_ord~s(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_maketrans�s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_messagesN)>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�rrrrrrrrrrrrrrrrrr
r+sr
		
	+rc@s:eZdZeZdd�Zdd�Zdd�ZdS)�	BytesTestcCsMtjttj�}t|ddd��}|jt|jd�WdQXdS)N�rb�	bufferingrr>)�os�open�__file__�O_RDONLYr0rH�readinto)r�fdr�rrr
�test_buffer_is_readonly�sz!BytesTest.test_buffer_is_readonlycCs1Gdd�d�}|jt|��d�Gdd�d�}|jtt|��Gdd�d�}|jtt|��Gdd�d�}|jt|��d�Gdd�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>.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�r0rHZassertIsrr-�
BytesSubclass)rr+rrr
�test_custom�szBytesTest.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_moduler0r1r2r3r4�PyBytes_FromFormatZrestyperr[r0rC)rr1r2r3r4r8rrr
�test_from_format�s&"		%		zBytesTest.test_from_formatN)rrrr�rr)r/r9rrrr
r �sr c@sfeZdZeZdd�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 d9S):�
ByteArrayTestcCs|jttt��dS)N)r0rH�hashrM)rrrr
�test_nohashszByteArrayTest.test_nohashc*Cs9d}|ddt|�}tj�}z�t|d��}|j|�WdQXt|d��"}td�}|j|�}WdQX|j|t|��|jt|�t|��t|d��}|j|�WdQXt|d��}|j|j	�|�WdQXWdyt
j|�Wntk
r3YnXXdS)NsHello world
s��wbr!)
r/�tempfileZmktempr$�writerMr'rr7�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_reverse0s
	
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�assertIsNotrIr[)rrZbbrrr
r%JszByteArrayTest.test_copycCsJdd�}|d�}|jtjd|�|d�|d�g�dS)NcSsttt|��S)N)rMrZr[)rarrr
rb]sz&ByteArrayTest.test_regexps.<locals>.byzHello, worlds\w+rYrd)r�re�findall)rrbrrrr
�test_regexps\s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_setitembs@










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_delitem�szByteArrayTest.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��xddd dtd�ddddgddgggg	D],}|jt��||d
d�<WdQXq�WxIdddgd!dggD],}|jt��||d
d�<WdQXqWdS)"Nr*r'rr?r�rcrQr�r-rPrKr+�er,sfoo�f�ogP����KDrWgffffff@r#rr�r�r:r;r3i(#rgi����rurgi���)	rMr8rr7r�r�r0rHr<)rr�elemrrr
�
test_setslice�s6"%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'rPrir`rar,r.rbrc)r7r8rMr]r)rrnrorprqrmrr�rrr
�test_extended_set_del_slice�s


z)ByteArrayTest.test_extended_set_del_slicecCsXttd��}||dd�<|j|tttd��ttd����dS)Nr3rQ)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)rMrrQrHrO)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_1chars
z ByteArrayTest.test_irepeat_1charcCs�t�}|j�}|j|dk�|g}x\td�D]N}|d7}|j�}|j|t|��||kr>|j|�q>q>WdS)Nrr+r�)rM�	__alloc__rQr8�
assertGreaterr/rI)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/r^rirj)r5r#rk)rrrr
�gs)z(ByteArrayTest.test_init_alloc.<locals>.gr'r+�c)rMrrr7r8r/rirj)rrmrkr)rrr
�test_init_allocs		%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
r6/sz,ByteArrayTest.test_extend.<locals>.<genexpr>�2rr'r-r3r#r�rgrgrgr,)rMrYrrZr�r�r7r0r<r/rr[)r�origr#rrr
�test_extend&s2
  ""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�dS)Nshellorshelosheocs�jtd��S)Nr)rBr[r)rrr
r&Hsz+ByteArrayTest.test_remove.<locals>.<lambda>cs
�jd�S)Ni�)rBr)rrr
r&Iscs
�jd�S)N�e)rBr)rrr
r&Jsrr�ecs
�jd�S)Nru)rBr)rrr
r&Osrtr>)rMrBr[rr0r<rHr)rr)rr
�test_removeBszByteArrayTest.test_removecs�td��|j�j�td��|j�jd�td��|j�jd�td��|jt�fdd��|jtd	d��|jtd
�j�d�dS)
Nsworldr�rr�r-rGcs
�jd�S)Nr*)r[r)rrr
r&Xsz(ByteArrayTest.test_pop.<locals>.<lambda>cSs
t�j�S)N)rMr[rrrr
r&Yss�r;r.)rMrr[r[r0r1)rr)rr
�test_popSszByteArrayTest.test_popcCs|jtdd��dS)NcSs
t�j�S)N)rM�sortrrrr
r&^sz+ByteArrayTest.test_nosort.<locals>.<lambda>)r0�AttributeError)rrrr
�test_nosort]szByteArrayTest.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�)rIr)rrr
r&hsz+ByteArrayTest.test_append.<locals>.<lambda>�A)rMrIr[rr/r0rHr)rr)rr
�test_append`s		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&tsz+ByteArrayTest.test_insert.<locals>.<lambda>rr+r{r.)rMr~r[rr0rHr)rr)rr
�test_insertms	zByteArrayTest.test_insertcCsytd�}|j||jddd�k�tdd�td�D��}td�}|j||j|�k�dS)NsabcscdercSsg|]}|�qSrr)r4r5rrr
rs	z-ByteArrayTest.test_copied.<locals>.<listcomp>r3r>)rMrRr�r8�	translate)rr�tr�rrr
�test_copiedys
"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_nullstring�s$

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)rD)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�BufferErrorrr[rB)r�vr�rrr�r�r)rr
�test_resize_forbidden�s*
z#ByteArrayTest.test_resize_forbiddenN)!rrrrMrr<rErFrJr%rNrPrRrWrZr\r_rdrerfrgrhrlrorsrvrwrzr|rr�r�r�rrrr
r:s:"	(		


r:c@s�eZdZedd��Zdd�Zejjdd��Z	dd�Z
ed	d
��Zdd�Zd
d�Z
dd�Zdd�Zdd�Zdd�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�|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_doc�szAssortedBytesTest.test_doccCs>td�}t|�}t|�}|j|t|��dS)NsHello world
����)r�r�rMr)rrxZbufrrrr
�test_from_bytearray�s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)
Nshellorr3rtrrsheerushllo)rMr8r[r�rr0rH)rrZbaZrosettar�rrr
�test_translate	s z AssortedBytesTest.test_translatecCs)|jdjtd��ddg�dS)Nsa br�r�r�)rr�r�)rrrr
�test_split_bytearraysz&AssortedBytesTest.test_split_bytearraycCs)|jdjtd��ddg�dS)Nsa br�r�r�)rr�r�)rrrr
�test_rsplit_bytearraysz'AssortedBytesTest.test_rsplit_bytearraycCs,t�}|j|jdd�|k�dS)Nr>)rMrRr�)rrrrr
�test_return_self!s	z"AssortedBytesTest.test_return_selfcCs�tjjr�dd�}|��ddkWdQX|��ddkWdQX|��td�dkWdQX|��td�dkWdQXn
|jd�dS)NcSstjjdtf�S)Nr)rrrrrrrr
�
bytes_warning(sz5AssortedBytesTest.test_compare.<locals>.bytes_warningr>rz4BytesWarning is needed for this test: use -bb option)r(�flagsr�rMZskipTest)rr�rrr
rU&s



zAssortedBytesTest.test_compareN)rrrrr�r�rrZrequires_docstringsr�r�r�r�r�r�r�r�rUrrrr
r��s	
r�c@s(eZdZdd�Zdd�ZdS)�BytearrayPEP3137TestcCs
t|�S)N)rM)rr�rrr
�marshalFszBytearrayPEP3137Test.marshalcCs�|jd�}xSdD]K}t||�}|d�}|j||�|j||k	|d�qWxDdD]<}t|�}|j||�|j||k	|d�qlW|jd�}|j|g�}|j||�|j||�dS)Ns1234�zfillrr
r
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>)zzfillzrjustzljustzcenter)r�r�r�r�r�r�)r��getattrrrQr�r�rK)r�valZmethnamerZnewval�exprr�rrr
�test_returns_new_copyIs$

z*BytearrayPEP3137Test.test_returns_new_copyN)rrrr�r�rrrr
r�Dsr�csReZdZ�fdd�Zdd�Zdd�Zdd�Zd	d
�Z�S)�FixedStringTestcs,t|t�r|jd�St�j|�S)Nzutf-8)�
isinstancerWrv�super�fixtype)r�obj)rrr
r�bs
zFixedStringTest.fixtypecCsdS)Nr)rrrr
r�jszFixedStringTest.test_containscCsdS)Nr)rrrr
�test_expandtabslszFixedStringTest.test_expandtabscCsdS)Nr)rrrr
�
test_uppernszFixedStringTest.test_uppercCsdS)Nr)rrrr
�
test_lowerpszFixedStringTest.test_lower)rrrr�r�r�r�r�rr)rr
r�`s
r�c@seZdZeZdZdS)�ByteArrayAsStringTestTN)rrrrMr�contains_bytesrrrr
r�ssr�c@seZdZeZdZdS)�BytesAsStringTestTN)rrrr�rr�rrrr
r�wsr�c@s@eZdZdd�Zdd�Zdd�Zdd�Zd	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�
issubclass�
subclass2testrZassertIsInstancer)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)r�rr�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')r�r��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)	r�r�r�r!r"r�r�rr)rr#r$rrrr
r%�s	zSubclassTest.test_copyN)rrrr�r�r�r%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)rrrrMrr�r�r�rrrr
r��sr�c@seZdZeZeZdS)�BytesSubclassTestN)rrrr�rr.r�rrrr
r��sr��__main__)*r�r#rLr(r!rr�r?ZunittestZtest.supportrZtest.string_testsZtest.buffer_testsrrr�r�rrrZTestCaser r:r�Zbuffer_testsZMixinBytesBufferCommonTestsr�Zstring_testsZBaseTestr�r�r�r�rMr�r�r.r-r�r�r�mainrrrr
�<module>sH���>���B