a
    ze"                     @   s   d Z ddlmZ ddlmZmZmZmZ ddlZddl	Z	ddl
Z
dZdZdZe
jdk rZdnd	ZG d
d dZG dd dejeZG dd dejeZG dd dejeZG dd dejZG dd dejZedkree
jdkree
jd  e  dS )a  Bigmem tests - tests for the 32-bit boundary in containers.

These tests try to exercise the 32-bit boundary that is sometimes, if
rarely, exceeded in practice, but almost never tested.  They are really only
meaningful on 64-bit builds on machines with a *lot* of memory, but the
tests are always run, usually with very low memory limits to make sure the
tests themselves don't suffer from bitrot.  To run them for real, pass a
high memory limit to regrtest, with the -M option.
    )support)
bigmemtest_1G_2G_4GN         l           c                   @   s<  e Zd Zdd Zeed dddd Zeeddd	d
 Zeedddd Zeed dddd Z	eedddd Z
eedddd Zeedddd Zeedddd Zeedddd Zeedddd Zeedddd Zeedddd Zeedddd  Zeeddd!d" Zeed ddd#d$ Zeed ddd%d& Zeed ddd'd( Zeed ddd)d* Zeeddd+d, Zeeddd-d. Zeed ddd/d0 Zeed ddd1d2 Zeed3dd4d5 Zeed6 ed e dd7d8 Zeed3dd9d: Z eeddd;d< Z!eeddd=d> Z"d?d@ Z#dAdB Z$eedddCdD Z%eed6 dddEdF Z&eedG dddHdI Z'ee(d dJddKdL Z)ee(d dJddMdN Z*eedG dddOdP Z+eedddQdR Z,eed dddSdT Z-eed dddUdV Z.dWS )XBaseStrTestc                 C   s`   | j }|  d}|d| | }| }| |t| d  |  | ||d| d S N abc def ghi-)from_latin1
capitalizeassertEquallenlstrip)selfsize_SUBSTRsZcaps r   &/usr/lib/python3.9/test/test_bigmem.py_test_capitalizeH   s    
zBaseStrTest._test_capitalize
   r   r   memusec                 C   s~   |  d}||}| t|| t|t| d  }}t|d rP|d7 }| |||  | | | |  d S )Nr   r   r   )r   centerr   r   strip)r   r   r   r   ZlpadsizeZrpadsizer   r   r   test_centerQ   s    

zBaseStrTest.test_centerr   c                 C   s   | j }|d}|d| | }| ||d| ||d7 }| ||d|d  | ||dd | ||dd | ||dd d S )	Nr   .r       ijr   )r   r   countr   r   r   r   r   r   r   r   
test_count\   s    zBaseStrTest.test_countc                 C   s   | j }|d}|d| | }| || | || |d| }| || | ||d|  | || d S )Nr   r   ...a)r   
assertTrueendswithassertFalse)r   r   r   r   r   s2r   r   r   test_endswithh   s    zBaseStrTest.test_endswithc                 C   s   | j }|d| }d}| | |k ~t||\}}|d| }||}| t|||  | t||dd d S )Nr   r
   z       	r#   r   )r   r,   
