Your IP : 216.73.216.213


Current Path : /opt/alt/python34/lib64/python3.4/test/__pycache__/
Upload File :
Current File : //opt/alt/python34/lib64/python3.4/test/__pycache__/string_tests.cpython-34.pyo

�
f f���@s�dZddlZddlZddlZddlZddlmZddlmZGdd�d�Z	Gdd�de	�Z
Gd	d
�d
e	�ZGdd�d�ZGd
d�de�Z
Gdd�d�ZGdd�d�ZdS)zG
Common tests shared by test_unicode, test_userstring and test_string.
�N)�support)�UserListc@s7eZdZddd�Zdd�Zdd�ZdS)	�SequenceZwxyzcCs
||_dS)N)�seq)�selfr�r�6/opt/alt/python34/lib64/python3.4/test/string_tests.py�__init__
szSequence.__init__cCs
t|j�S)N)�lenr)rrrr�__len__szSequence.__len__cCs|j|S)N)r)r�irrr�__getitem__szSequence.__getitem__N)�__name__�
__module__�__qualname__r	rr
rrrrr	src@s(eZdZdd�Zdd�ZdS)�BadSeq1cCsdddg|_dS)N��hello�{)r)rrrrr	szBadSeq1.__init__cCsdj|j�S)Nz{0} {1} {2})�formatr)rrrr�__str__szBadSeq1.__str__N)rrrr	rrrrrrsrc@s(eZdZdd�Zdd�ZdS)�BadSeq2cCsdddg|_dS)N�a�b�c)r)rrrrr	szBadSeq2.__init__cCsdS)N�r)rrrrrszBadSeq2.__len__N)rrrr	rrrrrrsrc@seZdZdZdZdd�Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd �Zejejd(kp�ejd#�d$kd%�d&d'��ZdS))�BaseTestNFcs�t|t�r�jj|�St|t�rE�fdd�|D�St|t�rqt�fdd�|D��St|t�r�t�fdd�|j�D��S|SdS)Ncsg|]}�j|��qSr)�fixtype)�.0�x)rrr�
<listcomp>+s	z$BaseTest.fixtype.<locals>.<listcomp>csg|]}�j|��qSr)r)rr)rrrr -s	cs4g|]*\}}�j|��j|�f�qSr)r)r�key�value)rrrr 0s	)�
isinstance�str�	__class__�	type2test�list�tuple�dict�items)r�objr)rrr'szBaseTest.fixtypecs��j|�}�j|�}�j|�}�fdd�|j�D�}t||�||�}�j||�||kr�y Gdd�d�jj�}Wntk
r�Yq�X||�}t||�|�}�j||�ndS)Ncs(i|]\}}�j|�|�qSr)r)r�k�v)rrr�
<dictcomp>;s	z'BaseTest.checkequal.<locals>.<dictcomp>c@seZdZdS)z$BaseTest.checkequal.<locals>.subtypeN)rrrrrrr�subtypeEsr/)rr*�getattr�assertEqualr%r&�	TypeError�assertIsNot)r�resultr+�
methodname�args�kwargsZ
realresultr/r)rr�
checkequal7s  
zBaseTest.checkequalc
Gsf|j|�}|j|�}|j|��}t||�|�WdQX|jt|j�d�dS)N�)r�assertRaisesr0ZassertNotEqualr$Z	exception)r�excr+r5r6�cmrrr�checkraisesOs
zBaseTest.checkraisescGs5|j|�}|j|�}t||�|�dS)N)rr0)rr+r5r6rrr�	checkcallWszBaseTest.checkcallc
	s|�jdddd��jdddd��jdddd��jdddd��jdddd��jdddd��jdddd��jddddd��jddddd	��jddddd��jddddd��jdddddd��jdddddd	��jdddddd��jdddddd��jdddd
d��jdddd
d��jdddd
d	��jdddd
d��jdddd
d��jdd
dd
��jdd
dd
dd��jdd
dd
tjd��jdd
dd��jdd
dddd��jdd
ddtjd��jtd
d��jr��jdd
dd�n�jtd
dd�d
ddg}d}t|�}t�}xqt||�D]_}g}x:t|�D],}t	||�\}}|j
||�q,W|jd
j|��qW�fdd�|D�}x�|D]�}t|�}	x�|D]�}|j
|�}
|rt	|	t|j|�jd
���t|��\}}nt|�dd}}|s0|
|kr��j|dd||f��j|
|d|
||f�q�q�Wq�WdS)N��aaa�countrrr���
r9��xxr�*rcsg|]}�j|��qSr)r)r�ts)rrrr �s	z'BaseTest.test_count.<locals>.<listcomp>z%s != 0 for %sz%s != %s for %s���i����rIi����rIi����)r8�sys�maxsizer=r2�contains_bytesr
�set�range�divmod�append�add�joinrA�replacerr1)
r�charset�digits�base�teststringsr�entry�j�m�n�r1�r2Zremr)rr�
test_count\sh		

