U
    9%e                     @   s  d dl mZ d dl mZ d dlmZmZ d dlmZ d dlZd dl	m
Z
mZmZ d dlmZmZ d dlmZ d d	lmZ d d
lmZ dd Zdd Zdd Zdd Zdd Zdd Zdd Zdd Zdd Zdd Zdd  Z d!d" Z!d#d$ Z"d%d& Z#d'd( Z$d)d* Z%d+d, Z&d-d. Z'd/d0 Z(d1d2 Z)d3d4 Z*d5d6 Z+d7d8 Z,d9d: Z-d;d< Z.d=d> Z/d?d@ Z0dAdB Z1dCdD Z2dEdF Z3dGdH Z4dIdJ Z5dKdL Z6dMdN Z7dOdP Z8dQdR Z9dSdT Z:dUdV Z;dWdX Z<dYdZ Z=d[d\ Z>d]d^ Z?d_d` Z@dadb ZAdcdd ZBdedf ZCdgdh ZDdidj ZEdkdl ZFdmdn ZGdodp ZHdqdr ZIdsdt ZJdudv ZKdwdx ZLdydz ZMd{d| ZNd}d~ ZOdd ZPdd ZQdd ZRdd ZSdd ZTdd ZUdd ZVdd ZWdd ZXdd ZYdd ZZdd Z[dd Z\dd Z]dd Z^dd Z_dd Z`dd Zadd Zbdd Zcdd Zddd Zedd ZfG dd dee
ZgdddddddgZhdddddddddddddgZiddddddddddddddddddddddddddddddddg ZjG dd degZkG dd degZlG dd degZmG dd degZneodkrep  dS )    )product)permutations)njittypeof)typesN)TestCaseno_pyobj_flagsMemoryLeakMixin)TypingErrorUnsupportedError)_MAX_UNICODE)_header_lead)overloadc                 C   s   t dd | D S )Nc                 s   s   | ]}t |d k V  qdS )   Nord).0c r   W/var/www/html/Darija-Ai-API/env/lib/python3.8/site-packages/numba/tests/test_unicode.py	<genexpr>   s     zisascii.<locals>.<genexpr>)allsr   r   r   isascii   s    r   c                   C   s   dS N   大处着眼，小处着手。r   r   r   r   r   literal_usecase   s    r   c                 C   s   | S Nr   xr   r   r   passthrough_usecase   s    r!   c                 C   s   | |kS r   r   r    yr   r   r   
eq_usecase   s    r$   c                 C   s   t | S r   lenr   r   r   r   len_usecase   s    r'   c                 C   s   t | S r   )boolr   r   r   r   bool_usecase#   s    r)   c                 C   s   | | S r   r   r    ir   r   r   getitem_usecase'   s    r,   c                 C   s   t | | S r   )hashr*   r   r   r   getitem_check_kind_usecase+   s    r.   c                 C   s
   |  |S r   )zfillr"   r   r   r   zfill_usecase/   s    r0   c                 C   s   | | S r   r   r"   r   r   r   concat_usecase3   s    r1   c                 C   s   | | S r   r   r"   r   r   r   repeat_usecase7   s    r2   c                 C   s   | |7 } | S r   r   r"   r   r   r   inplace_concat_usecase;   s    r3   c                 C   s   | |kS r   r   r"   r   r   r   
in_usecase@   s    r4   c                 C   s   | |k S r   r   r"   r   r   r   
lt_usecaseD   s    r5   c                 C   s   | |kS r   r   r"   r   r   r   
le_usecaseH   s    r6   c                 C   s   | |kS r   r   r"   r   r   r   
gt_usecaseL   s    r7   c                 C   s   | |kS r   r   r"   r   r   r   
ge_usecaseP   s    r8   c                 C   s
   |  |S r   )	partitionr   sepr   r   r   partition_usecaseT   s    r<   c                 C   s
   |  |S r   findr"   r   r   r   find_usecaseX   s    r?   c                 C   s   |  ||S r   r=   r    r#   startr   r   r   find_with_start_only_usecase\   s    rB   c                 C   s   |  |||S r   r=   r    r#   rA   endr   r   r   find_with_start_end_usecase`   s    rE   c                 C   s
   |  |S r   )
rpartitionr:   r   r   r   rpartition_usecased   s    rG   c                 C   s
   |  |S r   countr"   r   r   r   count_usecaseh   s    rJ   c                 C   s   |  ||S r   rH   r@   r   r   r   count_with_start_usecasel   s    rK   c                 C   s   |  |||S r   rH   rC   r   r   r   count_with_start_end_usecasep   s    rL   c                 C   s
   |  |S r   rfindr"   r   r   r   rfind_usecaset   s    rO   c                 C   s   |  ||S r   rM   r@   r   r   r   rfind_with_start_only_usecasex   s    rP   c                 C   s   |  |||S r   rM   rC   r   r   r   rfind_with_start_end_usecase|   s    rQ   c                 C   s   |  ||S r   replace)r   r    r#   r   r   r   replace_usecase   s    rT   c                 C   s   |  |||S r   rR   r   r    r#   rI   r   r   r   replace_with_count_usecase   s    rV   c                 C   s
   |  |S r   rindexr"   r   r   r   rindex_usecase   s    rY   c                 C   s   |  ||S r   rW   r@   r   r   r   rindex_with_start_only_usecase   s    rZ   c                 C   s   |  |||S r   rW   rC   r   r   r   rindex_with_start_end_usecase   s    r[   c                 C   s
   |  |S r   indexr"   r   r   r   index_usecase   s    r^   c                 C   s   |  ||S r   r\   r@   r   r   r   index_with_start_only_usecase   s    r_   c                 C   s   |  |||S r   r\   rC   r   r   r   index_with_start_end_usecase   s    r`   c                 C   s
   |  |S r   
startswithr"   r   r   r   startswith_usecase   s    rc   c                 C   s
   |  |S r   endswithr"   r   r   r   endswith_usecase   s    rf   c                 C   s   |   S r   
expandtabsr   r   r   r   expandtabs_usecase   s    ri   c                 C   s
   |  |S r   rg   r   tabsizer   r   r   expandtabs_with_tabsize_usecase   s    rl   c                 C   s   | j |dS )N)rk   rg   rj   r   r   r   %expandtabs_with_tabsize_kwarg_usecase   s    rm   c                 C   s   |  ||S r   ra   r@   r   r   r   "startswith_with_start_only_usecase   s    rn   c                 C   s   |  |||S r   ra   rC   r   r   r   !startswith_with_start_end_usecase   s    ro   c                 C   s   |  ||S r   rd   r@   r   r   r    endswith_with_start_only_usecase   s    rp   c                 C   s   |  |||S r   rd   rC   r   r   r   endswith_with_start_end_usecase   s    rq   c                 C   s
   |  |S r   splitr"   r   r   r   split_usecase   s    rt   c                 C   s   |  ||S r   rr   r    r#   maxsplitr   r   r   split_with_maxsplit_usecase   s    rw   c                 C   s   | j ||dS N)rv   rr   ru   r   r   r   !split_with_maxsplit_kwarg_usecase   s    ry   c                 C   s   |   S r   rr   r   r   r   r   split_whitespace_usecase   s    rz   c                 C   s   |   S r   
splitlinesr   r   r   r   splitlines_usecase   s    r}   c                 C   s
   |  |S r   r{   r   keependsr   r   r    splitlines_with_keepends_usecase   s    r   c                 C   s   | j |dS )N)r   r{   r~   r   r   r   &splitlines_with_keepends_kwarg_usecase   s    r   c                 C   s
   |  |S r   rsplitr:   r   r   r   rsplit_usecase   s    r   c                 C   s   |  ||S r   r   r   r;   rv   r   r   r   rsplit_with_maxsplit_usecase   s    r   c                 C   s   | j ||dS rx   r   r   r   r   r   "rsplit_with_maxsplit_kwarg_usecase   s    r   c                 C   s   |   S r   r   r   r   r   r   rsplit_whitespace_usecase   s    r   c                 C   s   |   S r   lstripr   r   r   r   lstrip_usecase   s    r   c                 C   s
   |  |S r   r   r    charsr   r   r   lstrip_usecase_chars   s    r   c                 C   s   |   S r   rstripr   r   r   r   rstrip_usecase   s    r   c                 C   s
   |  |S r   r   r   r   r   r   rstrip_usecase_chars   s    r   c                 C   s   |   S r   stripr   r   r   r   strip_usecase   s    r   c                 C   s
   |  |S r   r   r   r   r   r   strip_usecase_chars  s    r   c                 C   s
   |  |S r   )joinr"   r   r   r   join_usecase  s    r   c                 C   s   dg}|   | |S )N )popr   )r    lr   r   r   join_empty_usecase  s    r   c                 C   s
   |  |S r   centerr"   r   r   r   center_usecase  s    r   c                 C   s   |  ||S r   r   r    r#   fillcharr   r   r   center_usecase_fillchar  s    r   c                 C   s
   |  |S r   ljustr"   r   r   r   ljust_usecase  s    r   c                 C   s   |  ||S r   r   r   r   r   r   ljust_usecase_fillchar  s    r   c                 C   s
   |  |S r   rjustr"   r   r   r   rjust_usecase#  s    r   c                 C   s   |  ||S r   r   r   r   r   r   rjust_usecase_fillchar'  s    r   c                 C   s   |   S r   )istitler   r   r   r   istitle_usecase+  s    r   c                 C   s   g }| D ]}| | q|S r   append)r    r   r+   r   r   r   iter_usecase/  s    r   c                 C   s   |   S r   titler   r   r   r   r   6  s    r   c                  C   s   g } dD ]}|  | q| S r   r   )r   r+   r   r   r   literal_iter_usecase:  s    r   c                 C   s2   d}d}t | D ]\}}||7 }|d7 }q||fS )Nr   r      )	enumerate)r    bufscanr+   r   r   r   r   enumerated_iter_usecaseA  s    