expandtabsdivmodr   r   r    )r   r   r   r   tabsizeZslen	remainderr   r   r   test_expandtabst   s    
zBaseStrTest.test_expandtabsc                 C   s   | j }|d}t|}|d||d| |g}| ||dd | ||d | ||d|||  | ||t|||  | ||d||d | ||d||| ||d  | ||d||| ||d  | ||dd d S 	Nr    r   r#   r   r%   r&   )r   r   joinr   findr   r   r   r   sublenr   r   r   r   	test_find   s      zBaseStrTest.test_findc                 C   s  | j }|d}t|}|d||d| |g}| ||dd | ||d | ||d|||  | |||||  | ||d||d | ||d||| ||d  | ||d||| ||d  | t|j|d d S )Nr   r7   r   r#   r   r%   r&   )r   r   r9   r   indexassertRaises
ValueErrorr;   r   r   r   
test_index   s      zBaseStrTest.test_indexc                 C   sJ   | j }|d}|d| | }| |  ||d7 }| |  d S )N123456r+   r"   )r   r,   isalnumr.   r(   r   r   r   test_isalnum   s    zBaseStrTest.test_isalnumc                 C   sJ   | j }|d}|d| | }| |  ||d7 }| |  d S )NZzzzzzzzr+   r"   )r   r,   isalphar.   r(   r   r   r   test_isalpha   s    zBaseStrTest.test_isalphac                 C   sJ   | j }|d}|d| | }| |  ||d7 }| |  d S )NrB   9z)r   r,   isdigitr.   r(   r   r   r   test_isdigit   s    zBaseStrTest.test_isdigitc                 C   sf   | j }|ddd tdD }|t| d }|| }| |  ||d7 }| |  d S )Nr7   c                 s   s"   | ]}t | st |V  qd S N)chrisupper.0cr   r   r   	<genexpr>   s   z+BaseStrTest.test_islower.<locals>.<genexpr>   r   A)r   r9   ranger   r,   islowerr.   r   r   r   charsrepeatsr   r   r   r   test_islower   s    
zBaseStrTest.test_islowerc                 C   sR   | j }|d}|t| d }|| }| |  ||d7 }| |  d S )Nz 
	r   r&   )r   r   r,   isspacer.   )r   r   r   
whitespacerX   r   r   r   r   test_isspace   s    zBaseStrTest.test_isspacec                 C   st   | j }|d}|d|d|d| |g}| |  ||d7 }| |  ||d7 }| |  d S )NrB   r7   rS   r+   ZaA)r   r9   r,   istitler.   r(   r   r   r   test_istitle   s     zBaseStrTest.test_istitlec                 C   sf   | j }|ddd tdD }|t| d }|| }| |  ||d7 }| |  d S )Nr7   c                 s   s"   | ]}t | st |V  qd S rK   )rL   rU   rN   r   r   r   rQ      s   z+BaseStrTest.test_isupper.<locals>.<genexpr>rR   r   r+   )r   r9   rT   r   r,   rM   r.   rV   r   r   r   test_isupper   s    
zBaseStrTest.test_isupperc                 C   s   | j }|d| }||d|dg}| ||dd | ||dd | ||d | ||d d S )	NrS   ZaaaaaZbbbbbr+      bZaaaaaAZAbbbbb)r   r9   r   r'   r,   
startswithr-   )r   r   r   r   xr   r   r   	test_join   s    zBaseStrTest.test_joinc                 C   sX   | j }|d}||}| |||d  | t|| | | |  d S Nr   z  r   ljustr,   rb   r   r   r    r(   r   r   r   
test_ljust   s    
zBaseStrTest.test_ljustc                 C   sD   | j }|d| }| }| t|| | ||d| d S )NrS   r+   )r   lowerr   r   r'   r   r   r   r   r   r   r   
test_lower   s
    zBaseStrTest.test_lowerc                 C   s   | j }|d}||}| t|| | | |  ~||}| t|| t|ttfr|| }| 	||u  d S )Nzabc def ghi)
r   rjustr   r   r   rg   
isinstancestrbytesr,   r   r   r   r   r   strippedr   r   r   test_lstrip  s    

zBaseStrTest.test_lstripc                 C   s   | j }|d}|d| }||d|}| t|| | ||| |||d|d }| t|| | ||d | |dd  |d d S )Nr+   r#   r	   z
      aaaa)r   replacer   r   r'   )r   r   r   Zreplacementr   r   r   r   test_replace  s    zBaseStrTest.test_replacec                 C   s<  | j }|d}t|}|d||d| |g}| ||d|| ||d  | ||||  | ||dd|||d | ||d|| d | ||d|| ||d  | ||dd|||d | ||dd|| ||d | ||dd d S r6   )r   r   r9   r   rfindr;   r   r   r   
