U
    ,dip                     @   s  d dl mZ d dl mZ d dlmZ d dlmZ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 ejdk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)d0d1 Z*d2d3 Z+d4d5 Z,d6d7 Z-d8d9 Z.d:d; Z/d<d= Z0d>d? Z1d@dA Z2dBdC Z3dDdE Z4dFdG Z5dHdI Z6dJdK Z7dLdM Z8dNdO Z9dPdQ Z:dRdS Z;dTdU Z<dVdW Z=dXdY Z>dZd[ Z?d\d] Z@d^d_ ZAd`da ZBdbdc ZCddde ZDdfdg ZEdhdi ZFdjdk ZGdldm ZHdndo ZIdpdq ZJdrds ZKdtdu ZLdvdw ZMdxdy ZNdzd{ ZOd|d} ZPd~d 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)typesutilsN)TestCaseno_pyobj_flagsMemoryLeakMixin)TypingErrorUnsupportedError)_MAX_UNICODE)_header_lead)overload)      c                 C   s   t dd | D S )Nc                 s   s   | ]}t |d k V  qdS )   Nord).0c r   </tmp/pip-unpacked-wheel-eu7e0c37/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    r0   c                 C   s
   |  |S r    )zfillr$   r   r   r   zfill_usecase2   s    r2   c                 C   s   | | S r    r   r$   r   r   r   concat_usecase6   s    r3   c                 C   s   | | S r    r   r$   r   r   r   repeat_usecase:   s    r4   c                 C   s   | |7 } | S r    r   r$   r   r   r   inplace_concat_usecase>   s    r5   c                 C   s   | |kS r    r   r$   r   r   r   
in_usecaseC   s    r6   c                 C   s   | |k S r    r   r$   r   r   r   
lt_usecaseG   s    r7   c                 C   s   | |kS r    r   r$   r   r   r   
le_usecaseK   s    r8   c                 C   s   | |kS r    r   r$   r   r   r   
gt_usecaseO   s    r9   c                 C   s   | |kS r    r   r$   r   r   r   
ge_usecaseS   s    r:   c                 C   s
   |  |S r    )	partitionr   sepr   r   r   partition_usecaseW   s    r>   c                 C   s
   |  |S r    findr$   r   r   r   find_usecase[   s    rA   c                 C   s   |  ||S r    r?   r"   r%   startr   r   r   find_with_start_only_usecase_   s    rD   c                 C   s   |  |||S r    r?   r"   r%   rC   endr   r   r   find_with_start_end_usecasec   s    rG   c                 C   s
   |  |S r    )
rpartitionr<   r   r   r   rpartition_usecaseg   s    rI   c                 C   s
   |  |S r    countr$   r   r   r   count_usecasek   s    rL   c                 C   s   |  ||S r    rJ   rB   r   r   r   count_with_start_usecaseo   s    rM   c                 C   s   |  |||S r    rJ   rE   r   r   r   count_with_start_end_usecases   s    rN   c                 C   s
   |  |S r    rfindr$   r   r   r   rfind_usecasew   s    rQ   c                 C   s   |  ||S r    rO   rB   r   r   r   rfind_with_start_only_usecase{   s    rR   c                 C   s   |  |||S r    rO   rE   r   r   r   rfind_with_start_end_usecase   s    rS   c                 C   s   |  ||S r    replace)r   r"   r%   r   r   r   replace_usecase   s    rV   c                 C   s   |  |||S r    rT   r   r"   r%   rK   r   r   r   replace_with_count_usecase   s    rX   c                 C   s
   |  |S r    rindexr$   r   r   r   rindex_usecase   s    r[   c                 C   s   |  ||S r    rY   rB   r   r   r   rindex_with_start_only_usecase   s    r\   c                 C   s   |  |||S r    rY   rE   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^   rB   r   r   r   index_with_start_only_usecase   s    ra   c                 C   s   |  |||S r    r^   rE   r   r   r   index_with_start_end_usecase   s    rb   c                 C   s
   |  |S r    )
startswithr$   r   r   r   startswith_usecase   s    rd   c                 C   s
   |  |S r    endswithr$   r   r   r   endswith_usecase   s    rg   c                 C   s   |   S r    
expandtabsr   r   r   r   expandtabs_usecase   s    rj   c                 C   s
   |  |S r    rh   r   tabsizer   r   r   expandtabs_with_tabsize_usecase   s    rm   c                 C   s   | j |dS )N)rl   rh   rk   r   r   r   %expandtabs_with_tabsize_kwarg_usecase   s    rn   c                 C   s   |  ||S r    re   rB   r   r   r    endswith_with_start_only_usecase   s    ro   c                 C   s   |  |||S r    re   rE   r   r   r   endswith_with_start_end_usecase   s    rp   c                 C   s
   |  |S r    splitr$   r   r   r   split_usecase   s    rs   c                 C   s   |  ||S r    rq   r"   r%   maxsplitr   r   r   split_with_maxsplit_usecase   s    rv   c                 C   s   | j ||dS N)ru   rq   rt   r   r   r   !split_with_maxsplit_kwarg_usecase   s    rx   c                 C   s   |   S r    rq   r!   r   r   r   split_whitespace_usecase   s    ry   c                 C   s   |   S r    
splitlinesr   r   r   r   splitlines_usecase   s    r|   c                 C   s
   |  |S r    rz   r   keependsr   r   r    splitlines_with_keepends_usecase   s    r   c                 C   s   | j |dS )N)r~   rz   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=   ru   r   r   r   rsplit_with_maxsplit_usecase   s    r   c                 C   s   | j ||dS rw   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   1  s    r   c                  C   s   g } dD ]}|  | q| S r   r   )r   r-   r   r   r   literal_iter_usecase5  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_usecase<  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_usecaseE  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_usecaseL  s
    r   c                 C   s   |   S r    )islowerr!   r   r   r   islower_usecaseT  s    r   c                 C   s   |   S r    lowerr!   r   r   r   lower_usecaseX  s    r   c                 C   s   t | S r    r   r!   r   r   r   ord_usecase\  s    r   c                 C   s   t | S r    )chrr!   r   r   r   chr_usecase`  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   e  s    zBaseTest.setUp)__name__