r   c                 C   s.   t | }t| }t|d D ]}t| qd S )Nr   )r&   iterrangenext)r    nr+   _r   r   r   iter_stopiteration_usecaseJ  s    r   c                  C   s2   d} t | }t| }t|d D ]}t| q d S )Nr   r   )r   r&   r   r   )r   r+   r   r   r   r   r   "literal_iter_stopiteration_usecaseQ  s
    r   c                 C   s   |   S r   )islowerr   r   r   r   islower_usecaseY  s    r   c                 C   s   |   S r   lowerr   r   r   r   lower_usecase]  s    r   c                 C   s   t | S r   r   r   r   r   r   ord_usecasea  s    r   c                 C   s   t | S r   )chrr   r   r   r   chr_usecasee  s    r   c                       s   e Zd Z fddZ  ZS )BaseTestc                    s   t t|   d S r   )superr   setUp)self	__class__r   r   r   j  s    zBaseTest.setUp)__name__
__module____qualname__r   __classcell__r   r   r   r   r   i  s   r   r   ascii12345
1234567890   ¡Y tú quién te crees?   🐍⚡r   aaabZaababascZascihZasciju   大处着眼，小处着手u%   大处着眼，小处着手。🐍⚡r   r   )r   r   )r   r   )zasc ii )r   ci)r   r   )r      Ă)r      大处)r      étú?)r   +   大处 着眼，小处着手。大大大处)r   r   )r   r   )r   r   )r   u   大处大处)r   r   )r   r   r   r   )r   r   )r      tú quién te crees?)r   r   )r   r   )r   r   )r   r   )r   r   )r   r   )r   r   )ababababa)r   r   )r   aba)
aaaaaaaaaar   )r      aĂ)Zaabbaaaabbaaaac                   @   s(  e Zd ZefddZefddZefddZdd Zd	d
 ZefddZ	efddZ
efddZefddZefddZefddZdd Zdd Zdd Zdd Zdd  Zd!d" Zd#d$ Zd%d& Zd'd( Zd)d* Zd+d, Zd-d. Zd/d0 Zd1d2 Zefd3d4Zd5d6 Zd7d8 Zef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 Z/dYdZ Z0d[d\ Z1d]d^ Z2d_d` Z3dadb Z4dcdd Z5dedf Z6dgdh Z7didj Z8dkdl Z9dmdn Z:dodp Z;dqdr Z<dsdt Z=dudv Z>dwdx Z?dydz Z@d{d| ZAefd}d~ZBefddZCdd ZDdd ZEdd ZFdd ZGdd ZHdd ZIdd ZJdd ZKdd ZLdd ZMdd ZNdd ZOdd ZPdd ZQdd ZRdd ZSdd ZTdd ZUdd ZVdd ZWdd ZXefddZYdd ZZdd Z[dd Z\dd Z]dd Z^efddZ_efddZ`efddZaefddZbefddZcdd ZdddĄ ZeddƄ ZfddȄ Zgddʄ Zhdd̄ Zidd΄ ZjddЄ Zkdd҄ ZlddԄ Zmddք Zndd؄ Zoddڄ Zpdd܄ Zqddބ Zrdd Zsdd Ztdd Zudd Zvdd Zwdd Zxdd Zydd Zzdd Z{dd Z|dd Z}dS )TestUnicodec                 C   s   t }| j||d d S )N)flags)r   Zrun_nullary_func)r   r   pyfuncr   r   r   test_literal  s    zTestUnicode.test_literalc                 C   s.   t }t|}tD ]}| |||| qd S r   )r!   r   UNICODE_EXAMPLESassertEqualr   r   r   cfuncr   r   r   r   test_passthrough  s    zTestUnicode.test_passthroughc              	   C   s   t }t|}tD ]x}ttD ]j}| ||||||d||f  | ||d||dd|df  | |d||d|dd|f  qqd S )Nz%s, %sr   )r$   r   r   reversedr   r   r   r   r   r   r   r   r   r   test_eq  s      
 
 
zTestUnicode.test_eqc                 C   s<   t dd }td D ]"\}}| |||||| qd S )Nc                 S   s8   | dkrd}nd }|dk r d}nd }||kr0dS dS d S )Nr   Zconcrete
      r   )Zpred1Zpred2Z	resolved1Z	resolved2r   r   r   foo  s    z)TestUnicode.test_eq_optional.<locals>.foo)r   r   )r   r   r   py_func)r   r   p1p2r   r   r   test_eq_optional  s    
zTestUnicode.test_eq_optionalc              	   C   s   |}t |}tD ]*}| ||||||d|j||f  qttddD ]T\}}| ||||||d|j||f  | ||||||d|j||f  qHd S )Nz%s: "%s", "%s"   r)r   UNICODE_ORDERING_EXAMPLESr   r   r   )r   Zusecaser   r   r   r   r   r   r   _check_ordering_op  s&    zTestUnicode._check_ordering_opc                 C   s   |  t d S r   )r  r5   r   r   r   r   r   test_lt  s    zTestUnicode.test_ltc                 C   s   |  t d S r   )r  r6   r  r   r   r   test_le  s    zTestUnicode.test_lec                 C   s   |  t d S r   )r  r7   r  r   r   r   test_gt  s    zTestUnicode.test_gtc                 C   s   |  t d S r   )r  r8   r  r   r   r   test_ge  s    zTestUnicode.test_gec                 C   s.   t }t|}tD ]}| |||| qd S r   )r'   r   r   r   r   r   r   r   test_len  s    zTestUnicode.test_lenc                 C   s.   t }t|}tD ]}| |||| qd S r   )r)   r   r   r   r   r   r   r   	test_bool  s    zTestUnicode.test_boolc              	   C   sR   t }t|}ddddddddd	g	}d
}|D ]"}| j||||||d q*d S )Nr   	t	t	a	   	⚡	a	bc
ab	c   🐍	⚡   🐍⚡
		🐍	abab			ab
	az*Results of "{}".expandtabs() must be equalmsg)ri   r   r   formatr   r   r   casesr  r   r   r   r   test_expandtabs  s      zTestUnicode.test_expandtabsc              
   C   s   t tt tg}ddg}ddddddd	d
dg	}|D ]N}tddD ]>}t||D ].\}}| j|||||||||d qNq@q2d S )Nz,Results of "{}".expandtabs({}) must be equalz4Results of "{}".expandtabs(tabsize={}) must be equalr   r
  r  r  r  r  r  r  r  r   r   r  )r   rl   rm   r   zipr   r   r  )r   fnsmessagesr  r   rk   fnr  r   r   r   test_expandtabs_with_tabsize  s"      
z(TestUnicode.test_expandtabs_with_tabsizec              	   C   sV   t }t|}tjtf}| t}|dd W 5 Q R X d|}| |t	|j
 d S )Nr
  333333@z"tabsize" must be {}, not float)rl   r   r   IntegerintassertRaisesr
   r  assertInstr	exception)r   r   r   accepted_typesraisesr  r   r   r   ,test_expandtabs_exception_noninteger_tabsize(  s    

z8TestUnicode.test_expandtabs_exception_noninteger_tabsizec           	   
   C   s   t }t|}dddg}ddddddddddg
}d	d
g}|t D ]R}dd|d d |dd  ||| g}|| | D ]}| |||||| qrq>d S Nhello
helloworldr   heellolowoloohellohellohellor   r       rc   r   r   r   )	r   r   r   cpython_strcpython_subs
extra_subsr   default_subsprefixr   r   r   test_startswith_default2  s&    
        $z#TestUnicode.test_startswith_defaultc           
   
   C   s   t }t|}dddg}ddddddddddg
}d	d
g}|t D ]p}dd|d d |dd  ||| g}|| | D ]:}ttddd g D ] }	| ||||	||||	 qqrq>d S Nr(  r)  r   r*  r+  r,  r-  r.  r/  r   r    r0  r1  r   )rn   r   r   listr   r   )
r   r   r   r3  r4  r5  r   r6  r7  rA   r   r   r   test_startswith_with_startA  s,    
        $
z&TestUnicode.test_startswith_with_startc                 C   s   t }t|}dddg}ddddddddddg
}d	d
g}|t D ]}dd|d d |dd  ||| g}|| | D ]X}ttddd g D ]>}	ttddd g D ]$}
| ||||	|
||||	|
 qqqrq>d S r9  ro   r   r   r;  r   r   )r   r   r   r3  r4  r5  r   r6  r7  rA   rD   r   r   r   test_startswith_with_start_endR  s.    
        $z*TestUnicode.test_startswith_with_start_endc              	   C   s   d}|  t| tt}|dd W 5 Q R X d}|  t| tt}|ddd W 5 Q R X d}|  t| tt}|dddd	 W 5 Q R X d S )