%zBaseTest.test_countcsp�jdddd��jddddd��jddddd��jdddd	d��jd
ddd	d
��jdddd	d��jdddd
��jdddd
d��jdddd
dd��jdddd
dd��jdddd
dd��jtdd��jrK�jdddd�n�jtddd��jdd	dd	��jdd	dd	dd��jdd	dd	tjd��jd d	dd��jd!d	dddd��jd"d	ddtjd��jd#dddtjdd�d	d
ddg}d}t|�}t�}xqt||�D]_}g}x:t|�D],}t	||�\}}|j
||�q}W|jd	j|��qdW�fdd�|D�}x�|D]�}xx|D]p}|j
|�}	|	d$k}
||k}�j|
|�|	d%kr��j||	|	t|��|�q�q�Wq�WdS)&Nr�abcdefghiabc�find�abc�	rC�defrEr9r?rB�
rrarrrrrrrrrar��rrGrF�ab�xxxrr�csg|]}�j|��qSr)r)rrH)rrrr �s	z&BaseTest.test_find.<locals>.<listcomp>rIrIrIrIrIrIrIrIrIrIrIrI)r8r=r2rLrJrKr
rMrNrOrPrQrRr`r1)rrTrUrVrWrrXrYrZ�locr\r]r)rr�	test_find�sR	#	

zBaseTest.test_findcs��jdddd��jdddd��jdddd��jdddd
��jddddd��jddddd��jddddd��jdd
dd��jdd
ddd��jdd
dddd��jdd
dddd��jdd
dddd��jtdd��jr[�jdddd�n�jtddd�ddddg}d}t|�}t�}xqt||�D]_}g}x:t|�D],}t||�\}}|j||�q�W|j	dj
|��q�W�fdd�|D�}x�|D]�}xx|D]p}|j|�}	|	d k}
||k}�j|
|�|	d!kr?�j||	|	t|��|�q?q?Wq2W�jd"dddt
jd	d��jdddd�dS)#Nrbr_�rfindrarer9r�abcdrCZabczr?rErdrrfrBrrGrrricsg|]}�j|��qSr)r)rrH)rrrr �s	z'BaseTest.test_rfind.<locals>.<listcomp>rgrhu<......м...�<rIrIrIrIrIrIrI)r8r=r2rLr
rMrNrOrPrQrRrlr1rJrK)rrTrUrVrWrrXrYrZrjr\r]r)rr�
test_rfind�sJ		

/#zBaseTest.test_rfindcCs�|jdddd�|jdddd�|jdddd�|jddddd	�|jtddd
�|jtdddd	�|jtddd
d�|jtddd
d�|jdddd�|jddddd�|jtddddd�|jdddddd�|jdddddd�|jtdd�|jrt|jtddd�n|jtddd�dS)Nrr_�indexr9r?rcrarbrC�hibZabcdefghiab�	abcdefghi�ghirrBrdrrerErfrrGrI)r8r=�
ValueErrorr2rL)rrrr�
test_index
s"	zBaseTest.test_indexcCs�|jdddd�|jdddd�|jdddd�|jd	dddd	d�|jtddd�|jtdddd
�|jtdddd	d�|jtd
ddd	d�|jtd
ddd	d�|jdddd�|jddddd�|jtddddd�|jdddddd�|jdddddd�|jtdd�|jr�|jtddd�n|jtddd�dS)Nrer_�rindexr9r?rcrbrarrCrqZ	defghiabcrrrsrrdrrErfrBrrGrIrIrI)r8r=rtr2rL)rrrr�test_rindex#s$	zBaseTest.test_rindexcCs@|jddd�|jddd�|jtddd�dS)Nr�HeLLo�lowerrG)r8r=r2)rrrr�
test_lower=szBaseTest.test_lowercCs@|jddd�|jddd�|jtddd�dS)NZHELLOrx�upperrrG)r8r=r2)rrrr�
test_upperBszBaseTest.test_uppercCs9|jddd�|jdddd�|jdddd�|jddd�|jdddd�|jd	ddd�|jd
d
dd�|jddddd�|jddddd�|jdd
dd�|jtdddd�tjdkr5tjd�dkr5|jtddtj�ndS)Nzabc
ab      def
g       hizabc
ab	def
g	hi�
expandtabsrzabc
ab  def
g   hirEzabc
ab      def
g       hizabc
ab	def
g	hizabc
ab  def
g   hizabc
ab
def
g
hi�tabsizez  a
 bz 	a
	brCrrG� �Pz	a
	bl)r8r=r2rJrK�struct�calcsize�
OverflowError)rrrr�test_expandtabsGs.






$	zBaseTest.test_expandtabscCs�|jddddgddd�|jdgdddd�|jdd	gdddd
�|jdddgdddd�|jddddgdddd
�|jddddgdddd�|jddddgdddtjd�|jdgdddd�|jdddgdddd�|jddgddd�|jddgddd�|jdddgddd�|jdddgdddd�|jdgdddddG�dd�|jdgddgddddH�ddd�|jddddgddd �|jdd!gddd d
�|jddd"gddd d�|jddddgddd d
�|jddddgddd d�|jddddgddd tjd#�|jdgddd d�|jddd$gd%dd d�|jddgd&dd'�|jdd(gd)dd'�|jdd*dgd+dd'�|jdd,gd-dd.�|jddgd/dd/�|jd/gd/dd/d�|jd0d0gd1dd2�|jd3gd3dd4�|jdgddd/�|jd5gd5dd/�|jd6d7gd8dd9�|jd6d:dgd;dd9�|jdgdd<dddI�dd=�|jdgdd<dddJ�dd=d>�|jdgd?d@gd<dddK�dd=d?�|jddddgdddAd�|jdd	gddddBd
�|jdd	gdddAddBd
�|jdd	gdddBd
dAd�|jddCgdDddBd
�|jtdEddFdFdF�|jtdEdd�|jtdEddd�dS)LNrrr�dza|b|c|d�split�|rzb|c|drCzc|drBr?rEr9zb||c||dz
a||b||c||dzendcase z	endcase |z
 startcasez| startcase�bothcasez
|bothcase|Zbcd�abcd��za|�z	a|a|a|a|az
a//b//c//dz//zb//c//dzc//drDzb////c////dza////b////c////dzendcase test�testz
 begincaseztest begincasez
 bothcase ztest bothcase test�bc�abbbc�bbr@rg�abbaab�ba�aaaa�aab�aa�AZbobbZ
Abbobbbobb�bbobb�BZAbbobbBbbobb�aBLAH�BLAH���aBLAHa�sep�maxsplitzb c dza b c drrGrIrI���r�r�)r8rJrKr=r2rt)rrrr�
test_splitdsn""%%""+""%%"
+.(
%zBaseTest.test_splitcCs�|jddddgddd�|jddgdddd	�|jd
ddgdddd�|jddddgdddd�|jddddgdddd
�|jddddgdddtjd�|jdgdddd�|jdddgdddd�|jddgddd�|jddgddd�|jdddgddd�|jdddgdddd�|jdgdddddF�dd�|jdgdgdddddG�ddd�|jddddgd dd!�|jd"dgd dd!d	�|jd#ddgd dd!d�|jddddgd dd!d�|jddddgd dd!d
�|jddddgd dd!tjd$�|jd gd dd!d�|jd%ddgd&dd!d�|jddgd'dd(�|jddgd)dd(�|jdd*dgd+dd(�|jd,dgd-dd.�|jddgd/dd/�|jd/gd/dd/d�|jd,d,gd0dd1�|jd2gd2dd3�|jdgddd/�|jd4gd4dd/�|jd5d6gd7dd8�|jdd9d6gd:dd8�|jdgdd;dddH�dd<�|jdgdd;dddI�dd<d=�|jd>gdgd?d;dddJ�dd<d?�|jddddgddd@d�|jddgddddAd	�|jddgddd@ddAd	�|jddgdddAd	d@d�|jdBdgdCddAd	�|jtdDddEdEdE�|jtdDdd�|jtdDddd�dS)KNrrrr�za|b|c|d�rsplitr�za|b|crCza|brBr?rE�drza||b||cr9z
a||b||c||dz
 begincasez| begincasezendcase z	endcase |r�z
|bothcase|Zabr�r�r�za|z	a|a|a|a|ar�z
a//b//c//dz//za//b//cza//briza////b////cza////b////c////dztest begincaser�zendcase testz
 bothcase ztest bothcase testrgr�r�r@r�r�r�r�r�Zbbobr�Z
bbobbbobbAr�r�ZbbobbBbbobbAr�r�r�r�r�r�r�za b cza b c drrGrIrIr�r�r�)r8rJrKr=r2rt)rrrr�test_rsplit�sl""%%""+""%%"
+.(
%zBaseTest.test_rsplitcCs\|j}|ddddd�|ddddd�|ddddd�|ddddd�|dddddd�|dddddtj�|ddddd�|ddddd�|ddddd�|d	dddd
�|ddddd
�|ddddd
d��|ddddd
tj�|ddddd
d�|ddddd
d�|ddddd
d�|ddddd
d�|ddddd
d�|ddddd�|ddddd�|dddddd��|dddddtj�|dddddd�|dddddd�|dddddd�|dddddd�|dddddd�|ddddd�|ddddd�|dddddd��|dddddtj�|dddddd�|dddddd�|dddddd�|dddddd�|dddddd�|dddddd�|ddddd�|ddddd�|ddddd�|ddddd�|d d!dd"d!dddd#�|dd$dd$d�|d%d&dd$d�|dd'dd$d�|dd(dd$d�|d)d*dd$d�|d+d+dd$d�|d,d,dd$d�|d-d.dd$d�|d/d0dd$dtj�|d/d0dd$dd��|d/d0dd$dd�|d/d0dd$dd�|d1d0dd$dd�|d0d0dd$dd�|d/d0dd$d�|d2d2dd$d�|d3d3dd$d�|d4d5dd4d�|d6d7dd4d�|d8d9dd4d�|d8d8dd4d�|d:d:dd;d;�|d<d:dd;d=�|d<d:dd;d=tj�|d<d:dd;d=d��|d<d:dd;d=d�|d<d:dd;d=d�|d>d:dd;d=d�|d:d:dd;d=d�|d:d:dd?d@�|dAd:ddBdC�|dDdEddBdC�|dFd:ddGdH�|dIdJddGdH�|d:d:ddKdH�|dLdMddNdO�|dLdMddNdOtj�|dLdMddNdOd��|dLdMddNdOd�|dLdMddNdOd�|dPdMddNdOd�|dQdMddNdOd�|dMdMddNdOd�|dRdSdd4dT�|dUdVdd4dT�|dSdSddWdW�|dXdYddZd[�|dXdYddZd[d��|dXdYddZd[tj�|dXdYddZd[d�|d\dYddZd[d�|dYdYddZd[d�|d]d^ddKd_�|d`daddbdc�|dYdYdd@d[�|dddeddfdg�|dddeddfdgtj�|dddeddfdgd��|dddeddfdgd�|dddeddfdgd�|dhdeddfdgd�|dideddfdgd�|dededdfdgd�|dSdjddSd4�|dkdlddSd4�|dmdmdd4dn�|jdodpddHdqd�|jdrdpddHd�|jdsdpddHdqd�|jdtdpddHdqd�|jdtdpddHdqd�|jdpdpddHdqd�|jdtdpddHdq�|jdpdpddudq�|jdpdpddudqd�|jdvd2dddw�|jdxd2dddwd�|jd2d2dddwd�|jddddd�|jd2d2ddydzd�|jd2d2dd{dz�|jdd|dd|d�|jdd}dd|d�|jdud~dd|d�|jtdd�|jtddd��|jtddd�d��|jtddd�d��dS)�Nr9rSr�r�z*A*�*z*1A*1z*1z*-#A*-#z*-#z*-A*-A*-�AAz*-rCrEr?z*-A*-ArBz*-AArZAAAZ
AAAAAAAAAAZBCDZABACADAriZBCDAZBCADAZBACADAZABCADZABCADAAz
*************z^A^�^i�i��theZaterZtheaterZthetheZthethethether�ZtheatheatheatheaZthatZthaetzhere and rezhere and therezhere and re and rezhere and there and therezhere and re and thereraZabcdefgZbobZbbobobZbobXbobZ
bbobobXbbobobZaaaaaaaZ
aaaaaaabobzWho goes there?�ozWhO gOes there?�OzWhO goes there?r�qzwho goes there?�W�wzwwho goes there?wwzWWho goes there?WWzWho goes there!�?�!zWho goes there!!zWho goes there??�.zTh** ** a t**suezThis is a tissue�isz**zTh** ** a tissuezTh** is a tissueZcobobZbobobZcobZ
cobobXcobocobZ
bobobXbobobobZbotZReyKKjaviKKZ	Reykjavikr,ZKKZ
ReyKKjavikzA----B----C----zA.B.C.z----u...м......&lt;u...м......<rnz&lt;zham, ham, eggs and hamzspam, spam, eggs and spamZspamZhamzham, ham, eggs and spamzham, spam, eggs and spamZbobobobZbobobXbobobZbobobobXbobobobZBOBOBOBZbobbyzone@two!three!zone!two!three!�@Zonetwothreezone@two@three!zone@two@three@rz-a-b-c-�-z-a-b-crgz--Zxy�123Z123123Z123x123rrG�hrIrIrIrIrIrIrIrI)r8rJrKr=r2)rZEQrrr�test_replace�s"	%							
							