test_rfind   s    ($($zBaseStrTest.test_rfindc                 C   sB  | j }|d}t|}|d||d| |g}| ||d|| ||d  | ||||  | ||dd|| d ||d | ||d|| d | ||d|| ||d  | ||dd|||d | ||dd|| ||d | t|j|d d S )	Nr   r7   r   r#   r   r   r%   r&   )r   r   r9   r   rindexr?   r@   r;   r   r   r   test_rindex0  s(    $zBaseStrTest.test_rindexc                 C   sX   | j }|d}||}| |||d  | t|| | | |  d S re   rf   r(   r   r   r   
test_rjustC  s    
zBaseStrTest.test_rjustc                 C   s   | j }|d}||}| t|| | | |  ~||}| t|| t|ttfr|| }| 	||u  d S )Nr   )
r   rg   r   r   rstriprl   rm   rn   ro   r,   rp   r   r   r   test_rstripL  s    

zBaseStrTest.test_rstripg @c           	      C   s   | j }t|d d }|d|d|  }|| }| }| t|| |d}|D ]}| || qV~||d}| t||d  |d| }td |D ]}| || qd S )N      ?r   r+   r#   r   )r   intsplitr   r   filter	r   r   r   	chunksizer   r   lZexpecteditemr   r   r   test_split_small^  s    zBaseStrTest.test_split_smallr`   c                 C   s   | j }|d| |d }| }| t|| | t|t|dg ~||d}| t||d  | t|t|dg d S )Nz ar#   r+   r   )r   r   r   r   set)r   r   r   r   r   r   r   r   test_split_largex  s    zBaseStrTest.test_split_largec           	      C   s   | j }t|d d d }|d| |d |d|  |d }||d  }| }| t||d  |d| }|D ]}| || qzd S )Nr}   r   r#   
z
r	   )r   r~   
splitlinesr   r   r   r   r   r   test_splitlines  s    (zBaseStrTest.test_splitlinesc                 C   sZ   | j }|d}|d| | }| || | ||d|  | || d S r   )r   r,   rb   r.   r(   r   r   r   test_startswith  s    zBaseStrTest.test_startswithc                 C   sp   | j }|d}||}| t|| | | |  ~||}| t|| | | |  d S )Nz   abc def ghi   )r   rl   r   r   r    rg   r(   r   r   r   
test_strip  s    

zBaseStrTest.test_stripc                 C   s   | j }|d}t|}|| d }|| }| }| t|||  | |d |d  | d  | || d d  | d  d S )Nu   aBcDeFG12.'© r   r$   )r   r   swapcaser   )r   r   r   r   r<   rX   r   r   r   r   _test_swapcase  s     zBaseStrTest._test_swapcasec                 C   s^   | j }|d}||t| d  }| }| ||d   | || d  d S )NZSpaaHAaaAahamr   r$   )r   r   titler,   rb   r-   ri   r(   r   r   r   _test_title  s    zBaseStrTest._test_titlec                 C   s   | j }|d}tdd}t|}|| d }|| }||}| t|||  | |d | || | || d  || | ||dd | ||d|d  | ||d|d	  d S )
N
aZz.z.Aaz.s   .aZs   -!$r   r"   r   !rH   r$   )r   ro   	maketransr   	translater   r'   r   r   r   r   Ztransr<   rX   r   r   r   r   test_translate  s    
zBaseStrTest.test_translatec                 C   sD   | j }|d| }| }| t|| | ||d| d S )Nr+   rS   )r   upperr   r   r'   rj   r   r   r   
test_upper  s
    zBaseStrTest.test_upper   c                 C   s~   | j }|d}||}| ||d|dd    | ||d | t|| | ||d|t|  d S )Nz-5683247235982340r   z-0)r   zfillr,   r-   rb   r   r   r'   r(   r   r   r   