Nz9The arg 'prefix' should be a string or a tuple of stringsr(  )r   r*  z:When specified, the arg 'start' must be an Integer or Noner*  zinvalid startz8When specified, the arg 'end' must be an Integer or Noner   zinvalid end)assertRaisesRegexr
   r   rc   rn   ro   )r   Zmsg_invalid_prefixr   Zmsg_invalid_startZmsg_invalid_endr   r   r   &test_startswith_exception_invalid_argsd  s    z2TestUnicode.test_startswith_exception_invalid_argsc           
   
   C   s   t }t|}dddg}ddddddddddg
}d	d
g}|t D ]Z}dd|d d |dd  ||| g}|| | D ]$}|df}	| |||	|||	 qrq>d S r'  r2  )
r   r   r   r3  r4  r5  r   r6  sub_strr7  r   r   r   test_startswith_tuplew  s,    
        $z!TestUnicode.test_startswith_tuplec                 C   s   t }t|}dddg}ddddddddddg
}d	d
g}|t D ]}dd|d d |dd  ||| g}|| | D ]`}ttddd g D ]F}	ttddd g D ],}
|df}| ||||	|
||||	|
 qqqrq>d S r9  r=  )r   r   r   r3  r4  r5  r   r6  rA  rA   rD   r7  r   r   r   test_startswith_tuple_args  s0    
        $z&TestUnicode.test_startswith_tuple_argsc           
   
   C   s   t }t|}dddg}ddddddddddg
}d	d
g}|t D ]b}dd|d d |dd  ||| g}|| | D ],}d}	| j|||||||	||d qrq>d S )Nr(  r)  r   r*  r+  r,  r-  r.  r/  r   r    r0  r1  z)Results "{}".endswith("{}") must be equalr  rf   r   r   r   r  )
r   r   r   r3  r4  r5  r   r6  rA  r  r   r   r   test_endswith_default  s,    
        $
z!TestUnicode.test_endswith_defaultc                 C   s   t }t|}dddg}ddddddddddg
}d	d
g}|t D ]}dd|d d |dd  ||| g}|| | D ]L}ttddd g D ]2}	d}
| j||||	||||	|
|||	d qqrq>d S )Nr(  r)  r   r*  r+  r,  r-  r.  r/  r   r    r0  r1  r:  r   z-Results "{}".endswith("{}", {}) must be equalr  )rp   r   r   r;  r   r   r  )r   r   r   r3  r4  r5  r   r6  rA  rA   r  r   r   r   test_endswith_with_start  s0    
        $
z$TestUnicode.test_endswith_with_startc                 C   s   t }t|}dddg}ddddddddddg
}d	d
g}|t D ]}dd|d d |dd  ||| g}|| | D ]l}ttddd g D ]R}	ttddd g D ]8}
d}| j||||	|
||||	|
||||	|
d qqqrq>d S Nr(  r)  r   r*  r+  r,  r-  r.  r/  r   r    r0  r1  r:  r   zOResults "{}".endswith("{}", {}, {})                               must be equalr  rq   r   r   r;  r   r   r  )r   r   r   r3  r4  r5  r   r6  rA  rA   rD   r  r   r   r   test_endswith_with_start_end  s2    
        $z(TestUnicode.test_endswith_with_start_endc              
   C   s   t }t|}dddg}ddddddddddg
}d	d
g}|t D ]j}dd|d d |dd  ||| g}|| | D ]4}d}	|df}
| j|||
|||
|	||
d qrq>d S )Nr(  r)  r   r*  r+  r,  r-  r.  r/  r   r    r0  r1  z'Results "{}".endswith({}) must be equalr  rD  )r   r   r   r3  r4  r5  r   r6  rA  r  
tuple_subsr   r   r   test_endswith_tuple  s0    
        $
zTestUnicode.test_endswith_tuplec                 C   s   t }t|}dddg}ddddddddddg
}d	d
g}|t D ]}dd|d d |dd  ||| g}|| | D ]t}ttddd g D ]Z}	ttddd g D ]@}
d}|df}| j||||	|
||||	|
||||	|
d qqqrq>d S rG  rH  )r   r   r   r3  r4  r5  r   r6  rA  rA   rD   r  rJ  r   r   r   test_endswith_tuple_args  s:    
        $ z$TestUnicode.test_endswith_tuple_argsc              	   C   sv   t }t|}tD ]`}dd|d d d |d d |dd  ||| g}|D ]&}| ||||||d||f  qHqd S )Nr   xxr   r0  r1  z'%s' in '%s'?)r4   r   r   r   )r   r   r   r   r   extrassubstrr   r   r   test_in  s    0
zTestUnicode.test_inc              
   C   s   |    t}t|}||fD ]6}| t}|dd W 5 Q R X | dt|j qtj	tj
f}| t}|dd  W 5 Q R X d|}| |t|j d S Nr   r   empty separatorz"sep" must be {}, not none)disable_leak_checkr<   r   r   
ValueErrorr!  r"  r#  r   UnicodeTypeUnicodeCharSeqr
   r  r   r   r   funcr%  r$  r  r   r   r   $test_partition_exception_invalid_sep  s    
z0TestUnicode.test_partition_exception_invalid_sepc              	   C   s\   t }t|}ddddddddd	g	}d
}|D ],\}}| j|||||||||d q*d S )Nr      ⚡abcabcr[  r   r[     🐍⚡🐍r[  abababar   rb  r   rb  r   rb  r   rb  r   z-Results of "{}".partition("{}") must be equalr  )r<   r   r   r  r   r   r   CASESr  r   r;   r   r   r   test_partition$  s"    
zTestUnicode.test_partitionc           
      C   s   t }t|}dd tD }dddddgfdd	d
dgfddgfddgfddgfddd	ddgfdd	dgfddgfddgfddgfg
}|| D ]:\}}|D ],}d}	| j|||||||	||d qqd S )Nc              	   S   s.   g | ]&}|d d|dd |dd |gfqS r   rM  Nr0  r1  r   r   r   r   r   r   
<listcomp><  s    z)TestUnicode.test_find.<locals>.<listcomp>uf   aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaĂr      ȁ   Ġ   Ƞuh   aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa􀌄   􀌄   􀈄   􂀄   ĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂar     􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄a  􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄Ădaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar   u   a􀌄   ĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂu   Ă􀌄   ĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂa_a_  􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄a_  􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄Ă_   Ă_z%Results "{}".find("{}") must be equalr  )r?   r   r   r   r  )
r   r   r   r   r6  r4  r   subsrA  r  r   r   r   	test_find8  s0    

zTestUnicode.test_findc                 C   s   t }t|}tD ]p}dd|d d |dd  |fD ]L}ttddd g D ]2}d}| j||||||||||||d qJq2qd S )	Nr   rM  r0  r1  r:  r   z)Results "{}".find("{}", {}) must be equalr  )rB   r   r   r;  r   r   r  r   r   r   r   rA  rA   r  r   r   r   test_find_with_start_onlyT  s    "
z%TestUnicode.test_find_with_start_onlyc           
      C   s   t }t|}ttddd g  }}tD ]p}dd|d d |dd  |fD ]L}t||D ]<\}}d}	| j|||||||||||	||||d qXqJq(d S )	Nr:  r   r   rM  r0  r1  z0Results of "{}".find("{}", {}, {}) must be equalr  )rE   r   r;  r   r   r   r   r  