__module____qualname__r   __classcell__r   r   r   r   r   d  s   r   r   ascii12345
1234567890   ¡Y tú quién te crees?   🐍⚡r   aaabZaababZ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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efd+d,Zd-d. Zd/d0 Zefd1d2Zd3d4 Zd5d6 Zd7d8 Zd9d: Z d;d< Z!d=d> Z"d?d@ Z#dAdB Z$dCdD Z%dEdF Z&dGdH Z'dIdJ Z(dKdL Z)dMdN Z*dOdP Z+dQdR Z,dSdT Z-dUdV Z.dWdX Z/dYdZ Z0d[d\ Z1d]d^ Z2d_d` Z3dadb Z4dcdd Z5dedf Z6dgdh Z7didj Z8dkdl Z9dmdn Z:dodp Z;dqdr Z<dsdt Z=efdudvZ>efdwdxZ?dydz Z@d{d| ZAd}d~ ZBdd ZCdd ZDdd ZEdd ZFdd ZGdd ZHdd ZIdd ZJdd ZKdd ZLdd ZMdd ZNdd ZOdd ZPdd ZQdd ZRdd ZSdd ZTefddZUdd ZVdd ZWdd ZXdd ZYdd ZZefddZ[efddZ\efddZ]efddZ^efddZ_dd Z`dd Zadd Zbdd Zcdd ZdddĄ ZeddƄ ZfddȄ Zgddʄ Zhdd̄ Zidd΄ ZjddЄ Zkdd҄ ZlddԄ Zmenoepdաddׄ Zqddل Zrddۄ Zsdd݄ Ztdd߄ Zudd Zvdd Zwdd Zxdd Zydd Zzdd 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 )N%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  r7   r   r   r   r   r   test_lt  s    zTestUnicode.test_ltc                 C   s   |  t d S r    )r  r8   r  r   r   r   test_le  s    zTestUnicode.test_lec                 C   s   |  t d S r    )r  r9   r  r   r   r   test_gt  s    zTestUnicode.test_gtc                 C   s   |  t d S r    )r  r:   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)rj   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   rm   rn   r   zipr   r   r  )r   fnsmessagesr  r   rl   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)rm   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   sf   t }t|}tD ]P}dd|d d |dd  ||| fD ]&}| ||||||d||f  q8qd S Nr   r"   r   r   )rd   r   r   r   r   r   r   r   test_startswith-  s    (
zTestUnicode.test_startswithc              	   C   sf   t }t|}tD ]P}dd|d d |dd  ||| fD ]&}| ||||||d||f  q8qd S r&  )rg   r   r   r   r   r   r   r   test_endswith6  s    (
zTestUnicode.test_endswithc           
   
   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 )Nhello