test_zfill  s    
 zBaseStrTest.test_zfillr$   c                 C   s\   | j }|d| }| t|| || }| t||d  | ||d|d  d S Nr"   r   r   r   r   r'   rj   r   r   r   test_concat  s    zBaseStrTest.test_concatc                 C   s\   | j }|d| }| t|| |d }| t||d  | ||d|d  d S r   r   rj   r   r   r   test_repeat  s    zBaseStrTest.test_repeatc                 C   s~  | j }|d}t|}|||  }t|d }|||  }tdt|| |D ]}| || |d  | ||||  | | |||| d |d d d  |dkrN| ||| d |d d ||d d  qN| |t|d  |d  | |d |d  | |t|d  |d  | ||  |d  | |t|d  |d	 | |t|d d  |dd   | |dd  |dd   | |t|| d  | | || d  | | t|d d  t| | t|d t|d
  t|d
  | t|d
d t|d  | ttj|t| | ttj|t|d  | ttj|t|d d>  d S )N
0123456789d   r   r   r   r8   r   r7   r`      )r   r   rT   r   r?   
IndexErroroperatorgetitem)r   r   r   r   r<   r   Zstepsizer%   r   r   r   test_slice_and_getitem  s:    $$( z"BaseStrTest.test_slice_and_getitemc                 C   s   | j }|d}|d|d  }|d|||g}~| ||v  | |d |v  | |d|v  | |d|v  ||d7 }| |d|v  d S )Nr   r   r   r7   r+   )r   r9   r,   r.   )r   r   r   r   edger   r   r   r   test_contains  s    zBaseStrTest.test_containsc                 C   sh   | j }|d| }|d| }| ||k ~||d }| ||k ~|d| }| ||k d S )Nr   r+   r"   )r   r,   r.   )r   r   r   s1r/   r   r   r   test_compare"  s    zBaseStrTest.test_comparec                 C   s@   | j }|d| }t|}~|d|d  }| |t| d S )N r   )r   hashZassertNotEqual)r   r   r   r   h1r   r   r   	test_hash/  s    zBaseStrTest.test_hashN)/__name__
__module____qualname__r   r   r   r!   r)   r0   r5   r=   rA   rD   rF   rJ   rY   r\   r^   r_   rd   rh   rk   rr   ru   rw   ry   rz   r|   r   ascii_char_sizepointer_sizer   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   F   s   	





















	







	


























!


r   c                   @   s  e Zd Zdd Zd1ddZdd Zd	d
 Zeee	d e
d  ddd Zeee	d e
d  ddd Zeee	d e
d  ddd Zeed e
d ddd Zeed d e
e	 d ddd Zeed d e
d d ddd Zeed d e
e	 d dd d! Zeed e
d dd"d# Zeed$ e
d e	 dd%d& Zeed$ e
d dd'd( Zeed$ e
d dd)d* Zeed d ee	 e
d  dd+d, Zeed d e	d e
d$  dd-d. Zeee
d e	 dd/d0 ZdS )2StrTestc                 C   s   |S rK   r   r   r   r   r   r   r   A  s    zStrTest.from_latin1r"   Nc                 C   s>   |d u r|}z&|| }|  t||| W d }nd }0 d S rK   )r   r   encode)r   r   encrP   expectedsizer   r   r   r   basic_encode_testD  s    zStrTest.basic_encode_testc              	   C   sh   i | _ ttD ]T}|dsqtt| |}z
|j}W n tyL   Y qY n0 t| |_|| j |< qd S )NZtest_)		_adjusteddirr   rb   getattrtyper   AttributeErrorr   )r   namemethr   r   r   r   setUpM  s    



zStrTest.setUpc                 C   s(   | j  D ]\}}|tt| |_q
d S rK   )r   itemsr   r   r   )r   r   r   r   r   r   tearDown\  s    zStrTest.tearDownr$   r   r   c                 C   s   |  | d S rK   r   r   r   r   r   r   test_capitalize`  s    zStrTest.test_capitalizec                 C   s   |  | d S rK   r   r   r   r   r   
test_titled  s    zStrTest.test_titlec                 C   s   |  | d S rK   r   r   r   r   r   test_swapcaseh  s    zStrTest.test_swapcaser   c                 C   s   |  |dS )Nutf-8r   r   r   r   r   test_encodeo  s    zStrTest.test_encode   c                 C   s&   z|  |dW S  ty    Y n0 d S )NZraw_unicode_escaper   MemoryErrorr   r   r   r   test_encode_raw_unicode_escapes  s    z&StrTest.test_encode_raw_unicode_escaper`   F   r
   c                 C   s&   z|  |dW S  ty    Y n0 d S )Nutf7r   r   r   r   r   test_encode_utf7z  s    zStrTest.test_encode_utf7r	   c                 C   s2   z| j |dd| d dW S  ty,   Y n0 d S )Nutf32r	   )r   r   r   r   r   r   test_encode_utf32  s    zStrTest.test_encode_utf32c                 C   s   | j |dddS )NasciirS   )rP   r   r   r   r   r   test_encode_ascii  s    zStrTest.test_encode_asciir   c                 C   s   d| }d|f }|  ||k ~d|f }| t|t|d  |  |d |  |d ~~|d }d| }d|d|g}~|d	 }| t||d d
  | |dd
 | |d|d  d S )Nr   z%sz..%s..r	   z..-z-..r   r7   r*   r$   r"   )r,   r   r   rb   r-   r9   r'   )r   r   r   Zsfr   r   r   r   test_format  s"    

zStrTest.test_formatc                 C   s   d| }t |}| t||d  | |d d | |d d | |d| ~|d d }d| }t |}| t||d d  | |d d | |d d | |d	| | |d
|d  d S )Nr   r   r   'r8   r`   r   r	   \r   reprr   r   r'   r   r   r   r   r   r   test_repr_small  s    zStrTest.test_repr_smallc                 C   st   d| }t |}| t||d d  | |d d | |d d | |d| | |d|d  d S )	Nr   r	   r   r   r   r8   r   r   r   r   r   r   r   test_repr_large  s    zStrTest.test_repr_largec                 C   s   d}|| }zdt tfD ]N}||}| t|dt||d |   | |d|dd   d }qW d  }}n
d  }}0 d S )Nu   r   z\udcba'rs   r   r   r   r   r,   r-   r   r   charr   frr   r   r   test_unicode_repr  s    $zStrTest.test_unicode_reprc                 C   s   d}|| }zdt tfD ]N}||}| t|dt||d |   | |d|dd   d }qW d  }}n
d  }}0 d S )Nu   𝲺r   z\U0001dcba'ir   r   r   r   r   test_unicode_repr_wide  s    $zStrTest.test_unicode_repr_widec                 C   s   | j }|d}t|d|dt|d|dt|d|di}t|}|| d }|| }||}| t|||  | |d | || | || d  || | ||dd	 | ||d|d  | ||d
|d  d S )Nr   r"   r   r+   r   Z$r   r   rH   r$   )r   ordr   r   r   r'   r   r   r   r   r     s     
zStrTest.test_translate)r"   N)r   r   r   r   r   r   r   r   r   ucs4_char_sizer   r   r   r   r   r   r   r   r   r   r   r   r   ucs2_char_sizer   r   r   r   r   r   r   r   ?  sH   
	