r   r   r   startsendsr   rA  rA   rD   r  r   r   r   test_find_with_start_end`  s    "z$TestUnicode.test_find_with_start_endc           	   
   C   sn   t }t|}tjtjf}dD ]L\}}}| t}|dd|| W 5 Q R X d||}| |t	|j
 qd S N))皙?   rA   )r         ?rD   r   Zsciz"{}" must be {}, not float)rE   r   r   r  NoneTyper   r
   r  r!  r"  r#  )	r   r   r   acceptedrA   rD   namer%  r  r   r   r   (test_find_exception_noninteger_start_endm  s    z4TestUnicode.test_find_exception_noninteger_start_endc              
   C   s   |    t}t|}||fD ]6}| t}|dd W 5 Q R X | dt|j qtj	tj
f}| t}|dd  W 5 Q R X d|}| |t|j d S rQ  )rS  rG   r   r   rT  r!  r"  r#  r   rU  rV  r
   r  rW  r   r   r   %test_rpartition_exception_invalid_sepx  s    
z1TestUnicode.test_rpartition_exception_invalid_sepc              	   C   s\   t }t|}ddddddddd	g	}d
}|D ],\}}| j|||||||||d q*d S )NrZ  r\  r^  r_  ra  rc  rd  re  rf  z.Results of "{}".rpartition("{}") must be equalr  )rG   r   r   r  rg  r   r   r   test_rpartition  s"    
zTestUnicode.test_rpartitionc                 C   sP   t }t|}d}tD ]6\}}|||}|||}| ||||||| qd S )Nz6'{0}'.py_count('{1}') = {2}
'{0}'.c_count('{1}') = {3})rJ   r   UNICODE_COUNT_EXAMPLESr   r  )r   r   r   	error_msgr   sub	py_resultc_resultr   r   r   
test_count  s    

zTestUnicode.test_countc           	      C   s   t }t|}dd }tD ]\}}tddD ]8}||||}||||}| |||||||| q*|||d }|||d }| |||||d || qd S )N%s
%s)z '{0}'.py_count('{1}', {2}) = {3}z'{0}'.c_count('{1}', {2}) = {4}   )rK   r   r  r   r   r  )	r   r   r   r  r   r  r+   r  r  r   r   r   test_count_with_start  s&    z!TestUnicode.test_count_with_startc           
      C   s   t }t|}dd }tD ]\}}ttdddD ]B\}}|||||}|||||}	| ||	|||||||	 q0tddD ]>}|||d |}|||d |}	| ||	|||d |||	 q~|||d d }|||d d }	| ||	|||d d ||	 qd S )Nr  )%'{0}'.py_count('{1}', {2}, {3}) = {4}z$'{0}'.c_count('{1}', {2}, {3}) = {5}r  r  )r  r  )rL   r   r  r   r   r   r  )
r   r   r   r  r   r  r+   jr  r  r   r   r   test_count_with_start_end  s6    z%TestUnicode.test_count_with_start_endc              	   C   s   t t}| t}|dddd W 5 Q R X | dt|j | t}|dddd W 5 Q R X | dt|j | t}|dddd W 5 Q R X | d	t|j d S )
Nr   r   r   r  ,The slice indices must be an Integer or Noneg333333?      z(The substring must be a UnicodeType, not)r   rL   r   r
   r!  r"  r#  r   r   r%  r   r   r   test_count_arg_type_check  s     z%TestUnicode.test_count_arg_type_checkc                    s   t   fdd}| t}|dddd W 5 Q R X | dt|j dd }ttjtjt	tjt	tj}t
|g } ddd	d
}|ddd	d
}| |||ddd	d
|| d S )Nc                     s6   t t jt jt t jt t j}t|g  d S r   )r   int64unicode_typeOptionalfloat64r   )argsZbad_sigr   r   r   try_compile_bad_optional  s    

zPTestUnicode.test_count_optional_arg_type_check.<locals>.try_compile_bad_optional	   tú quis?u   tú皙?r  r  )r  z''{0}'.c_count_op('{1}', {2}, {3}) = {5}r      )rL   r   r
   r!  r"  r#  r   r  r  r  r   r   r  )r   r  r%  r  Zsig_optionalcfunc_optionalr  r  r   r  r   "test_count_optional_arg_type_check  s*    

z.TestUnicode.test_count_optional_arg_type_checkc           	      C   s   t }t|}dd tD }dddddgfdd	d
dgfdddgfddgfddgfddgfddd	ddgfdd	dgfddgfddgfddgfg}|| D ]:\}}|D ],}d}| j|||||||||d qqd S )Nc              	   S   s.   g | ]&}|d d|dd |dd |gfqS rj  r   rk  r   r   r   rl    s    z*TestUnicode.test_rfind.<locals>.<listcomp>uf   Ăaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar   rm  rn  ro  uh   􀌄aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaarp  rq  rr  abcdefghiabcabcr      aĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂr     a􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄  Ă􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄rv  u   Ăau   􀌄arw  u   􀌄Ă   _aĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂ_a  _a􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄  _Ă􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄   _Ăz&Results "{}".rfind("{}") must be equalr  )rO   r   r   r   r  	r   r   r   r6  r4  r   r}  rA  r  r   r   r   
test_rfind  s2    


zTestUnicode.test_rfindc                 C   s   t }t|}tD ]p}dd|d d |dd  |fD ]L}ttddd g D ]2}d}| j||||||||||||d qJq2qd S )	Nr   rM  r0  r1  r:  r   z*Results "{}".rfind("{}", {}) must be equalr  )rP   r   r   r;  r   r   r  r  r   r   r   test_rfind_with_start_only$  s    "
z&TestUnicode.test_rfind_with_start_onlyc           
      C   s   t }t|}ttddd g }ttddd g }tD ]p}dd|d d |dd  |fD ]L}t||D ]<\}}d}	| j|||||||||||	||||d qhqZq8d S )	Nr:  r   r   rM  r0  r1  z1Results of "{}".rfind("{}", {}, {}) must be equalr  )rQ   r   r;  r   r   r   r   r  r  r   r   r   test_rfind_with_start_end0  s    "z%TestUnicode.test_rfind_with_start_endc                 C   s^   t t}tD ]L}dD ]B}| t}||| W 5 Q R X dtj}| |t	|j
 qqd S )N)Nr   F
must be {})r   rO   r   r   r
   r  r   rU  r!  r"  r#  )r   r   r   rA  r%  r  r   r   r   test_rfind_wrong_substr>  s    z#TestUnicode.test_rfind_wrong_substrc           	      C   s   t t}tjtjf}tD ]}dd|d d |dd  |fD ]}tddgddgD ]H\}}| t}||||| W 5 Q R X d		|}| 
|t|j qPtddgd
dgD ]H\}}| t}||||| W 5 Q R X d	|}| 
|t|j qq:qd S )Nr   rM  r0  r1  r  Fr   r   z"start" must be {}gTz"end" must be {})r   rQ   r   r  r  r   r   r   r
   r  r!  r"  r#  )	r   r   r$  r   rA  rA   rD   r%  r  r   r   r   test_rfind_wrong_start_endH  s    "

z&TestUnicode.test_rfind_wrong_start_endc              	   C   s   t d }|dd }tjtjf}d|}dd }| t}|||dd W 5 Q R X | |t|j	 dd	 }| t}|||dd W 5 Q R X | |t|j	 d S )
Nr   r   r   r  c                  W   s6   t t jt jt t jt t j}t|gt d S r   )r   r  r  r  r  intpr   rQ   r  Zwrong_sig_optionalr   r   r    try_compile_wrong_start_optionalb  s    

zYTestUnicode.test_rfind_wrong_start_end_optional.<locals>.try_compile_wrong_start_optionalr  c                  W   s6   t t jt jt t jt t j}t|gt d S r   )r   r  r  r  r  r  r   rQ   r  r   r   r   try_compile_wrong_end_optionalm  s    

zWTestUnicode.test_rfind_wrong_start_end_optional.<locals>.try_compile_wrong_end_optional)
r   r   r  r  r  r   r
   r!  r"  r#  )r   r   rA  r$  r  r  r%  r  r   r   r   #test_rfind_wrong_start_end_optional\  s    
z/TestUnicode.test_rfind_wrong_start_end_optionalc           	   	   C   s   t }t|}dd tD }ddddgfddgfd	dgfd
dgfddgfddgfddgfg}|| D ]:\}}|D ],}d}| j|||||||||d qnqbd S )Nc                 S   s,   g | ]$}|d |dd |dd |gfqS r   Nr0  r1  r   rk  r   r   r   rl  |  s    z+TestUnicode.test_rindex.<locals>.<listcomp>r  r   defr  r  r   r  r  r   r  r  r  r  r  z'Results "{}".rindex("{}") must be equalr  )rY   r   r   r   r  r  r   r   r   test_rindexx  s&    	
zTestUnicode.test_rindexc           	   	   C   s   t }t|}dd tD }ddddgfddgfd	dgfd
dgfddgfddgfddgfg}|| D ]:\}}|D ],}d}| j|||||||||d qnqbd S )Nc                 S   s,   g | ]$}|d |dd |dd |gfqS r  r   rk  r   r   r   rl    s    z*TestUnicode.test_index.<locals>.<listcomp>r  r   r  r  rs  r   rt  ru  r   rx  ry  rz  r{  r|  z&Results "{}".index("{}") must be equalr  )r^   r   r   r   r  r  r   r   r   
test_index  s&    	
zTestUnicode.test_indexc                 C   s  t tg}ddg}dddddg}t||D ]\}}t|}|D ]}t|}dttd	|d
 f|d d dgttd	d
|  f|dd  ttdttd	d|  f|dgttd	d
|  fg}	|	D ]B\}
}|d g D ].}| j|||
||||
||||
|d qqq<q(d S )Nz*Results "{}".index("{}", {}) must be equalz+Results "{}".rindex("{}", {}) must be equalr   r   r   r   r   r   r   r0  r   r1     r  )	r_   rZ   r  r   r&   r;  r   r   r  )r   pyfuncsr  unicode_examplesr   r  r   r   r   r  rA  r  rA   r   r   r   !test_index_rindex_with_start_only  s6    "(
z-TestUnicode.test_index_rindex_with_start_onlyc                 C   sf  t tg}ddg}dddddg}t||D ]6\}}t|}|D ]}t|}dttd	|d
 tt|df|d d dgttd	d
|  ddgtt|d d f|dd  ttdttd	d tt|df|dgttd	d
|  tt|dfg}	|	D ]X\}
}}t|d g |D ]:\}}| j|||
|||||
|||	||
||d qqq>q(d S )Nz1Results of "{}".index("{}", {}, {}) must be equalz2Results of "{}".rindex("{}", {}, {}) must be equalr   r   r   r   r   r   r  r   r   r0  r   r   r   r1  r  r  )
r`   r[   r  r   r&   r;  r   r   r   r  )r   r  r  r  r   r  r   r   r   r  rA  r  r  rA   rD   r   r   r    test_index_rindex_with_start_end  s:    
  "&z,TestUnicode.test_index_rindex_with_start_endc                 C   s  |    dddddg}ttg}|D ]}t|}|D ]}t|}dtt|d d|gf|d d	 d
gtt|d f|dd  ttdd|gf|d gtt|fg}|D ]f\}}	}
t|	|
D ]P\}}||fD ]>}| t	}||||| W 5 Q R X d}| 
|t|j qqqq2q"d S )Nr   r   r   r   r   r   r   r   r0  r   r   r1  r  zsubstring not found)rS  r`   r[   r   r&   r;  r   r   r   rT  r!  r"  r#  )r   r  r  r   r   r   r   r  rA  r  r  rA   rD   rX  r%  r  r   r   r   /test_index_rindex_exception_substring_not_found  s0    z;TestUnicode.test_index_rindex_exception_substring_not_foundc           
      C   s|   t jt jf}ttg}|D ]^}t|}dD ]L\}}}| t}|dd|| W 5 Q R X d||}	| 	|	t