zBaseTest.test_replacerCrr�rEz only applies to 32-bit platformscCs]dd}|jt|dd|�|jt|dd|�|jt|dd||�dS)Nr�rB�rSr9r�i)r=r�)rZA2_16rrr�test_replace_overflow�s
zBaseTest.test_replace_overflowl)rrrr&rLrr8r=r>r^rkrorurwrzr|r�r�r�r��unittestZskipIfrJrKr�r�r�rrrrrs&@95DD�'rc@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�ZdS)�
CommonTestcCsc|jd�}|jd�}x"|D]}||7}t|�q%W|jt|�t|��dS)NZDNSSECr9)r&�hashr1)rrrrrrr�	test_hash�s

zCommonTest.test_hashcCs�|jddd�|jddd�|jddd�|jddd�|jddd�|jdd	d�|jd
dd�|jd
dd�|jd
dd�|jd
dd�|jddd�|jtddd�dS)Nz hello �
capitalizezHello zhello ZAaaar�ZAaAau
ΩΙῳῳῳuῳῳῼῼuⓅⓨⓣⓗⓞⓝuⓅⓎⓉⒽⓄⓃuⓟⓨⓣⓗⓞⓝu	Ⅰⅱⅲu	ⅠⅡⅢu	ⅰⅱⅲu
ƛᴀᶆȡᾷrrG)r8r=r2)rrrr�test_capitalize�s$	
	
	
	
	
	