helloworldr   heellolowoloohellohellohellor   r"   r'  r   z)Results "{}".endswith("{}") must be equalr  rg   r   r   r   r  )
r   r   r   cpython_strcpython_subs
extra_subsr   default_subssub_strr  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/  r0  r1  r   r"   r'  r   r   z-Results "{}".endswith("{}", {}) must be equalr  )ro   r   r   listr   r   r  )r   r   r   r3  r4  r5  r   r6  r7  rC   r  r   r   r   test_endswith_with_startR  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/  r0  r1  r   r"   r'  r   r9  r   zOResults "{}".endswith("{}", {}, {})                               must be equalr  rp   r   r   r:  r   r   r  )r   r   r   r3  r4  r5  r   r6  r7  rC   rF   r  r   r   r   test_endswith_with_start_endg  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/  r0  r1  r   r"   r'  r   z'Results "{}".endswith({}) must be equalr  r2  )r   r   r   r3  r4  r5  r   r6  r7  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 r<  r=  )r   r   r   r3  r4  r5  r   r6  r7  rC   rF   r  r?  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   r'  r   z'%s' in '%s'?)r6   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      ⚡abcabcrP  r   rP     🐍⚡🐍rP  abababar   rW  r   rW  r   rW  r   rW  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   rB  Nr'  r   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  )rA   r   r   r   r  )
r   r   r   r   r6  r4  r   subsr7  r  r   r   r   	test_find  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   rB  r'  r   r9  r   z)Results "{}".find("{}", {}) must be equalr  )rD   r   r   r:  r   r   r  r   r   r   r   r7  rC   r  r   r   r   test_find_with_start_only  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 )	Nr9  r   r   rB  r'  r   z0Results of "{}".find("{}", {}, {}) must be equalr  )rG   r   r:  r   r   r   r   r  
r   r   r   startsendsr   r7  rC   rF   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))皙?   rC   )r         ?rF   r   Zsciz"{}" must be {}, not float)rG   r   r   r  NoneTyper  r
   r  r   r!  r"  )	r   r   r   acceptedrC   rF   namer$  r  r   r   r   (test_find_exception_noninteger_start_end  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 rF  )rH  rI   r   r  rI  r   r!  r"  r   rJ  rK  r
   r  rL  r   r   r   %test_rpartition_exception_invalid_sep  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 )NrO  rQ  rS  rT  rV  rX  rY  rZ  r[  z.Results of "{}".rpartition("{}") must be equalr  )rI   r   r   r  r\  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})rL   r   UNICODE_COUNT_EXAMPLESr   r  )r   r   r   	error_msgr   sub	py_resultc_resultr   r   r   