|j q(qd S r  )r   r  r  r`   r[   r   r   r
   r  r!  r"  r#  )
r   r  r  r   r   rA   rD   r  r%  r  r   r   r   0test_index_rindex_exception_noninteger_start_end  s    z<TestUnicode.test_index_rindex_exception_noninteger_start_endc              	   C   sV   t }t|}tD ]@}tt| t|D ]&}| ||||||d||f  q(qd S )N	'%s'[%d]?)r,   r   r   r   r&   r   )r   r   r   r   r+   r   r   r   test_getitem	  s    
zTestUnicode.test_getitemc              	   C   s^   t }t|}ddg}|D ]@}tt| t|D ]&}| ||||||d||f  q0qd S )Nu   aሴu   ¡着r  )r.   r   r   r&   r   )r   r   r   samplesr   r+   r   r   r   test_getitem_scalar_kind  s    
z$TestUnicode.test_getitem_scalar_kindc              
   C   s   |    t}t|}tD ]p}| t}||t| W 5 Q R X | dt|j	 | t}||t| W 5 Q R X | dt|j	 qd S )Nzstring index out of range)
rS  r,   r   r   r   
IndexErrorr&   r!  r"  r#  )r   r   r   r   r%  r   r   r   test_getitem_error   s    zTestUnicode.test_getitem_errorc                 C   s   t }t|}tD ]n}ttt| t|D ]P}ttt| t|D ]2}t||}| ||||||d|||f  qHq,qd S )N'%s'[%d:%d]?)r,   r   r   r;  r   r&   slicer   r   r   r   r   r+   r  slr   r   r   test_slice2/  s    
zTestUnicode.test_slice2c                 C   s   t }t|}tD ]n}ddt|t|d fD ]P}ddt|t|d fD ]2}t||}| ||||||d|||f  qHq,qd S )Nr0  r   r   r  r,   r   r   r&   r  r   r  r   r   r   test_slice2_error;  s    
zTestUnicode.test_slice2_errorc                 C   s   t }t|}ddg}|D ]z}dddddt|t|d fD ]V}dddddt|t|d fD ]2}t||}| ||||||d|||f  q\q:qd S )	N	   abcሴሴu   ¡¡¡着着着r0  r   r   r   r   r  )r.   r   r&   r  r   )r   r   r   r  r   r+   r  r  r   r   r   test_getitem_slice2_kindG  s    ""
z$TestUnicode.test_getitem_slice2_kindc                 C   s   t }t|}tD ]t}tt| t|D ]Z}tt| t|D ]@}dD ]6}t|||}| ||||||d||||f  qHq@q(qd S )Nr0  r   r   r   '%s'[%d:%d:%d]?)r,   r   r   r   r&   r  r   r   r   r   r   r+   r  kr  r   r   r   test_slice3U  s    zTestUnicode.test_slice3c           	      C   s   t }t|}ddddddg}|D ]t}tt| t|D ]Z}tt| t|D ]@}dD ]6}t|||}| ||||||d||||f  qXqPq8q d S )	Nr  u   aሴbሴc¡¡¡着着着u   ¡着¡着¡着u   着a着b着cu   ¡着a¡着b¡着cu   ¡着a着¡cr  r  )r.   r   r   r&   r  r   )	r   r   r   r  r   r+   r  r  r  r   r   r   test_getitem_slice3_kindb  s$    z$TestUnicode.test_getitem_slice3_kindc                 C   s   t }t|}tD ]|}ddt|t|d fD ]^}ddt|t|d fD ]@}dD ]6}t|||}| ||||||d||||f  qPqHq,qd S )Nr0  r   r   r  r  r  r  r   r   r   test_slice3_errorw  s    zTestUnicode.test_slice3_errorc                 C   s$   t dd }d}| ||d dS )z
        Make sure ascii flag is False when ascii and non-ascii characters are
        mixed in output of Unicode slicing.
        c                 S   s    | d d d j | dd d j fS )Nr   r   	_is_asciir   r   r   r   f  s    z,TestUnicode.test_slice_ascii_flag.<locals>.fu    ¿abc¡Y tú, quién te cre		es?)r   r   Nr   r   r   r  r   r   r   r   test_slice_ascii_flag  s    
z!TestUnicode.test_slice_ascii_flagc                 C   s   t }t|}ddddddddd	d
dddddg}| t}||d d W 5 Q R X | dt|j |D ],}tddD ]}| |||||| qvqhd S )Nr   z+asciiz-asciiz-asc ii-r   z-12345z+12345r   u   ¡Y tú crs?r   u   +🐍⚡u   -🐍⚡u   大眼，小手。u   +大眼，小手。u   -大眼，小手。r   r  z<width> must be an Integerr   )	r0   r   r   r
   r!  r"  r#  r   r   )r   r   r   ZZFILL_INPUTSr%  r   widthr   r   r   
test_zfill  s4    zTestUnicode.test_zfillc              	   C   sP   t }t|}tD ]:}td d d D ]&}| ||||||d||f  q"qd S Nr   z'%s' + '%s'?)r1   r   r   r   r   r   r   r   test_concat  s    
zTestUnicode.test_concatc                 C   sT   t }t|}tD ]>}dD ]4}| |||||| | |||||| qqd S )N)r   r   r   r   r1  r  r  r  r     F   )r2   r   r   r   r   r   r   r   test_repeat  s    zTestUnicode.test_repeatc              	   C   sJ   |    tt}| t}|dd W 5 Q R X | td t|j d S )Nhig      @z" Function(<built-in function mul>))	rS  r   r2   r   r
   r!  r   r"  r#  r  r   r   r   test_repeat_exception_float  s    
z'TestUnicode.test_repeat_exception_floatc              
   C   sX   |    t}t|}||fD ]6}| t}|dd W 5 Q R X | dt|j qd S Nr   r   rR  )rS  rt   r   r   rT  r!  r"  r#  r   r   r   rX  r%  r   r   r   test_split_exception_empty_sep  s    z*TestUnicode.test_split_exception_empty_sepc              
   C   sT   t }t|}dD ]>}| t}|d|d W 5 Q R X | dt|jd|  qd S )Nr   Nr   r  r  z"non-integer maxsplit with sep = %s)rw   r   r   r
   r!  r"  r#  )r   r   r   r;   r%  r   r   r   (test_split_exception_noninteger_maxsplit  s    z4TestUnicode.test_split_exception_noninteger_maxsplitc              
   C   sX   t }t|}ddddddddd	d
g
}|D ]*\}}| ||||||d||f  q(d S )N a NrZ  r\  r^  r_  ra  rc  rd  re  rf  z'%s'.split('%s')?)rt   r   r   )r   r   r   rh  test_strsplitterr   r   r   
test_split  s$    
zTestUnicode.test_splitc              
   C   sv   ddddddddd	d
g
}t dftdffD ]H\}}t|}|D ]2\}}}| ||||||||||||f  q<q(d S )Nr  Nr   r   r[  r   r]  r[  r   r   r[  r   r`  r[  r   rb  r   r   rb  r   r   rb  r   r   rb  r   r   rb  r   r  z'%s'.split('%s', %d)?z'%s'.split('%s', maxsplit=%d)?)rw   ry   r   r   )r   rh  r   Zfmt_strr   r  r  rv   r   r   r   test_split_with_maxsplit  s0    
z$TestUnicode.test_split_with_maxsplitc              !   C   s   t }t|}dttdddddddd	d
ddddddddddddddddddddg}ddd d!d"d#d$| d% g}|D ] }| ||||d&|f  qtd S )'Nr   	   r      r                                                         	   
   (   )   /   _    0  r]     🐍 ⚡   🐍 ⚡ 🐍   🐍   ⚡ 🐍       🐍   ⚡ 🐍    🐍
   ⚡ 🐍  z'%s'.split()?)rz   r   r   mapr   r   )r   r   r   all_whitespacerh  r  r   r   r   test_split_whitespace  s\                             
	
z!TestUnicode.test_split_whitespacec              
   C   sl   t }t|}tjttjtf}dD ]F\}}| t}|d| W 5 Q R X d	||}| 
|t|j q d S )N))noneN)r  None
z"keepends" must be {}, not {})r   r   r   r  r  Booleanr(   r   r
   r  r!  r"  r#  )r   r   r   r$  tyr   r%  r  r   r   r   %test_split_exception_invalid_keepends-  s    z1TestUnicode.test_split_exception_invalid_keependsc                 C   sN   t }t|}dddddddg}d}|D ]"}| j||||||d	 q&d S )
Nr   r0  
abcabc
   🐍⚡   🐍⚡🐍    aba baba

abcz*Results of "{}".splitlines() must be equalr  )r}   r   r   r  r  r   r   r   test_splitlines8  s    
 zTestUnicode.test_splitlinesc           
   	   C   s   t tg}ddg}ddddddd	g}d
dddddg}t||D ]H\}}t|}t||D ],\}}	| j|||	|||	|||	d qVq<d S )Nz,Results of "{}".splitlines({}) must be equalz5Results of "{}".splitlines(keepends={}) must be equalr   r0  r4  r5  r6  r7  r8  TFr   r   r   d   r  )r   r   r  r   r   r   r  )
r   r  r  r  Zall_keependsr   r  r   r   r   r   r   r   test_splitlines_with_keependsC  s"    
 
z)TestUnicode.test_splitlines_with_keependsc              
   C   sX   |    t}t|}||fD ]6}| t}|dd W 5 Q R X | dt|j qd S r  )rS  r   r   r   rT  r!  r"  r#  r  r   r   r   test_rsplit_exception_empty_sepV  s    z+TestUnicode.test_rsplit_exception_empty_sepc              
   C   sb   t }t|}tjtf}dD ]B}| t}|d|d W 5 Q R X d|}| |t	|j
 qd S )Nr  r   r  z "maxsplit" must be {}, not float)r   r   r   r  r  r   r
   r  r!  r"  r#  )r   r   r   r$  r;   r%  r  r   r   r   )test_rsplit_exception_noninteger_maxsplitb  s    

z5TestUnicode.test_rsplit_exception_noninteger_maxsplitc              
   C   s^   t }t|}ddddddddd	d
g
}d}|D ],\}}| j|||||||||d q,d S )Nr  rZ  r\  r^  r_  ra  rc  rd  re  rf  z*Results of "{}".rsplit("{}") must be equalr  )r   r   r   r  rg  r   r   r   test_rsplitm  s$    
zTestUnicode.test_rsplitc           
   
   C   s   t tg}ddddddddd	d
g
}ddg}t||D ]J\}}t|}|D ]4\}}}	| j||||	||||	||||	d qFq2d S )Nr  r   r  r  r  r  r  r  r  r  z.Results of "{}".rsplit("{}", {}) must be equalz7Results of "{}".rsplit("{}", maxsplit={}) must be equalr  )r   r   r  r   r   r  )
r   r  rh  r  r   r  r   r  r;   rv   r   r   r   test_rsplit_with_maxsplit  s0    
z%TestUnicode.test_rsplit_with_maxsplitc              !   C   s   t }t|}dttdddddddd	d
ddddddddddddddddddddg}ddd d!d"d#d$| d% g}d&}|D ] }| |||||| qxd S )'Nr   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$  r]  r%  r&  r'  r(  r)  r*  z&Results of "{}".rsplit() must be equal)r   r   r   r+  r   r   r  )r   r   r   r,  rh  r  r   r   r   r   test_rsplit_whitespace  sX                             
	z"TestUnicode.test_rsplit_whitespacec                 C   s>   t }t|}ddg}|D ] }| ||||d|f  qd S )Nr      🐍🐍🐍z'%s'.join([])?)r   r   r   )r   r   r   rh  r;   r   r   r   test_join_empty  s    
zTestUnicode.test_join_emptyc              	   C   sX   t }t|}| t}|ddddg W 5 Q R X t|j}| d| | d| d S )Nr   r   r   r1  z,During: resolving callee type: BoundFunctionzreflected list(int)r   r   r   r
   r"  r#  r!  )r   r   r   r%  Zexc_messager   r   r   test_join_non_string_exception  s    