zCommonTest.test_capitalizecCs�|jdddddgdd�|jddd	d
gdd�|jddgd
ddd�|jdddgd
ddd�|jddd	d
gd
ddd�|jddd	d
gd
ddd�|jddd	d
gd
ddtjd�|jd
gd
ddd�|jd
gdddd�|jdddgdddd�|jgdd�|jdgdd�|jddgdd�|jddgdddd�|jddgdddd�|jdddgdddd�|jddgdd�dd }|jdgd |d�|jdg|dd�g|ddd�|jdgd!d"g|ddd!�|jdddgd
dd#d�dS)$N�thisr�r�r��functionzthis is the split functionrrrr�za b c d zb c dza b c drCzc drBr?rErz	  a b c dzc  dz
a  b  c  dz	         z  a    z  a    b   zb   zb   c   z  a    b   c   zc   z
	a 	
 b  z a r�r�za � )r8rJrK)rr@rrr�test_additional_split�s0
"%%""
-'z CommonTest.test_additional_splitcCs�|jdddddgdd�|jddd	d
gdd�|jdd
gd
ddd�|jdd	d
gd
ddd�|jddd	d
gd
ddd�|jddd	d
gd
ddd�|jddd	d
gd
ddtjd�|jd
gd
ddd�|jd
gdddd�|jdd	d
gdddd�|jgdd�|jdgdd�|jddgdd�|jddgdddd�|jdd	gdddd�|jddd	gdddd�|jddgdddd�d d}|jdgd|d�|j|dd$�gdg|ddd�|jd!gdgd"|ddd"�|jdd	d
gd
dd#d�dS)%Nr�r�r�r�r�zthis is the rsplit functionrrrr�za b c d za b cza b c drCza brBr?rEr�rz	a b c d  za  bz
a  b  c  dz	         z  a    z  a    b   z  az  a    bz  a    b   c   z
	a 	
 b  �Xz a z a  ar�r�r�)r8rJrK)rr@rrr�test_additional_rsplit�s4