test_countB  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}   )rM   r   r  r   r   r  )	r   r   r   r  r   r  r-   r  r  r   r   r   test_count_with_startM  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  )rN   r   r  r   r   r   r  )
r   r   r   r  r   r  r-   jr  r  r   r   r   test_count_with_start_enda  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?r      z(The substring must be a UnicodeType, not)r   rN   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      )rN   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 r_  r   r`  r   r   r   ra    s    z*TestUnicode.test_rfind.<locals>.<listcomp>uf   Ăaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar   rb  rc  rd  uh   􀌄aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaare  rf  rg  abcdefghiabcabcr      aĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂr     a􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄  Ă􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄rk  u   Ăau   􀌄arl  u   􀌄Ă   _aĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂĂ_a  _a􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄  _Ă􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄􀌄   _Ăz&Results "{}".rfind("{}") must be equalr  )rQ   r   r   r   r  	r   r   r   r6  r4  r   rr  r7  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   rB  r'  r   r9  r   z*Results "{}".rfind("{}", {}) must be equalr  )rR   r   r   r:  r   r   r  rt  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 )	Nr9  r   r   rB  r'  r   z1Results of "{}".rfind("{}", {}, {}) must be equalr  )rS   r   r:  r   r   r   r   r  rv  r   r   r   test_rfind_with_start_end  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   rQ   r   r  r
   r  r   rJ  r   r!  r"  )r   r   r   r7  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   rB  r'  r   r{  Fr   r   z"start" must be {}gTz"end" must be {})r   rS   r   r  r~  r   r   r  r
   r  r   r!  r"  )	r   r   r#  r   r7  rC   rF   r$  r  r   r   r   test_rfind_wrong_start_end  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   rS   r  Zwrong_sig_optionalr   r   r    try_compile_wrong_start_optional  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   rS   r  r   r   r   try_compile_wrong_end_optional  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   r7  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   Nr'  r   r   r`  r   r   r   ra     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  )r[   r   r   r   r  r  r   r   r   test_rindex  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   r`  r   r   r   ra  8  s    z*TestUnicode.test_index.<locals>.<listcomp>r  r   r  r  rh  r   ri  rj  r   rm  rn  ro  rp  rq  z&Results "{}".index("{}") must be equalr  )r`   r   r   r   r  r  r   r   r   
test_index4  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   r'  r   r      r  )	ra   r\   r  r   r(   r:  r   r   r  )r   pyfuncsr  unicode_examplesr   r  r   r   r   r  r7  rw  rC   r   r   r   !test_index_rindex_with_start_onlyL  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   r'  r   r   r   r   r  r  )
rb   r]   r  r   r(   r:  r   r   r   r  )r   r  r  r  r   r  r   r   r   r  r7  rw  rx  rC   rF   r   r   r    test_index_rindex_with_start_endh  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   r'  r   r   r   r  zsubstring not found)rH  rb   r]   r   r(   r:  r   r   r  rI  r   r!  r"  )r   r  r  r   r   r   r   r  r7  rw  rx  rC   rF   rM  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 rz  )r   r  r~  rb   r]   r   r  r
   r  r   r!  r"  )
r   r  r  r   r   rC   rF   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  )r0   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)
rH  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 )Nr'  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   ¡¡¡着着着r'  r   r   r   r   r  )r0   r   r(   r  r   )r   r   r   r  r   r-   r  r  r   r   r   test_getitem_slice2_kind  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r'  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_slice3  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  )r0   r   r   r(   r  r   )	r   r   r   r  r   r-   r  r  r  r   r   r   test_getitem_slice3_kind  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 )Nr'  r   r   r  r  r  r  r   r   r   test_slice3_error  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   )	r2   r   r  r
   r   r!  r"  r   r   )r   r   r   ZZFILL_INPUTSr$  r   widthr   r   r   