r   c                   @   sl   e Zd Zdd Zeed de ddd Zeedddd	 Zeeddd
d Z	eedddd Z
dS )	BytesTestc                 C   s
   | dS Nzlatin-1)r   r   r   r   r   r     s    zBytesTest.from_latin1r   r   r   c                 C   s(   |  d| }| t|d| d S Nr"   r   r   r   r   decoder   r   r   r   test_decode  s    zBytesTest.test_decodec                 C   s   |  | d S rK   r   r   r   r   r   r     s    zBytesTest.test_capitalizec                 C   s   |  | d S rK   r   r   r   r   r   r     s    zBytesTest.test_titlec                 C   s   |  | d S rK   r   r   r   r   r   r     s    zBytesTest.test_swapcaseN)r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r     s   





r   c                   @   st   e Zd Zdd Zeed de ddd Zeedddd	 Zeeddd
d Z	eedddd Z
dZdZdS )BytearrayTestc                 C   s   t |dS r   )	bytearrayr   r   r   r   r   r     s    zBytearrayTest.from_latin1r   r   r   c                 C   s(   |  d| }| t|d| d S r   r   r   r   r   r   r     s    zBytearrayTest.test_decodec                 C   s   |  | d S rK   r   r   r   r   r   r     s    zBytearrayTest.test_capitalizec                 C   s   |  | d S rK   r   r   r   r   r   r   "  s    zBytearrayTest.test_titlec                 C   s   |  | d S rK   r   r   r   r   r   r   &  s    zBytearrayTest.test_swapcaseN)r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r     s   