"%%"


-'z!CommonTest.test_additional_rsplitcCsK|jddd�|jddd�|jddd�|jddd�|jdddd�|jdddd�|jdddd�|jdddd�|jdddd	�|jd
ddd	�|jdddd	�|jdddd	�|jtdddd�|jtdddd�|jtdddd�dS)
Nrz   hello   �stripzhello   �lstripz   hello�rstripZxyzzyhelloxyzzyZxyzZ
helloxyzzyZ
xyzzyhellorG)r8r=r2)rrrr�
test_stripszCommonTest.test_stripcCs�|jdddd�|jdddd�|jdddd�|jdddd�|jd	dddd
�|jtdd�dS)Nz
abc       ra�ljustrDzabc   rfr?rBz
abc*******r�)r8r=r2)rrrr�
test_ljust-szCommonTest.test_ljustcCs�|jdddd�|jdddd�|jdddd�|jdddd�|jd	dddd
�|jtdd�dS)Nz
       abcra�rjustrDz   abcrfr?rBz
*******abcr�)r8r=r2)rrrr�
test_rjust5szCommonTest.test_rjustcCs�|jdddd�|jdddd�|jdddd�|jdddd�|jd	dddd
�|jtdd�dS)Nz
   abc    ra�centerrDz abc  rfr?rBz