test_zfill4  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'?)r3   r   r   r   r   r   r   r   test_concatS  s    
zTestUnicode.test_concatc                 C   sT   t }t|}tD ]>}dD ]4}| |||||| | |||||| qqd S )N)r   r   r   r   r   r  r|  r   r     F   )r4   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>))	rH  r   r4   r  r
   r   r   r!  r"  r  r   r   r   test_repeat_exception_floatf  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   rG  )rH  rs   r   r  rI  r   r!  r"  r   r   r   rM  r$  r   r   r   test_split_exception_empty_sepn  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)rv   r   r  r
   r   r!  r"  )r   r   r   r=   r$  r   r   r   (test_split_exception_noninteger_maxsplitz  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 NrO  rQ  rS  rT  rV  rX  rY  rZ  r[  z'%s'.split('%s')?)rs   r   r   )r   r   r   r]  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   rP  r   rR  rP  r   r   rP  r   rU  rP  r   rW  r   r   rW  r   r   rW  r   r   rW  r   r   rW  r   r|  z'%s'.split('%s', %d)?z'%s'.split('%s', maxsplit=%d)?)rv   rx   r   r   )r   r]  r   Zfmt_strr   r  r  ru   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  rR     🐍 ⚡   🐍 ⚡ 🐍   🐍   ⚡ 🐍       🐍   ⚡ 🐍    🐍
   ⚡ 🐍  z'%s'.split()?)ry   r   r   mapr   r   )r   r   r   all_whitespacer]  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   r$  
abcabc
   🐍⚡   🐍⚡🐍    aba baba

abcz*Results of "{}".splitlines() must be equalr  )r|   r   r   r  r  r   r   r   test_splitlines  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   r$  r(  r)  r*  r+  r,  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_keepends  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  )rH  r   r   r  rI  r   r!  r"  r  r   r   r   test_rsplit_exception_empty_sep  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_maxsplit  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  rO  rQ  rS  rT  rV  rX  rY  rZ  r[  z*Results of "{}".rsplit("{}") must be equalr  )r   r   r   r  r\  r   r   r   test_rsplit  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  r]  r  r   r  r   r  r=   ru   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  rR  r  r  r  r  r  r  z&Results of "{}".rsplit() must be equal)r   r   r   r  r   r   r  )r   r   r   r   r]  r  r   r   r   r   test_rsplit_whitespaceA  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   r]  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   r   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_exceptionk  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   r5     ⚡⚡r|  '%s'.join('%s')?r   r   r   r   r   r   r]  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)r5  r8  r9  r:  r;  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  r@  r  r   z'%s'.%s(%d, '%s')?)r   r   r   r   r  r
   r   r   r!  r"  r   r   )r   r   rA  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)rH  r   r   r   r   r  rI  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  )r5   r   r   r   r   r   r   r   test_inplace_concat  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b0Z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)rZ  N)Zassciiai )zasscii r[  )	 asscii  r[  )r\  zasci )r\  r   )z      r   )r   r   r   )r   Nr  )
  asscii  r[  )r]  r   )r]  N)r      étú? )     tú quién te crees?   r^  )u     tú qrees?   r   )r_  Nr   )    大处大处  r   )z	