r   c                   @   s  e Zd Zeed ed ddd Zdd Zeed d ed ddd	 Zeed ed dd
d Z	eed d ed ddd Z
eed eddd Zeed eddd Zdd Zeed d ed ddd Zeed ed ddd Zeed dddd Zeed ed ddd Zeed  ed dd!d" Zd#d$ Zeed% d eed%  dd&d' Zeed eed%  dd(d) Zd*S )+	TupleTestr   r   c                 C   sV   d| }d| }|  ||k ~d|d  }| ||k ~d| }| ||k d S )Nr7   r   )r   r,   r.   )r   r   t1t2r   r   r   r   8  s    zTupleTest.test_comparec                 C   s8   d| }|  t|| || }|  t||d  d S )N)r   r   r   r   r   r   tr   r   r   basic_concat_testI  s    zTupleTest.basic_concat_testr$   c                 C   s
   |  |S rK   r   r   r   r   r   test_concat_smallO  s    zTupleTest.test_concat_smallc                 C   s
   |  |S rK   r  r   r   r   r   test_concat_largeS  s    zTupleTest.test_concat_larger`   r   c                 C   sJ   d| }|  t||d  | d|v  | d|v  | d|v  d S Nr   r   r$   r	   r`   r`   r   r   r   r,   r.   r   r   r   r   r   W  s
    zTupleTest.test_containsc                 C   s4   d| }t |}~d|d  }| |t |k d S )N)r   r   )r   r.   )r   r   r   r   r   r   r   r   r   _  s
    zTupleTest.test_hashc                 C   s*  d| }|  t|| |  |d d  |  |d d  |  ||d  d  | ttj|| |  |d d d |  |dd  d |  |dd d |  |d	d
 d |  ||d d  d |  ||d | d |  ||d |d  d |  ||| d |  |||d  d d S )NrK   r8   r`   r   )NNNNNr   r      r   r   )NNNNr   )r   r   r?   r   r   r   r   r   r   r   test_index_and_sliceg  s    zTupleTest.test_index_and_slicec                 C   s8   d| }|  t|| |d }|  t||d  d S )Nr   r   r   r   r   r   r   basic_test_repeatz  s    zTupleTest.basic_test_repeatc                 C   s
   |  |S rK   r  r   r   r   r   test_repeat_small  s    zTupleTest.test_repeat_smallc                 C   s
   |  |S rK   r  r   r   r   r   test_repeat_large  s    zTupleTest.test_repeat_larger      c                 C   s
   |  |S rK   r  r   r   r   r   test_repeat_large_2  s    zTupleTest.test_repeat_large_2c                 C   sf   zt tdg| }W n ty(   Y n:0 | t|| | |d d d | |dd  d d S N*   r   )
r  r  r  r  r  r  r  r  r  r  rs   tupleiterr   r   r   r   r   r   r   test_from_2G_generator  s    z TupleTest.test_from_2G_generatorr  c                 C   sf   zt tdg| }W n ty(   Y n:0 | t|| | |d d d | |dd  d d S r  r  r   r   r   r   test_from_almost_2G_generator  s    z'TupleTest.test_from_almost_2G_generatorc                 C   sP   d| }t |}| t||d  | |d d d | |dd  d d S )N)F   r   z
(False, Fars   z
se, False))r   r   r   )r   r   r   r   r   r   r   basic_test_repr  s
    zTupleTest.basic_test_reprr  c                 C   s
   |  |S rK   r  r   r   r   r   r     s    zTupleTest.test_repr_smallc                 C   s
   |  |S rK   r  r   r   r   r   r     s    zTupleTest.test_repr_largeN)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:   