***abc****r�)r8r=r2)rrrr�test_center=szCommonTest.test_centercCs-|jddd�|jtddd�dS)NzhEllO CoMPuTErSzHeLLo cOmpUteRs�swapcaserrG)r8r=r2)rrrr�
test_swapcaseEszCommonTest.test_swapcasecCs|jdddd�|jdddd�|jdddd�|jdddd�|jdddd�|jdddd	�|jd
d
dd�|jd
d
dd�|jdd
dd	�|jdd
dd�|jdddd�|jdddd�|jtdd�dS)Nr��zfillrBr?Z0123rEz+123z+0123riz-123z-0123Z000r9Z34rCZ0034)r8r=r2)rrrr�
test_zfillJszCommonTest.test_zfillN)
rrrr�r�r�r�r�r�r�r�r�r�rrrrr��s	!r�c@sEeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zejd%d&��Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3S)4�MixinStrUnicodeUserStringTestcCs�|jddd�|jddd�|jddd�|jddd�|jddd�|jdd	d�|jdd
d�|jtddd�dS)NFr9�islowerTrr��
raZaBczabc
rG)r8r=r2)rrrr�test_islower_sz*MixinStrUnicodeUserStringTest.test_islowercCs�|jddd�|jddd�|jddd�|jddd�|jddd�|jdd	d�|jdd
d�|jtddd�dS)
NFr9�isupperrTr�r��ABCZAbCzABC
rarG)r8r=r2)rrrr�test_isupperisz*MixinStrUnicodeUserStringTest.test_isuppercCs�|jddd�|jddd�|jddd�|jddd�|jddd�|jdd	d�|jdd
d�|jddd�|jddd�|jdd
d�|jddd�|jtddd�dS)NFr9�istitlerTr�r�zA Titlecased LinezA
Titlecased LinezA Titlecased, LinezNot a capitalized StringzNot	a Titlecase StringzNot--a Titlecase StringZNOTrarG)r8r=r2)rrrr�test_istitlessz*MixinStrUnicodeUserStringTest.test_istitlecCs�|jddd�|jddd�|jddd�|jddd�|jddd�|jdd	d�|jdd
d�|jddd�|jtddd
�dS)NFr9�isspacerTr��	�
r�z 	
z 	
ararG)r8r=r2)rrrr�test_isspace�sz*MixinStrUnicodeUserStringTest.test_isspacecCs�|jddd�|jddd�|jddd�|jddd�|jddd�|jdd	d�|jdd
d�|jtddd�dS)NFr9�isalphaTrr�r�raZaBc123zabc
rG)r8r=r2)rrrr�test_isalpha�sz*MixinStrUnicodeUserStringTest.test_isalphacCs�|jddd�|jddd�|jddd�|jddd�|jddd�|jdd	d�|jdd
d�|jddd�|jtddd
�dS)NFr9�isalnumTrr�r�Z	123abc456Za1b3czaBc000 zabc
rarG)r8r=r2)rrrr�test_isalnum�sz*MixinStrUnicodeUserStringTest.test_isalnumcCsy|jddd�|jddd�|jddd�|jddd�|jddd�|jtd	dd
�dS)NFr9�isdigitrT�0�
0123456789Z0123456789ararG)r8r=r2)rrrr�test_isdigit�sz*MixinStrUnicodeUserStringTest.test_isdigitcCs�|jddd�|jddd�|jddd�|jddd�|jdd	d�|jd
dd�|jtddd
�dS)Nz Hello z hello �titlezHello zhello zFormat This As Title StringzfOrMaT thIs aS titLe StringzFormat,This-As*Title;StringzfOrMaT,thIs-aS*titLe;StringZGetintZgetIntrrG)r8r=r2)rrrr�
test_title�sz(MixinStrUnicodeUserStringTest.test_titlecCsn|jddddgdd�|jddddgdd�|jdddgdd�|jdddgd	d�|jddddgd
d�|jdddddgdd�|jdddddgddd�|jd
ddddgddd�|jdddddgdddd�|jd
ddddgdddd�|jtdddd�dS)Nrarcr9rszabc
def

ghi�
splitlinesz
abc
def

ghizabc
def
ghiz
abc
def
ghi
zabc
def
ghi

z
abc
def
ghi

Fr�zabc
zdef
zghi
r�T�keependsrG)r8r=r2)rrrr�test_splitlines�s"


z-MixinStrUnicodeUserStringTest.test_splitlinescCsf|jdddd�|jdddd�|jdddd�|jdddd�|jdddd�|jddddd	�|jdddd
d�|jdddd
d�|jddddd�|jdddd
d�|jddddd�|jdddddd�|jdddddd�|jdddddd�|jddddd d!�|jdddddd"�|jddddd#d$�|jddddd%�|jddddd&�|jdddd
d'�|jdddd
d(�|jddddd)d*�|jdddd
d+�|jtdd�|jtddd�|jdddd,�|jdddd-�|jdddd.�|jdddf�|jdddd/d�|jdddd0d�|jdddd1dd2�|jdddd3dd	�|jdddd4dd�|jtddd5�dS)6NTr�
startswith�heFzhello worldr9�ellorCr�rEri�lorf�
helloworld�lowor?rr�5rDrBrbrG�ha�llo�hellox�hellowo�rld�helrIi���rIrIrIi�������r����rI���r�i����)r�r�)�lor�)r�zhello)r�r�r�)r�r�r�)r�r�rI)r�r�)r�r�)rG)r8r=r2)rrrr�test_startswith�sJ

z-MixinStrUnicodeUserStringTest.test_startswithcCs�|jdddd�|jdddd�|jdddd�|jdddd�|jdd	dd
�|jdd	dd
dd�|jdd	dd
dd�|jdd	dddd�|jdd	dddd�|jdd	dddd�|jdd	dddd�|jdd	dddd�|jdddddd�|jdddddd�|jddddd%�|jddddd&�|jddddd'd(�|jddddd)d*�|jdd	dd
d+�|jdd	dd
d,d-�|jdd	dd
d.d�|jdd	dd
d/d�|jdd	ddd0d1�|jdd	ddd2d3�|jdd	ddd4d5�|jdd	dddd6�|jdd	ddd7d8�|jtdd�|jtddd�|jdddd9�|jdddd:�|jdddd;�|jdddf�|jdd	dd<d�|jdd	dd=dd>�|jdddd?dd@�|jddddAdd�|jddddBdd�|jtdddC�dS)DNTr�endswithr�Fr�r9zhello worldr�Zworlr?rbZworldrer�rCrrBrErrgrrDrfri�crGr�r�r�r�r�r��hell�ellr�r�r�r�r�i����r�i����r�rIr�i����i����r�i����r�i����r�r�i����r�)�hezha)zlozllo)zhelloxzhello)�hellowo�rldzlowo)rzellorrI)rrrI)rzhel)rr)rG)r8r=r2)rrrr�
test_endswith�sR