abcd	z	a)r`  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_CASESrA  r   stringr   Zsig1r  r  r  r$  r   r  r   
test_strip  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   —   𐐁   𐐧   𐐩   𐑎   🐍   👯rN  rO  rP  rQ  rR  rS  rT  rU  z'Results of "{}".isspace() must be equalr   r  rV  rW  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   ra  R  s     z,TestUnicode.test_istitle.<locals>.<listcomp>r   z    z  AA  z  Ab  1ZA123ZA12Bcdz+abAZ12AbcZA12abcu   %^Abc 5 $% Def𐐁𐐩u   𐐧𐑎rg  rh  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_istitleM  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   r  s    z,TestUnicode.test_isprintable.<locals>.pyfuncr   r   abcdefgzabcdefg
u   ʹu   ͸rN  rj  u   󠀠z+Results of "{}".isprintable() must be equalr  rV  r   r   r   rX  r  r   r   r   r   test_isprintableq  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   ru  r   r   r   r     s    z/TestUnicode.test_walk_backwards.<locals>.pyfuncr   r  rv  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   ru  r   r   r   r     s    z-TestUnicode.test_stride_slice.<locals>.pyfuncr   r  rv  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  rv  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  rv  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IOr>  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     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_getitem  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     s    z+TestUnicode.test_literal_in.<locals>.pyfunc)r   9rm  r   Z8uhaZ987r  r  r  r  r   r   r   test_literal_in  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)rc   rf   r$   r   r   r   r     s    z0TestUnicode.test_literal_xyzwith.<locals>.pyfuncrr  r   r   r  r  )r   r   r   r  r  r   r   r   test_literal_xyzwith  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     s    z$TestUnicode.test_not.<locals>.pyfuncr  r  rV  r  r   r   r   test_not  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     s    z+TestUnicode.test_capitalize.<locals>.pyfunc   𐑏   𐑏𐑏   𐐧𐑏   𐑏𐐧
   X𐐧x𐑏u   hİu   ῒİu   ﬁnnish   AͅΣ   𐀀􀀀z*Results of "{}".capitalize() must be equalr   r  rV  rW  r   r   r   test_capitalize  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   upperrl  r   r   r   ra  -  s     z,TestUnicode.test_isupper.<locals>.<listcomp>AA12Aaa12a   大AA12A   大aa12a   AAAǄA	   A 1 1 大   Ⅷ   ⅷre  rf  rg  rh  ri  rj  c                 S   s   g | ]}|d  qS r  r   rl  r   r   r   ra  4  s     r  r  rV  )	r   r   r   ZuppersrC  rX  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  rV  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   F  s    z)TestUnicode.test_casefold.<locals>.pyfuncr*  ZhELlo   ß   ﬁ   Σr  rJ  r  z(Results of "{}".casefold() must be equalr   r  rV  rW  r   r   r   test_casefoldE  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   U  s    z(TestUnicode.test_isalpha.<locals>.pyfuncrn  re  rf  rg  rh  ri  rj  rN  rO  rP  rQ  rR  rS  rT  rU  z'Results of "{}".isalpha() must be equalr   r  rV  r   r   r   rX  rC  r  r   r   r   r   test_isalphaT  s         zTestUnicode.test_isalphaz+isascii method requires Python 3.7 or laterc                 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   i  s    z(TestUnicode.test_isascii.<locals>.pyfuncr    z       ér   z'Results of "{}".isascii() must be equalr  rV  rs  r   r   r   test_isasciif  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  rs  r   r   r   
test_titleu  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  rf  r  r  r  r  r     İr     ͅΣr     AͅΣau   AΣͅ   Σͅ r  u   ῒr  z(Results of "{}".swapcase() must be equalr   r  rV  rW  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   rl  r   r   r   ra    s     z,TestUnicode.test_islower.<locals>.<listcomp>r  r  r  r  r  r  r  r  re  rf  rg  rh  ri  rj  c                 S   s   g | ]}|d  qS r  r   rl  r   r   r   ra    s     z'Results of "{}".islower() must be equalr   r  )r   r   r   r   r  )r   r   r   ZlowersrC  rX  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>.pyfuncre  rf  rg  rh     𝟶   𑁦   𐒠   🄇rN  rO  rP  rQ  rR  rS  rT  rU  z'Results of "{}".isalnum() must be equalr   r  rV  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  re  rf  rh  rj  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   rC  rX  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   rM     ①   ¼   ٠
01234567890123456789are  rf  rg  rh  ri  rj     𑁥r  r  r  r  rN  rO  rP  rQ  rR  rS  rT  rU  z)Results of "{}".isnumeric() must be equalr  rV  rW  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  re  rf  rg  rh  ri  rj  r  r  r  r  r  rN  rO  rP  rQ  rR  rS  rT  rU  z'Results of "{}".isdigit() must be equalr   r  rV  rW  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     s    z*TestUnicode.test_isdecimal.<locals>.pyfuncr   r   rM  r  r  r  r  r  re  rf  rg  rh  ri  rj  r  r  r  r  r  rN  rO  rP  rQ  rR  rS  rT  rU  z)Results of "{}".isdecimal() must be equalr  rV  rW  r   r   r   test_isdecimal  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   rP  r  rR  rP  r  r   rP  r  rU  rP  r  rW  r   r  rW  r   r  rW  r   r  rW  r   r  rW  r   r  z'%s'.replace('%s', '%s')?)rV   r   r   )r   r   r   r]  r  old_strnew_strr   r   r   test_replace
	  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')?)rX   r   r   )	r   r   r   r]  Z
count_testr  r  r  rK   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    rT   rW   r   r   r   r   <	  s    z4TestUnicode.test_replace_unsupported.<locals>.pyfuncZ
abababababbaZqqqg      @z7Unsupported parameters. The parameters must be Integer.r   r   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%  r(  r)  r8  r;  r>  r@  rA  rE  rN  r^  rs  ru  ry  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/  r0  r1  r2  r3  r4  r6  r7  r=  r?  rB  rE  rF  rG  rY  rc  rk  rp  rt  rw  rx  rz  r|  r}  r  r  r  r  r  r  r  r  r  r  r  r  r  r  unittestZ
skipUnless_py37_or_laterr  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  U	  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_tupleS	  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  b	  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  h	  s    r  r  r   r   r   "test_const_unicode_in_hetero_tuplea	  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  o	  s    z3TestUnicodeInTuple.test_ascii_flag_unbox.<locals>.f)r   r   r   r   r  r   r   r   test_ascii_flag_unboxn	  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  r>  r   r   ,)r   r  s1s2Zs3Zs4r   r   r   r  w	  s    z2TestUnicodeInTuple.test_ascii_flag_join.<locals>.f)r   r   r   r   r  r  r   r   r   test_ascii_flag_joinv	  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  r>  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  Q	  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    )rH  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?)
rH  r   r   r  	TypeErrorr   r!  r"  r
   r   )r   r   r   rM  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_chr	  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 )Nr'  r   zchr() arg not in ranger  )
r   r   r   r  rI  r   r!  r"  r
   r   )r   r   r   rM  vr$  r   r   r   test_chr_invalid	  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   bar	  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   rJ  Hashabler!   r   r  r   ol_bar	  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_mro	  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 | t}t|ddg W 5 Q R X d}| |t|j | 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_r   Z_Br   ru  r   r   r   impl1
  s    z2TestUnicodeAuxillary.test_f_strings.<locals>.impl1c                 S   s
   | d  S ry  r   ru  r   r   r   impl2
  s    z2TestUnicodeAuxillary.test_f_strings.<locals>.impl2c                 S   s
   d|  S )NABC_r   ru  r   r   r   impl3
  s    z2TestUnicodeAuxillary.test_f_strings.<locals>.impl3c                 S   s   d| dS )Nr  rM  r   ru  r   r   r   impl4
  s    z2TestUnicodeAuxillary.test_f_strings.<locals>.impl4c                   S   s    S r    r   r   r   r   r   impl5"
  s    z2TestUnicodeAuxillary.test_f_strings.<locals>.impl5r   r   ZDEr  Bz5No implementation of function Function(<class 'str'>)z*format spec in f-strings not supported yetN)r   r   r  r
   r   r!  r"  r   )r   r  r  r  r   r!  r$  r  r   r   r   test_f_strings
  s"    z#TestUnicodeAuxillary.test_f_stringsN)	r   r   r   r	  r  r  r  r  r#  r   r   r   r   r  	  s   r  __main__)q	itertoolsr   r   Znumbar   Z
numba.corer   r   r  Znumba.tests.supportr   r   r	   Znumba.core.errorsr
   r   Znumba.cpython.unicoder   Znumba.core.types.functionsr   Znumba.extendingr   Z	PYVERSIONr  r   r   r#   r&   r)   r+   r.   r0   r2   r3   r4   r5   r6   r7   r8   r9   r:   r>   rA   rD   rG   rI   rL   rM   rN   rQ   rR   rS   rV   rX   r[   r\   r]   r`   ra   rb   rd   rg   rj   rm   rn   ro   rp   rs   rv   rx   ry   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>   sL  
	$               8M$t