r   c                   @   s@  e Zd Zeed ed ddd Zdd Zeed d ed ddd	 Zeed ed dd
d Z	dd Z
eed d ed d d ddd Zeed ed d d ddd Zeed d ed ddd Zeed eddd Zeed eddd Zdd Zeed d ed ddd Zeed ed dd d! Zd"d# Zeed d ed d d dd$d% Zeed ed d d dd&d' Zd(d) Zeed* d eed*  dd+d, Zeed eed*  dd-d. Zeeed d dd/d0 Zeed d ed dd1d2 Zd3d4 Zeed d ed d d dd5d6 Zeed ed d d dd7d8 Zeed d ed dd9d: Zeed ed d dd;d< Z eed d= ed dd>d? Z!eed edd@dA Z"eed d ed ddBdC Z#eed d ed dD ddEdF Z$dGS )HListTestr   r   c                 C   s^   dg| }dg| }|  ||k ~dg|d  }| ||k ~dg| }| ||k d S )Nr7   r   r   r   )r   r   l1l2r   r   r   r     s    


zListTest.test_comparec                 C   s:   g g| }|  t|| || }|  t||d  d S )Nr   r   r   r   r   r   r   r   basic_test_concat  s    
zListTest.basic_test_concatr$   c                 C   s
   |  |S rK   r  r   r   r   r   r    s    zListTest.test_concat_smallc                 C   s
   |  |S rK   r   r   r   r   r   r    s    zListTest.test_concat_largec                 C   s`   t jg| }||7 }| t||d  | |d |d u  | ||d  ||d  u  d S Nr   r   r8   r   )sysstdoutr   r   r,   r  r   r   r   basic_test_inplace_concat  s
    z"ListTest.basic_test_inplace_concat	   r
   c                 C   s
   |  |S rK   r$  r   r   r   r   test_inplace_concat_small  s    z"ListTest.test_inplace_concat_smallc                 C   s
   |  |S rK   r&  r   r   r   r   test_inplace_concat_large  s    z"ListTest.test_inplace_concat_larger`   r   c                 C   sR   g d| }|  t||d  | d|v  | g d|v  | d|v  d S r  r  r  r   r   r   r     s
    zListTest.test_containsc                 C   s   dg| }|  tt| d S )Nr   )r?   	TypeErrorr   r  r   r   r   r     s    
zListTest.test_hashc                 C   s  d g| }|  t|| |  |d d  |  |d d  |  ||d  d  | ttj|| |  |d d d gd  |  |dd  d gd  |  |dd d gd  |  |dd d gd  |  ||d d  d gd  |  ||d | d gd  |  ||d	 |d
  d gd  |  ||| g  |  |||d  g  d||d
 < |  t|| |  |dd  g d |  |dd | ttj||d	 |  t|| g d||d d < |d
8 }|  t|| |  |dd  g d g d|d d< |d
8 }|  t|| |  |d d g d ||d = |d8 }|  t|| |  |d d |dd = |d
8 }|  t|| |  |d d
 |d= |d8 }|  t|| |  |d d
 |d d
= |d
8 }|  t|| |  |d d d S )Nr8   r`   r   r   r   r  r  r	  r   r   r	   r   )Nr`   Nr  r  i)NNr   r   r$   r	   r`   )r   r   r$   r	   r`   NNr   )r   r   r?   r   r   r   r'   setitemr  r   r   r   r
    sZ    
"


zListTest.test_index_and_slicec                 C   sL   g | }|  | dg| }| t|| |d }| t||d  d S )Nr7   r   )r.   r   r   r  r   r   r   r  /  s    

zListTest.basic_test_repeatc                 C   s
   |  |S rK   r  r   r   r   r   r  7  s    zListTest.test_repeat_smallc                 C   s
   |  |S rK   r  r   r   r   r   r  ;  s    zListTest.test_repeat_largec                 C   sz   dg}||9 }|  t|| | |d |d u  ~dg| }|d9 }|  t||d  | ||d  |d u  d S )Nr7   r   r8   r   r   )r   r   r,   r  r   r   r   basic_test_inplace_repeatA  s    