z+MixinStrUnicodeUserStringTest.test_endswithcCs�|jdddd�|jdddd�|jdddd�|jdddd�|jdddd�|jdddd	�|jdd
dd
�|jdddd
�|jdddd
�dS)NTr9�__contains__raFr�ZabcZabcrZasdfZasd)r8)rrrr�test___contains__#sz/MixinStrUnicodeUserStringTest.test___contains__cCs�|jdddd�|jdddd�|jdddd�|jdddtdd��|jdddtdd��|jdddtdd��|jd	ddtdd��|jtddd
�dS)Nrrar
rrrCr?i�r9rcrI)r8�slicer=r2)rrrr�test_subscript.sz,MixinStrUnicodeUserStringTest.test_subscriptcCs1|jdddtdd��|jdddtdd��|jdddtdd��|jdddtd	d��|jd
ddtd	d��|jdddtdd��|jdddtdd��|jdddtdd��|jdddtdd	��|jtddd
�dS)Nrar
ri�r?rgrBr�rCrr9i�rc)r8r	r=r2)rrrr�
test_slice9sz(MixinStrUnicodeUserStringTest.test_slicecCs�tjtj}d}x~|D]v}xm|D]e}x\|dd�D]J}t|�|||�}|jdj|�|dt|||��qAWq*WqWdS)
NrrCr?�)rB�%r9r
rIr�����)rNrCr?rrIr�r)�stringZ
ascii_lettersrUr'r8rRr	)r�s�indices�start�stop�step�Lrrr�test_extended_getsliceFs

z4MixinStrUnicodeUserStringTest.test_extended_getslicecCs�|jdddd�|jdddd�|jdddd�|jdddd�|jtdd�|jtddd�dS)	Nr9ra�__mul__rCrZ	abcabcabcr?rI)r8r=r2)rrrr�test_mulRsz&MixinStrUnicodeUserStringTest.test_mulcCsv|jdddddddg�|jdd	dd�|jd
d	dd �|jdd	dd!�|jdddt��|jd
ddd"�|jdddtdg��|jddddddg�|jtdjdddg�x�dddgD]t}|jd|d|dd#�ddd|g|�|jd|d|dd$�ddd|f|�qW|jdddt��|jtdd�|jtddd�|jtddd�|jtddddt�g�y)dd�}|j	d�j|��WnGtk
rd}z'dt
|�krR|jd�nWYdd}~XnX|jd�dS)%Nza b c dr�rRrrrr�rmr9ZbdZaczw x y zra�zza.b.cr�r?ri��}r�rCza b crrBcss
ddVdS)NrEr9rrrrr�fxsz2MixinStrUnicodeUserStringTest.test_join.<locals>.f�+zjoin() ate exception messagezexception not raised)rrrr�)r9rr9r�)rr9rr9)zabcrIrI)r8rrr:r2rRrr=�bytesrr$�fail)rrr�errr�	test_join]s4"%%"#z'MixinStrUnicodeUserStringTest.test_joinc
Csn|jdddd�|jdddd�|jdd	dd�|jdd	dd�|jd
d	dd�|jdd	dd
�|jdddd�|jdd	dd�x*d9D]"}|jttfd	d|�q�Wtjd}t|�}|jdddd�|jdddd�|j|dd|�|jddt|��|jdddd�|jdddd�|jt	dd�|jt	ddd�|jt	ddd:�|j
t��|jt	d	dd;�WdQX|jtddi�|jt	d dd<�|jt	ddd�|jt	ddd=�|jd#d$did#d%6�|jd&dd'd(dd&d�|jt	d)dd>�|jt	d*dd?�|jtd+dd@�|jtd,dAdd/�|jtd0dBdd/�|jtd)dtjd1d2f�|jtd3dtjd1dCf�Gd6d7�d7t�}|jt	dd|��dS)DNz+hello+z+%s+�__mod__rz+10+z+%d+rDrz%c�"�"�$�$Z10z%d��r�� z 42z%3ldrGZ42�E@z0042.00z%07.2fz%07.2Fraz%(foo)sz%s%sz%(fooz%(foo)s %(bar)s�fooy�barz	%((foo))sz(foo)�grz%sxz%*sz%10.*fz%10z%%%dfrB�@g������	@z%%.%dfrCr9z%.*fg�?rc@seZdZdS)z8MixinStrUnicodeUserStringTest.test_formatting.<locals>.XN)rrrrrrr�X�sr/���)r0r))rG)N)r+rGyE@)r+r,)r+r*)rGllg�$I�$I�?)
r8r=rtr�rJrKr$r>�floatr2ZassertWarns�DeprecationWarning�object)rZordinalZ	longvalueZ
slongvaluer/rrr�test_formatting�sP
 