z*TestUnicode.test_join_non_string_exceptionc                 C   st   t }t|}ddddgfddddgfddddgfddgd fg}|D ]*\}}| ||||||d||f  qDd S )	Nr   r   Zbbbbr   rA     ⚡⚡r  '%s'.join('%s')?r   r   r   r   r   r   rh  r;   partsr   r   r   	test_join  s    
zTestUnicode.test_joinc                 C   sH   t }t|}ddg}|D ]*\}}| ||||||d||f  qd S )N)r  123)rA  rD  rE  rF  rG  r   r   r   test_join_interleave_str  s    
z$TestUnicode.test_join_interleave_strc                 C   s   t dftdftdffD ]\}}t|}| t}|td d W 5 Q R X | dt|j	 tD ]8}t
ddD ](}| ||||||d	|||f  qnq`qd S )
Nr   r   r   r   r  The width must be an Integerr  r   z'%s'.%s(%d)?)r   r   r   r   r   r
   r   r!  r"  r#  r   r   )r   r   	case_namer   r%  r   r  r   r   r   test_justification  s    zTestUnicode.test_justificationc                 C   s   t dftdftdffD ]\}}t|}dD ]}| t}|td d| W 5 Q R X | dt|j	 tD ]>}t
dd	D ].}| ||||||||d
||||f  qxqjq*qd S )Nr   r   r   )r   +   úu   处r   r  rL  r  r   z'%s'.%s(%d, '%s')?)r   r   r   r   r   r
   r   r!  r"  r#  r   r   )r   r   rM  r   r   r%  r   r  r   r   r   test_justification_fillchar	  s(    
z'TestUnicode.test_justification_fillcharc                 C   s   |    tttfD ]}t|}dD ]<}| t}|td d| W 5 Q R X | dt	|j
 q"dD ]<}| t}|td d| W 5 Q R X | dt	|j
 qdqd S )N)r   z+0u   quiénu   处着r   r   z&The fill character must be exactly one)r   r  z"The fillchar must be a UnicodeType)rS  r   r   r   r   r   rT  r   r!  r"  r#  r
   )r   r   r   r   r%  r   r   r   %test_justification_fillchar_exception  s$    z1TestUnicode.test_justification_fillchar_exceptionc              	   C   sP   t }t|}tD ]:}td d d D ]&}| ||||||d||f  q"qd S r  )r3   r   r   r   r   r   r   r   test_inplace_concat4  s    
zTestUnicode.test_inplace_concatc                 C   s~   dd }t |}ddddddd	d
ddddg}ddddddddg}d}tdg | | D ]"}| j||||||d qVd S )Nc                 S   s   |   S r   )isidentifierr   r   r   r   r   >  s    z-TestUnicode.test_isidentifier.<locals>.pyfuncr   Zr   Zb0bcZb_   µu   𝔘𝔫𝔦𝔠𝔬𝔡𝔢r   [   ©0               ab   ab	   aba	   abaz,Results of "{}".isidentifier() must be equalr   r  r   r   r   r  r   r   r   cpythonZcpython_extrasr  r   r   r   r   test_isidentifier=  s$          zTestUnicode.test_isidentifierc                    st  ddddddddd	d
ddddddddddddddddddddg}t dftd ftd!ffD ]<\ }t }|D ]&\}}|  |||d"||f  qjqVtdftd ftd!ffD ]\ }t }t	tj	t
tj	}t|g } fd#d$}||fD ]6}	| t}
|	d%d& W 5 Q R X | d't|
j q||fD ]:}	|D ].\}}|  |||	||d(|||f  q:q2qd S ))N)ass ciiZai)rg  N)Zassciiai )zasscii rh  )	 asscii  rh  )ri  zasci )ri  r   )z      r   )r   r   r   )r   Nr  )
  asscii  rh  )rj  r   )rj  N)r      étú? )     tú quién te crees?   rk  )u     tú qrees?   r   )rl  Nr   )    大处大处  r   )z	
abcd	z	a)rm  N)z	 abcd 	N)z
 abcd 
N)z abcd N)z abcd N)z abcd N)u
    abcd N)u	   abcd Nr   r   r   z
'%s'.%s()?c                     s(   t t jt t j}t|g  d S r   )r   r  r  r  r   )r  badr  r   r   r    s    
z8TestUnicode.test_strip.<locals>.try_compile_bad_optionalr  r  z%The arg must be a UnicodeType or Nonez'%s'.%s('%s')?)r   r   r   r   r   r   r   r   r   r  r  r   r
   r!  r"  r#  )r   ZSTRIP_CASESrM  r   stringr   Zsig1r  r  r  r%  r   r  r   
test_stripN  s    "


zTestUnicode.test_stripc              	   C   sx   dd }t |}ddddddd	d
dg	}ddddddddg}d}tdg | | D ]"}| j||||||d qPd S )Nc                 S   s   |   S r   )isspacer   r   r   r   r     s    z(TestUnicode.test_isspace.<locals>.pyfuncu    u    u   —   𐐁   𐐧   𐐩   𐑎   🐍   👯r[  r\  r]  r^  r_  r`  ra  rb  z'Results of "{}".isspace() must be equalr   r  rc  rd  r   r   r   test_isspace  s"    
     zTestUnicode.test_isspacec           
      C   s   t }t|}d}dd tD }dddddd	d
ddddddddddddg}t| | }|D ],}||}||}	| ||	||||	 qXd S )Nz0'{0}'.py_istitle() = {1}
'{0}'.c_istitle() = {2}c                 S   s   g | ]}|  qS r   r   r   r    r   r   r   rl    s     z,TestUnicode.test_istitle.<locals>.<listcomp>r   z    z  AA  z  Ab  1ZA123ZA12Bcdz+abAZ12AbcZA12abcu   %^Abc 5 $% Def𐐁𐐩u   𐐧𐑎rt  ru  u   🐍 Isu   🐍 NOTu   👯Is   ῼu   Greek ῼitlecases ...)r   r   r   r   r  )
r   r   r   r  Zunicode_titlespecialZISTITLE_EXAMPLESr   r  r  r   r   r   test_istitle  s>    zTestUnicode.test_istitlec              	   C   sZ   dd }t |}ddddddd	d
dg	}d}t| D ]"}| j||||||d q2d S )Nc                 S   s   |   S r   )isprintabler   r   r   r   r     s    z,TestUnicode.test_isprintable.<locals>.pyfuncr   r   abcdefgzabcdefg
u   ʹu   ͸r[  rw  u   󠀠z+Results of "{}".isprintable() must be equalr  rc  r   r   r   re  r  r   r   r   r   test_isprintable  s      zTestUnicode.test_isprintablec                 C   s.   dd }t |}dg}| || ||  d S )Nc                 S   s   | d d  S r   r   r   r   r   r   r     s    z0TestUnicode.test_pointless_slice.<locals>.pyfuncr   r  r   r   r   r   r  r   r   r   test_pointless_slice  s    z TestUnicode.test_pointless_slicec                 C   s.   dd }t |}dg}| || ||  d S )Nc                 S   s   | d d d S )Nr   r   r  r   r   r   r     s    z/TestUnicode.test_walk_backwards.<locals>.pyfuncr   r  r  r   r   r   test_walk_backwards  s    zTestUnicode.test_walk_backwardsc                 C   s.   dd }t |}dg}| || ||  d S )Nc                 S   s   | d d d S Nr   r   r  r   r   r   r     s    z-TestUnicode.test_stride_slice.<locals>.pyfuncr   r  r  r   r   r   test_stride_slice  s    zTestUnicode.test_stride_slicec                 C   s0   dd }t |}ddg}| || ||  d S )Nc                 S   s   | |k S r   r   r   r   r   r   r   r     s    z)TestUnicode.test_basic_lt.<locals>.pyfuncr   r   r  r  r   r   r   test_basic_lt  s    zTestUnicode.test_basic_ltc                 C   s0   dd }t |}ddg}| || ||  d S )Nc                 S   s   | |kS r   r   r  r   r   r   r     s    z)TestUnicode.test_basic_gt.<locals>.pyfuncr   r   r  r  r   r   r   test_basic_gt  s    zTestUnicode.test_basic_gtc                 C   s\   dd }t |}ttddD ]:\}}dD ],}|||g}| j|| || d|d q(qd S )Nc                 S   sh   | dkr||kS | dkr ||kS | dkr0||k S | dkr@||kS | dkrP||kS | dkr`||kS d S d S )N==!=<><=>=r   optionr    r#   r   r   r   r     s    z+TestUnicode.test_comparison.<locals>.pyfuncr   r   r  r  r  r  r  r  r   failed on {}r  )r   r   r  r   r  )r   r   r   r    r#   cmpopr  r   r   r   test_comparison  s    
zTestUnicode.test_comparisonc                 C   sH   dd }t |}dg}| || ||  dg}| || ||  d S )Nc                 S   s0   d}t | r|d |  d S | | d |  S d S )Nr  Zb123IOrJ  r%   )r    r  r   r   r   r     s    z/TestUnicode.test_literal_concat.<locals>.pyfuncr    r   r  r   r   r   r  r   r   r   test_literal_concat  s    zTestUnicode.test_literal_concatc                 C   sB   dd }t |}dD ](}|g}| j|| || d|d qd S )Nc                 S   sp   d}d}| dkr||kS | dkr(||kS | dkr8||k S | dkrH||kS | dkrX||kS | dkrh||kS d S d S )	NZa123Zaa12r  r  r  r  r  r  r   r  r   r   r   r   %  s    z3TestUnicode.test_literal_comparison.<locals>.pyfuncr  r  r  r   r   r  )r   r   r   r  r  r   r   r   test_literal_comparison$  s    z#TestUnicode.test_literal_comparisonc                 C   s$   dd }t |}| | |  d S )Nc                   S   s   t dS Nr  r%   r   r   r   r   r   >  s    z,TestUnicode.test_literal_len.<locals>.pyfuncr  r   r   r   r   r   r   test_literal_len=  s    zTestUnicode.test_literal_lenc                 C   sX   dd }t |}dddtdd td dfD ](}|g}| j|| || d|d q*d S )Nc                 S   s   d|  S r  r   )whichr   r   r   r   D  s    z0TestUnicode.test_literal_getitem.<locals>.pyfuncr   r   r   r  r  )r   r  r   r  r   r   r   r   r  r   r   r   test_literal_getitemC  s    z TestUnicode.test_literal_getitemc                 C   sB   dd }t |}dD ](}|g}| j|| || d|d qd S )Nc                 S   s   | dkS )NZ
9876zabiuhr   r   r   r   r   r   M  s    z+TestUnicode.test_literal_in.<locals>.pyfunc)r   9rz  r   Z8uhaZ987r  r  r  r  r   r   r   test_literal_inL  s    zTestUnicode.test_literal_inc                 C   sD   dd }t |}tdddD ]"}| j|| || d|d qd S )Nc                 S   s   d | d|fS )Nr  Zcde)rb   re   r"   r   r   r   r   W  s    z0TestUnicode.test_literal_xyzwith.<locals>.pyfuncr  r   r   r  r  )r   r   r   r  r  r   r   r   test_literal_xyzwithV  s    z TestUnicode.test_literal_xyzwithc                 C   sB   dd }t |}dD ](}|g}| j|| || d|d qd S )Nc                 S   s   d | |  dfS )Nr  r   r=   r   r   r   r   r   `  s    z-TestUnicode.test_literal_find.<locals>.pyfunc)r   r  r  r  r  r   r   r   test_literal_find_  s    zTestUnicode.test_literal_findc                 C   sB   dd }t |}tD ](}|g}| j|| || d|d qd S )Nc                 S   s   |  S r   r   r   r   r   r   r   j  s    z$TestUnicode.test_not.<locals>.pyfuncr  r  rc  r  r   r   r   test_noti  s    zTestUnicode.test_notc              	   C   sj   dd }t |}ddddddd	d
dg	}dg}d}tdg | | D ]"}| j||||||d qBd S )Nc                 S   s   |   S r   )
capitalizer   r   r   r   r   t  s    z+TestUnicode.test_capitalize.<locals>.pyfunc   𐑏   𐑏𐑏   𐐧𐑏   𐑏𐐧
   X𐐧x𐑏u   hİu   ῒİu   ﬁnnish   AͅΣ   𐀀􀀀z*Results of "{}".capitalize() must be equalr   r  rc  rd  r   r   r   test_capitalizes  s        zTestUnicode.test_capitalizec           	      C   s   dd }t |}dd tD }ddddd	d