z"ListTest.basic_test_inplace_repeatc                 C   s
   |  |S rK   r,  r   r   r   r   test_inplace_repeat_smallM  s    z"ListTest.test_inplace_repeat_smallc                 C   s
   |  |S rK   r-  r   r   r   r   test_inplace_repeat_largeQ  s    z"ListTest.test_inplace_repeat_largec                 C   sd   dg| }t |}| t||d  | |d d d | |dd  d | |d| d S )NFr  r   z
[False, Fars   z
se, False]Fr   )r   r   r   r   r   r   r   r  U  s    
zListTest.basic_test_reprr  c                 C   s
   |  |S rK   r  r   r   r   r   r   ^  s    zListTest.test_repr_smallc                 C   s
   |  |S rK   r  r   r   r   r   r   b  s    zListTest.test_repr_largec                 C   s\   t  g| }|t   | t||d  | |d |d u  | |d |d u  d S )Nr   r   r*  r8   )objectappendr   r   r,   r.   r  r   r   r   test_appendh  s
    zListTest.test_appendc                 C   s4   g d| }|  |d| |  |dd d S )Nr  r   1r   )r   r'   r  r   r   r   r)   p  s    zListTest.test_countc                 C   s`   t g| }|| | t||d  | |d |d u  | ||d  ||d  u  d S r!  )r1  extendr   r   r,   r  r   r   r   basic_test_extendx  s
    

zListTest.basic_test_extendc                 C   s
   |  |S rK   r6  r   r   r   r   test_extend_small  s    zListTest.test_extend_smallc                 C   s
   |  |S rK   r7  r   r   r   r   test_extend_large  s    zListTest.test_extend_largec                 C   s   g d| }|d9 }|  |dd |  |d|d |d  |  |d|d ||d  | t|jd|d | | t|jd d S )Nr  r`   r   r   r	   r   )r   r>   r?   r@   r  r   r   r   rA     s    zListTest.test_indexc                 C   s   dg| }| |d d |d7 }| t|| | |dd  g d | |d d |d7 }| t|| | |dd  g d | dd |d7 }| t|| | |d d	 g d
 | ||d	 d  g d d S )N      ?r   rS   r   )r:  rS   r:  B)rS   r:  r;  Cr$   )r:  r<  r:  )insertr   r   r  r   r   r   test_insert  s    
zListTest.test_insertr	   c                 C   s   g d| }|d9 }|  t|| | }|d8 }|  t|| |  |d |  |dd  ddg |d}|d8 }|  t|| |  |d	 |  |d d
 ddg ||d
 }|d8 }|  t|| |  |d |  |dd  ddg d S )N)r+   ra   rP   der`   r   r@  r*  rP   r?  r   r+   r   ra   )r   r   pop)r   r   r   r   r   r   r   test_pop  s$    
zListTest.test_popc                 C   s   dg| }|  t|| |d |d8 }|  t|| |d |d7 }|  t|| |  |dd  ddg |d |d8 }|  t|| |  |dd  ddg d S )Nr   r   r`   r*  )r   r   remover2  r  r   r   r   test_remove  s    



zListTest.test_removec                 C   s\   g d| }|   | t||d  | |dd  g d | |d d g d d S )Nr  r`   r   )r`   r	   r$   r   r   )reverser   r   r  r   r   r   test_reverse  s
    zListTest.test_reverseg      ?c                 C   sr   g d| }|   | t||d  | |d| | |d d dgd  | |dd  dgd  d S )Nr  r`   r   r   rs   )sortr   r   r'   r  r   r   r   	test_sort  s    zListTest.test_sortN)%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  r)   r6  r8  r9  rA   r>  rB  rD  rF  rH  r   r   r   r   r    sl   







7



	











r  __main__)__doc__testr   Ztest.supportr   r   r   r   Zunittestr   r"  r   r   r   maxsizer   r   ZTestCaser   r   r   r   r  r   r   argvZset_memlimitmainr   r   r   r   <module>   s4   
0   | ?   2