"z-MixinStrUnicodeUserStringTest.test_formattingcCs�ddlm}m}m}d|j�d>d}|jtdd|ddf�|jtdd|dd
f�|jtdd|ddf�|jtdd|ddf�dS)Nr)�PY_SSIZE_T_MAX�INT_MAX�UINT_MAXrCz%*sr"r9z%.*fg�?rg�$I�$I�?g�$I�$I�?)Z	_testcapir5r6r7�
bit_lengthr=r�)rr5r6r7ZSIZE_MAXrrr�test_formatting_c_limits�sz6MixinStrUnicodeUserStringTest.test_formatting_c_limitscCsgx`td�D]R}d|}d}x9td�D]+}|ddd}|j|d|�q0Wq
WdS)	Nr�z%%.%ifg{�G�z�?�<g�.DT�!	@g@g$@r")rNr>)rZprecrr"rrrr�test_floatformatting�s
z2MixinStrUnicodeUserStringTest.test_floatformattingcCs�|jddd�|jddd�|jddd�|jddd�|jddddd�|jddd�|jddd	�|jddd�|jddd
�|jddd�|jddd�|jddd�dS)Nrr�ryTr�r{r�rSr�r�r�)r8)rrrr�test_inplace_rewrites�sz3MixinStrUnicodeUserStringTest.test_inplace_rewritescCs�|jdddd�d}|jd|dd�|jd|dd�|jd|dd�|jd|dd�|jt|dd
�|jt|dd�dS)N�this is the par�ti�tion methodzthis is the partition method�	partition�http://www.python.org�http�://�www.python.orgr9r��http://�http://www.python.�org)r=r>r?)rBrCrD)rAr9r9)r9rErD)rFrGr9)r8r=rtr2)r�Srrr�test_partition�s	
z,MixinStrUnicodeUserStringTest.test_partitioncCs�|jdddd�d}|jd|dd�|jd|dd�|jd|dd�|jd|dd�|jt|dd
�|jt|dd�dS)N�this is the rpartir>�	on methodzthis is the rpartition method�
rpartition�http://www.python.orgrB�://�www.python.orgr9r��http://�http://www.python.rG)rJztirK)zhttprNrO)r9r9rM)r9rPrO)rQzorgr9)r8r=rtr2)rrHrrr�test_rpartition�s	
z-MixinStrUnicodeUserStringTest.test_rpartitioncCsd}|jd|ddd�|jd|dddd�|jd|dddd�|jd|dddd�|jd|ddd�|jd|dddd�|jd|dddd�|jd|dddd�|jd|d	dd�|jd|d	ddd�|jd|d	ddd�|jd|d	ddd�|jd|d
dd�|jd|d
ddd�|jd|d
ddd�|jd|d
ddd�|jd|ddd�|jd|dddd�|jd|dddd�|jd|dd
dd�|jd|ddd�|jd|dddd�|jd|dddd�|jd|dd
dd�|jd|ddd�|jd|ddd d�|jd|dddd!�|jd|dd
dd�dS)"NrrBr`�lr?rr�rlrprvrArCrTr�r�r�Fr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�)r8)rrrrr�test_none_arguments�s:z1MixinStrUnicodeUserStringTest.test_none_argumentscCsd}d}|jtd|j|ddd�|jtd|j|ddd�|jtd|j|ddd�|jtd|j|ddd�|jtd|j|ddd�|jtd|j|ddd�|jtd	|j|ddd�|j	d
ddd
�dS)Nrrz^find\(z^rfind\(z^index\(z	^rindex\(z^count\(z
^startswith\(z^endswith\(rDu...м......<r`rn)
ZassertRaisesRegexr2r`rlrprvrAr�r�r8)rrrrrr�*test_find_etc_raise_correct_error_messages%s"zHMixinStrUnicodeUserStringTest.test_find_etc_raise_correct_error_messagesN)rrrr�r�r�r�r�r�r�r�r�r�rrr
rrrr!r4rZcpython_onlyr9r;r<rIrRrTrUrrrrr�Zs2


		-1
$6	&r�c@seZdZdd�ZdS)�MixinStrUnicodeTestcCs-|j}Gdd�d|�}|d�}|�j|g�}|j||�|jt|�|�|d�}|�j|g�}|j||�|tkr|d�}dj|g�}|j||�|jt|�|�|d�}dj|g�}|j||�n|jd|�dS)Nc@seZdZdS)z5MixinStrUnicodeTest.test_bug1001011.<locals>.subclassN)rrrrrrr�subclassEsrWrmr9z*unexpected type for MixinStrUnicodeTest %r)r&rRr3ZassertIs�typer$r)r�trW�s1�s2rrr�test_bug1001011?s$	z#MixinStrUnicodeTest.test_bug1001011N)rrrr\rrrrrV<srV)�__doc__r�rrJr�r�r�collectionsrrrrrr�r�rVrrrr�<module>s0������