g}ddddddddg}dd |D }t| | | | D ](}|g}| j|| || d|d qdd S )Nc                 S   s   |   S r   )isupperr   r   r   r   r     s    z(TestUnicode.test_isupper.<locals>.pyfuncc                 S   s   g | ]}|  qS r   upperry  r   r   r   rl    s     z,TestUnicode.test_isupper.<locals>.<listcomp>AA12Aaa12a   大AA12A   大aa12a   AAAǄA	   A 1 1 大   Ⅷ   ⅷrr  rs  rt  ru  rv  rw  c                 S   s   g | ]}|d  qS r  r   ry  r   r   r   rl    s     r  r  rc  )	r   r   r   ZuppersrN  re  Zfourxcpyr   r  r   r   r   test_isupper  s    
  zTestUnicode.test_isupperc                 C   sB   dd }t |}tD ](}|g}| j|| || d|d qd S )Nc                 S   s   |   S r   r  r   r   r   r   r     s    z&TestUnicode.test_upper.<locals>.pyfuncr  r  rc  r  r   r   r   
test_upper  s    zTestUnicode.test_upperc                 C   sf   dd }t |}ddddddd	g}d
g}d}tdg | | D ]"}| j||||||d q>d S )Nc                 S   s   |   S r   )casefoldr   r   r   r   r     s    z)TestUnicode.test_casefold.<locals>.pyfuncr(  ZhELlo   ß   ﬁ   Σr  rW  r  z(Results of "{}".casefold() must be equalr   r  rc  rd  r   r   r   test_casefold  s    
 zTestUnicode.test_casefoldc                 C   st   dd }t |}ddddddd	g}d
dddddddg}d}tdg | | D ]"}| j||||||d qLd S )Nc                 S   s   |   S r   )isalphar   r   r   r   r     s    z(TestUnicode.test_isalpha.<locals>.pyfuncr{  rr  rs  rt  ru  rv  rw  r[  r\  r]  r^  r_  r`  ra  rb  z'Results of "{}".isalpha() must be equalr   r  rc  r   r   r   re  rN  r  r   r   r   r   test_isalpha  s         zTestUnicode.test_isalphac                 C   sV   dd }t |}ddddddd	g}d
}t| D ]"}| j||||||d q.d S )Nc                 S   s   |   S r   )r   r   r   r   r   r     s    z(TestUnicode.test_isascii.<locals>.pyfuncr    z       ér   z'Results of "{}".isascii() must be equalr  rc  r  r   r   r   test_isascii  s    zTestUnicode.test_isasciic              	   C   s\   t }t|}ddddddddd	g	}d
}tdg | D ]"}| j||||||d q4d S )Nr  r  u   𐑏𐑏 𐑏𐑏u   𐐧𐑏 𐐧𐑏u   𐑏𐐧 𐑏𐐧u   X𐐧x𐑏 X𐐧x𐑏u   ﬁNNISHu	   AΣ ᾡxyu   AΣAz%Results of "{}".title() must be equalr   r  )r   r   r   r   r  r  r   r   r   
test_title  s      zTestUnicode.test_titlec                 C   s|   dd }t |}ddddddd	d
ddddddddddg}dg}d}tdg | | D ]"}| j||||||d qTd S )Nc                 S   s   |   S r   )swapcaser   r   r   r   r     s    z)TestUnicode.test_swapcase.<locals>.pyfuncr  rs  r  r  r  r  r     İr     ͅΣr     AͅΣau   AΣͅ   Σͅ r  u   ῒr  z(Results of "{}".swapcase() must be equalr   r  rc  rd  r   r   r   test_swapcase  s.              zTestUnicode.test_swapcasec                 C   s   t }t|}dd tD }ddddddg}d	d
ddddddg}|dd |D 7 }d}t| dg | | D ]"}| j||||||d qjd S )Nc                 S   s   g | ]}|  qS r   r   ry  r   r   r   rl    s     z,TestUnicode.test_islower.<locals>.<listcomp>r  r  r  r  r  r  r  r  rr  rs  rt  ru  rv  rw  c                 S   s   g | ]}|d  qS r  r   ry  r   r   r   rl    s     z'Results of "{}".islower() must be equalr   r  )r   r   r   r   r  )r   r   r   ZlowersrN  re  r  r   r   r   r   test_islower  s       zTestUnicode.test_islowerc                 C   sv   dd }t |}ddddddd	d
g}ddddddddg}d}tdg | | D ]"}| j||||||d qNd S )Nc                 S   s   |   S r   )isalnumr   r   r   r   r   	  s    z(TestUnicode.test_isalnum.<locals>.pyfuncrr  rs  rt  ru     𝟶   𑁦   𐒠   🄇r[  r\  r]  r^  r_  r`  ra  rb  z'Results of "{}".isalnum() must be equalr   r  rc  r  r   r   r   test_isalnum	  s"         zTestUnicode.test_isalnumc           	      C   s   t }t|}ddddddg}ddd	d
ddddg}dddddddg}d}|| d}tdg | | | D ]"}| j||||||d qjd S )Nr  r  r  r  r  r  rr  rs  ru  rw  u   𐐧𐐧r  r  r  r  r  r  r  r  u   򏿾r  u   AΣ΢z%Results of "{}".lower() must be equalr   r  )r   r   r   r   r   r  )	r   r   r   rN  re  sigmaZextra_sigmar  r   r   r   r   
test_lower	  s&        
zTestUnicode.test_lowerc                 C   s   dd }t |}ddddddd	d
dddddddddddg}ddddddddg}d}tdg | | D ]"}| j||||||d qdd S ) Nc                 S   s   |   S r   )	isnumericr   r   r   r   r   ,	  s    z*TestUnicode.test_isnumeric.<locals>.pyfuncr   r   rZ     ①   ¼   ٠
01234567890123456789arr  rs  rt  ru  rv  rw     𑁥r  r  r  r  r[  r\  r]  r^  r_  r`  ra  rb  z)Results of "{}".isnumeric() must be equalr  rc  rd  r   r   r   test_isnumeric+	  s2               zTestUnicode.test_isnumericc                 C   s   dd }t |}ddddddd	d
ddddddg}ddddddddg}d}tdg | | D ]"}| j||||||d qZd S )Nc                 S   s   |   S r   )isdigitr   r   r   r   r   ?	  s    z(TestUnicode.test_isdigit.<locals>.pyfuncr  r  r  rr  rs  rt  ru  rv  rw  r  r  r  r  r  r[  r\  r]  r^  r_  r`  ra  rb  z'Results of "{}".isdigit() must be equalr   r  rc  rd  r   r   r   test_isdigit>	  s,    
        zTestUnicode.test_isdigitc                 C   s   dd }t |}ddddddd	d
dddddddddddg}ddddddddg}d}tdg | | D ]"}| j||||||d qdd S ) Nc                 S   s   |   S r   )	isdecimalr   r   r   r   r   R	  s    z*TestUnicode.test_isdecimal.<locals>.pyfuncr   r   rZ  r  r  r  r  r  rr  rs  rt  ru  rv  rw  r  r  r  r  r  r[  r\  r]  r^  r_  r`  ra  rb  z)Results of "{}".isdecimal() must be equalr  rc  rd  r   r   r   test_isdecimalQ	  s2               zTestUnicode.test_isdecimalc              
   C   s`   t }t|}ddddddddd	d
g
}|D ]2\}}}| ||||||||d|||f  q(d S )Nr  r   Ar   r[  r  r]  r[  r  r   r[  r  r`  r[  r  rb  r   r  rb  r   r  rb  r   r  rb  r   r  rb  r   r  z'%s'.replace('%s', '%s')?)rT   r   r   )r   r   r   rh  r  old_strnew_strr   r   r   test_replaced	  s(    
zTestUnicode.test_replacec           	      C   s|   t }t|}ddddddddd	d
g
}ddddg}|D ]B\}}}|D ]2}| ||||||||||d||||f  qBq4d S )Nr  r  r  r  r  r  r  r  r  r  r   r   r   r  z'%s'.replace('%s', '%s', '%s')?)rV   r   r   )	r   r   r   rh  Z
count_testr  r  r  rI   r   r   r   test_replace_with_count{	  s,    
z#TestUnicode.test_replace_with_countc              	   C   s   dd }t |}| t}|dddd W 5 Q R X d}| |t|j | t}|dddd	 W 5 Q R X d
}| |t|j | t}|dddd	 W 5 Q R X d
}| |t|j d S )Nc                 S   s   |  |||S r   rR   rU   r   r   r   r   	  s    z4TestUnicode.test_replace_unsupported.<locals>.pyfuncZ
abababababbaZqqqg      @z7Unsupported parameters. The parameters must be Integer.r   r1  z!The object must be a UnicodeType.)r   r   r
   r!  r"  r#  )r   r   r   r%  r  r   r   r   test_replace_unsupported	  s    z$TestUnicode.test_replace_unsupportedN)~r   r   r   r   r   r   r   r   r  r  r  r  r  r  r	  r  r  r&  r8  r<  r>  r@  rB  rC  rE  rF  rI  rK  rL  rP  rY  ri  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  r  r  r  r  r  r  r  r  r  r  r  r	  r-  r3  r9  r;  r<  r=  r>  r?  r@  rB  rC  rI  rK  rN  rQ  rR  rS  rf  rp  rx  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  r  r  r  r  r   r   r   r   r     s   



	
	J$	
	


r   c                   @   s<   e Zd Zdd Zdd Zdd Zdd Zd	d
 Zdd ZdS )TestUnicodeInTuplec                 C   s@   t dd }| | |  t dd }| | |  d S )Nc                   S   s   ddk S )N)r   bbr   r   r   r   r   r  	  s    z9TestUnicodeInTuple.test_const_unicode_in_tuple.<locals>.fc                   S   s   ddk S )N)ccr  r   r   r   r   r   r  	  s    r   r   r   r   r  r   r   r   test_const_unicode_in_tuple	  s    

z.TestUnicodeInTuple.test_const_unicode_in_tuplec                 C   s@   t dd }| | |  t dd }| | |  d S )Nc                   S   s   ddk S )Nr   r   )r  r   r   r   r   r   r   r  	  s    z@TestUnicodeInTuple.test_const_unicode_in_hetero_tuple.<locals>.fc                   S   s   ddk S )Nr  )r   r   r   r   r   r   r   r  	  s    r  r  r   r   r   "test_const_unicode_in_hetero_tuple	  s    

z5TestUnicodeInTuple.test_const_unicode_in_hetero_tuplec                 C   s.   t dd }tD ]}| ||t| qd S )Nc                 S   s   | j S r   r  r   r   r   r   r  	  s    z3TestUnicodeInTuple.test_ascii_flag_unbox.<locals>.f)r   r   r   r   r  r   r   r   test_ascii_flag_unbox	  s    
z(TestUnicodeInTuple.test_ascii_flag_unboxc                 C   s   t dd }| | d d S )Nc                  S   sL   d} d}d}d}d | |gjd | |gjd | |gjd ||gjfS )Nr  rJ  r   r   ,)r   r  s1s2Zs3Zs4r   r   r   r  	  s    z2TestUnicodeInTuple.test_ascii_flag_join.<locals>.f)r   r   r   r   r  r  r   r   r   test_ascii_flag_join	  s    

z'TestUnicodeInTuple.test_ascii_flag_joinc                 C   s   t dd }| | d d S )Nc                  S   s4   d} d}| d j | dd  j |d j |dd  j fS )NZabc123u   🐍⚡🐍⚡🐍⚡r   r   r  )r  r  r   r   r   r  	  s
    z5TestUnicodeInTuple.test_ascii_flag_getitem.<locals>.f)r   r   r   r   r  r  r   r   r   test_ascii_flag_getitem	  s    
z*TestUnicodeInTuple.test_ascii_flag_getitemc                 C   s   t dd }| | d d S )Nc                  S   s<   d} d}d}d}| | j | | j || j | d j |d j fS )Nr  rJ  r   r   r   r  r  r   r   r   r  	  s    z5TestUnicodeInTuple.test_ascii_flag_add_mul.<locals>.f)r   r   r   r   r   r  r  r   r   r   test_ascii_flag_add_mul	  s    
z*TestUnicodeInTuple.test_ascii_flag_add_mulN)	r   r   r   r  r   r  r  r  r  r   r   r   r   r  	  s   
r  c                   @   s4   e Zd Zdd Zdd Zdd Zdd Zd	d
 ZdS )TestUnicodeIterationc                 C   s.   t }t|}tD ]}| |||| qd S r   )r   r   r   assertPreciseEqualr   r   r   r   r   r   r   test_unicode_iter	  s    z&TestUnicodeIteration.test_unicode_iterc                 C   s    t }t|}| | |  d S r   )r   r   r
  r  r   r   r   test_unicode_literal_iter 
  s    z.TestUnicodeIteration.test_unicode_literal_iterc                 C   s.   t }t|}tD ]}| |||| qd S r   )r   r   r   r
  r  r   r   r   test_unicode_enumerate_iter
  s    z0TestUnicodeIteration.test_unicode_enumerate_iterc                 C   sN   |    t}t|}||fD ],}tD ]"}| t || W 5 Q R X q$qd S r   )rS  r   r   r   r   StopIteration)r   r   r   r  r   r   r   r   test_unicode_stopiteration_iter
  s    z4TestUnicodeIteration.test_unicode_stopiteration_iterc              
   C   s:   t }t|}||fD ] }| t |  W 5 Q R X qd S r   )r   r   r   r  )r   r   r   r  r   r   r   'test_unicode_literal_stopiteration_iter
  s
    z<TestUnicodeIteration.test_unicode_literal_stopiteration_iterN)r   r   r   r  r  r  r  r  r   r   r   r   r	  	  s
   	r	  c                   @   s<   e Zd Zdd Zdd Zdd Zdd Zd	d
 Zdd ZdS )TestUnicodeAuxillaryc                 C   s8   t }t|}tD ]"}|D ]}| |||| qqd S r   )r   r   r   r
  )r   r   r   exr   r   r   r   test_ord
  s
    zTestUnicodeAuxillary.test_ordc                 C   s   |    t}t|}||fD ]>}dD ]4}| t}|| W 5 Q R X | dt|j q$q| t}|d W 5 Q R X | t	t|j d S )N)r   r  zord() expected a charactergGz?)
rS  r   r   r   	TypeErrorr!  r"  r#  r
   r   )r   r   r   rX  chr%  r   r   r   test_ord_invalid%
  s    z%TestUnicodeAuxillary.test_ord_invalidc                 C   sb   t }t|}tD ]*}|D ] }t|}| |||| qqdtfD ]}| |||| qDd S )Nr   )r   r   r   r   r
  r   )r   r   r   r  r    r   r   r   r   test_chr8
  s    zTestUnicodeAuxillary.test_chrc                 C   s   t }t|}||fD ]F}dtd fD ]4}| t}|| W 5 Q R X | dt|j q$q| t}|d W 5 Q R X | t	t|j d S )Nr0  r   zchr() arg not in ranger  )
r   r   r   r   rT  r!  r"  r#  r
   r   )r   r   r   rX  vr%  r   r   r   test_chr_invalidC
  s    z%TestUnicodeAuxillary.test_chr_invalidc                    sZ   dd  t  dd }t fdd}d}| |||| | tjtjjj	 d S )Nc                 S   s   dS )NTr   r   r   r   r   barU
  s    z7TestUnicodeAuxillary.test_unicode_type_mro.<locals>.barc                    s,   d t | tjr t | tjr d  fddS )NFTc                    s    S r   r   r   okr   r   <lambda>^
      zLTestUnicodeAuxillary.test_unicode_type_mro.<locals>.ol_bar.<locals>.<lambda>)
isinstancer   rU  Hashabler   r   r  r   ol_barX
  s
    z:TestUnicodeAuxillary.test_unicode_type_mro.<locals>.ol_barc                    s    | S r   r   )Zstrinstr  r   r   r   `
  s    z7TestUnicodeAuxillary.test_unicode_type_mro.<locals>.foor  )
r   r   r   r   r!  r   r!  r  r   __mro__)r   r"  r   instr   r#  r   test_unicode_type_mroS
  s    
z*TestUnicodeAuxillary.test_unicode_type_mroc              	   C   s   dd }dd }dd }dd }d	d
 }|  |dt|d |  |dt|d |  |dt|d ddg}t||}dt| d}|  || | t}	t|ddg W 5 Q R X d}
| |
t|	j |  | t|  dS )z@test f-string support, which requires bytecode handling
        c                 S   s   d| d  dS )NZAA_r1  Z_Br   r  r   r   r   impl1l
  s    z2TestUnicodeAuxillary.test_f_strings.<locals>.impl1c                 S   s
   | d  S r  r   r  r   r   r   impl2p
  s    z2TestUnicodeAuxillary.test_f_strings.<locals>.impl2c                 S   s
   d|  S )NABC_r   r  r   r   r   impl3t
  s    z2TestUnicodeAuxillary.test_f_strings.<locals>.impl3c                 S   s   d| dS )Nr)  rZ  r   r  r   r   r   impl4x
  s    z2TestUnicodeAuxillary.test_f_strings.<locals>.impl4c                   S   s    S r   r   r   r   r   r   impl5|
  s    z2TestUnicodeAuxillary.test_f_strings.<locals>.impl5r1  r   ZDEr  BzABC_<object type:r  z*format spec in f-strings not supported yetN)r   r   r   r   r   r!  r"  r#  )r   r'  r(  r*  r+  r,  Zlist_arggotexpectedr%  r  r   r   r   test_f_stringsh
  s"    z#TestUnicodeAuxillary.test_f_stringsN)	r   r   r   r  r  r  r  r&  r0  r   r   r   r   r  
  s   r  __main__)q	itertoolsr   r   Znumbar   r   Z
numba.corer   ZunittestZnumba.tests.supportr   r   r	   Znumba.core.errorsr
   r   Znumba.cpython.unicoder   Znumba.core.types.functionsr   Znumba.extendingr   r   r   r!   r$   r'   r)   r,   r.   r0   r1   r2   r3   r4   r5   r6   r7   r8   r<   r?   rB   rE   rG   rJ   rK   rL   rO   rP   rQ   rT   rV   rY   rZ   r[   r^   r_   r`   rc   rf   ri   rl   rm   rn   ro   rp   rq   rt   rw   ry   rz   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   r   r   r   r   r   r  r  r   r  r	  r  r   mainr   r   r   r   <module>   sP  	$                M$v
