B
    u9a                 @   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dd Zedkre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 )Nz abc def ghi-)from_latin1
capitalizeassertEquallenlstrip)selfsize_SUBSTRsZcaps r   !/usr/lib/python3.7/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 )Nz abc def ghir   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 )	Nz abc def ghi.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 )Nz abc def ghir   z...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slenZ	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 )	Nz abc def ghi 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 )Nz abc def ghir0   r   r    r   r"   r#   )r   r   r2   r   indexassertRaises
ValueError)r   r   r   r   r4   r   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   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   r   r   r   r   test_isalpha   s    zBaseStrTest.test_isalphac             C   sJ   | j }|d}|d| | }| |  ||d7 }| |  d S )Nr:   9z)r   r'   isdigitr)   )r   r   r   r   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 )Nr0   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   r2   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   Z
whitespacerM   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 )Nr:   r0   rI   r&   ZaA)r   r2   r'   istitler)   )r   r   r   r   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 )Nr0   c             s   s"   | ]}t | st |V  qd S )N)rC   rK   )rE   rF   r   r   r   rG      s    z+BaseStrTest.test_isupper.<locals>.<genexpr>rH   r   r&   )r   r2   rJ   r   r'   rD   r)   )r   r   r   rL   rM   r   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 )	NrI   ZaaaaaZbbbbbr&      bZaaaaaAZAbbbbb)r   r2   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 )Nz abc def ghiz  )r   ljustr'   rV   r   r   r   )r   r   r   r   r   r   r   r   
test_ljust   s    
zBaseStrTest.test_ljustc             C   sD   | j }|d| }| }| t|| | ||d| d S )NrI   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|| }| 	||k d S )Nzabc def ghi)
r   rjustr   r   r   rY   
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	   iz
      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 )	Nz abc def ghir0   r   r    r   r"   r#   r1   )r   r   r2   r   rfind)r   r   r   r   r4   r   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 )	Nz abc def ghir0   r   r    r   r   r"   r#   )r   r   r2   r   rindexr7   r8   )r   r   r   r   r4   r   r   r   r   test_rindex0  s     $zBaseStrTest.test_rindexc             C   sX   | j }|d}||}| |||d  | t|| | | |  d S )Nz abc def ghiz  )r   rY   r'   rV   r   r   r   )r   r   r   r   r   r   r   r   
test_rjustC  s    
zBaseStrTest.test_rjustc             C   s   | j }|d}||}| t|| | | |  ~||}| t|| t|ttfr|| }| 	||k d S )Nz abc def ghi)
r   rY   r   r   rstripr]   r^   r_   r`   r'   )r   r   r   r   r   ra   r   r   r   test_rstripL  s    

zBaseStrTest.test_rstripg @c       	      C   s   | j }t|d d }|d|d|  }|| }| }| t|| |d}x|D ]}| || qXW ~||d}| t||d  |d| }xtd |D ]}| || qW d S )Ng      ?r   r&   r    r   )r   intsplitr   r   filter)	r   r   r   	chunksizer   r   lexpecteditemr   r   r   test_split_small^  s    
zBaseStrTest.test_split_smallrT   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   rm   r   r   set)r   r   r   r   rp   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| }x|D ]}| || q|W d S )Ng      ?r   r    
z
r	   )r   rl   
splitlinesr   r   )	r   r   r   ro   r   r   rp   rq   rr   r   r   r   test_splitlines  s    (
zBaseStrTest.test_splitlinesc             C   sZ   | j }|d}|d| | }| || | ||d|  | || d S )Nz abc def ghir   )r   r'   rV   r)   )r   r   r   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   r]   r   r   r   rY   )r   r   r   r   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   r4   rM   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'   rV   r(   r[   )r   r   r   r   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 )
Nz
aZz.z.Aaz.s   .aZs   -!$r   r   r   !r@   r!   )r   r`   	maketransr   	translater   r$   )r   r   r   r   transr4   rM   r   r   r   r   test_translate  s    
zBaseStrTest.test_translatec             C   sD   | j }|d| }| }| t|| | ||d| d S )Nr&   rI   )r   upperr   r   r$   )r   r   r   r   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(   rV   r   r   r$   )r   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$   )r   r   r   r   r   r   r   test_concat  s    zBaseStrTest.test_concatc             C   s\   | j }|d| }| t|| |d }| t||d  | ||d|d  d S )Nr   r   )r   r   r   r$   )r   r   r   r   r   r   r   test_repeat  s    zBaseStrTest.test_repeatc             C   s  | j }|d}t|}|||  }t|d }|||  }xtdt|| |D ]}| || |d  | ||||  | | |||| d |d d d  |dkrP| ||| d |d d ||d d  qPW | |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   r1   r   r0   rT      )r   r   rJ   r   r7   
IndexErroroperatorgetitem)r   r   r   r   r4   r   Zstepsizer"   r   r   r   test_slice_and_getitem  s8    $$( z"BaseStrTest.test_slice_and_getitemc             C   s   | j }|d}|d|d  }|d|||g}~| ||k | |d |k | |d|k | |d|k ||d7 }| |d|k d S )Nr   r   r   r0   r&   )r   r2   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%   r+   r/   r5   r9   r<   r>   rB   rN   rP   rR   rS   rX   rZ   r\   rb   rd   rf   rh   ri   rk   rs   ascii_char_sizepointer_sizeru   rx   ry   rz   r|   r~   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   F   sN   				

		 		"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 )Nr   )r   r   r   r   r   r   A  s    zStrTest.from_latin1r   Nc             C   s:   |d kr|}z"|| }|  t||| W d d }X d S )N)r   r   encode)r   r   encrF   expectedsizer   r   r   r   basic_encode_testD  s    zStrTest.basic_encode_testc          	   C   sl   i | _ x`ttD ]T}|ds qtt| |}y
|j}W n tk
rN   wY nX t| |_|| j |< qW d S )NZtest_)		_adjusteddirr   rV   getattrtyper   AttributeErrorr   )r   nameZmethr   r   r   r   setUpM  s    


zStrTest.setUpc             C   s,   x&| j  D ]\}}|tt| |_qW d S )N)r   itemsr   r   r   )r   r   r   r   r   r   tearDown\  s    zStrTest.tearDownr!   r   )r   r   c             C   s   |  | d S )N)r   )r   r   r   r   r   test_capitalize`  s    zStrTest.test_capitalizec             C   s   |  | d S )N)r~   )r   r   r   r   r   
test_titled  s    zStrTest.test_titlec             C   s   |  | d S )N)r|   )r   r   r   r   r   test_swapcaseh  s    zStrTest.test_swapcaser   c             C   s   |  |dS )Nzutf-8)r   )r   r   r   r   r   test_encodeo  s    zStrTest.test_encode   c             C   s&   y|  |dS  tk
r    Y nX d S )NZraw_unicode_escape)r   MemoryError)r   r   r   r   r   test_encode_raw_unicode_escapes  s    z&StrTest.test_encode_raw_unicode_escaperT   F   r
   c             C   s&   y|  |dS  tk
r    Y nX d S )Nutf7)r   r   )r   r   r   r   r   test_encode_utf7z  s    zStrTest.test_encode_utf7r	   c             C   s2   y| j |dd| d dS  tk
r,   Y nX d S )Nutf32r	   )r   )r   r   )r   r   r   r   r   test_encode_utf32  s    zStrTest.test_encode_utf32c             C   s   | j |dddS )NasciirI   )rF   )r   )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   r0   z...r!   r   )r'   r   r   rV   r(   r2   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   'r1   rT   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   r1   r   r   )r   r   r   r$   )r   r   r   r   r   r   test_repr_large  s    zStrTest.test_repr_largec             C   s|   d}|| }z`xZt tfD ]N}||}| t|dt||d |   | |d|dd   d }qW W d d  }}X d S )Nu   r   z\udcba'i)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}|| }z`xZt tfD ]N}||}| t|dt||d |   | |d|dd   d }qW W d d  }}X d S )Nu   𝲺r   z\U0001dcba'i)r   r   r   r   r'   r(   )r   r   r   r   r   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 )Nz
aZz.z.Aaz.r   r   r&   r   Z$r   r   r@   r!   )r   ordr   r   r   r$   )r   r   r   r   r   r4   rM   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   ?  s&   
	   $$$ (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   r     s    zBytesTest.from_latin1r   r   )r   r   c             C   s(   |  d| }| t|d| d S )Nr   zutf-8)r   r   r   decode)r   r   r   r   r   r   test_decode  s    zBytesTest.test_decodec             C   s   |  | d S )N)r   )r   r   r   r   r   r     s    zBytesTest.test_capitalizec             C   s   |  | d S )N)r~   )r   r   r   r   r   r     s    zBytesTest.test_titlec             C   s   |  | d S )N)r|   )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 )Nzlatin-1)	bytearrayr   )r   r   r   r   r   r     s    zBytearrayTest.from_latin1r   r   )r   r   c             C   s(   |  d| }| t|d| d S )Nr   zutf-8)r   r   r   r   )r   r   r   r   r   r   r     s    zBytearrayTest.test_decodec             C   s   |  | d S )N)r   )r   r   r   r   r   r     s    zBytearrayTest.test_capitalizec             C   s   |  | d S )N)r~   )r   r   r   r   r   r   "  s    zBytearrayTest.test_titlec             C   s   |  | d S )N)r|   )r   r   r   r   r   r   &  s    zBytearrayTest.test_swapcaseN)r   r   r   r   r   r   r   r   r   r   r   r   ru   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   r   c             C   sV   d| }d| }|  ||k ~d|d  }| ||k ~d| }| ||k d S )N)r0   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 )N)r   )r   r   r   r   r   test_concat_smallO  s    zTupleTest.test_concat_smallc             C   s
   |  |S )N)r   )r   r   r   r   r   test_concat_largeS  s    zTupleTest.test_concat_largerT   r   c             C   sJ   d| }|  t||d  | d|k | d|k | d|k d S )N)r   r   r!   r	   rT   rT   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 )N)Nr1   rT   r   )NNNNNr   r      iir   r   )NNNNr   )r   r   r7   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 )N)r0   r   )r   r   )r   r   r   r   r   r   basic_test_repeatz  s    zTupleTest.basic_test_repeatc             C   s
   |  |S )N)r   )r   r   r   r   r   test_repeat_small  s    zTupleTest.test_repeat_smallc             C   s
   |  |S )N)r   )r   r   r   r   r   test_repeat_large  s    zTupleTest.test_repeat_larger      c             C   s
   |  |S )N)r   )r   r   r   r   r   test_repeat_large_2  s    zTupleTest.test_repeat_large_2c             C   sh   yt tdg| }W n tk
r*   Y n:X | t|| | |d d d | |dd  d d S )N*   r   )
r   r   r   r   r   r   r   r   r   r   i)tupleiterr   r   r   )r   r   r   r   r   r   test_from_2G_generator  s    z TupleTest.test_from_2G_generatorr   c             C   sh   yt tdg| }W n tk
r*   Y n:X | t|| | |d d d | |dd  d d S )Nr   r   )
r   r   r   r   r   r   r   r   r   r   i)r   r   r   r   r   )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, Faiz
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 )N)r   )r   r   r   r   r   r     s    zTupleTest.test_repr_smallc             C   s
   |  |S )N)r   )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   r   c             C   s^   dg| }dg| }|  ||k ~dg|d  }| ||k ~dg| }| ||k d S )Nr0   r   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   rp   r   r   r   basic_test_concat  s    
zListTest.basic_test_concatr!   c             C   s
   |  |S )N)r   )r   r   r   r   r   r     s    zListTest.test_concat_smallc             C   s
   |  |S )N)r   )r   r   r   r   r   r     s    zListTest.test_concat_largec             C   s`   t jg| }||7 }| t||d  | |d |d k | ||d  ||d  k d S )Nr   r   r1   r   )sysstdoutr   r   r'   )r   r   rp   r   r   r   basic_test_inplace_concat  s
    z"ListTest.basic_test_inplace_concat	   r
   c             C   s
   |  |S )N)r   )r   r   r   r   r   test_inplace_concat_small  s    z"ListTest.test_inplace_concat_smallc             C   s
   |  |S )N)r   )r   r   r   r   r   test_inplace_concat_large  s    z"ListTest.test_inplace_concat_largerT   r   c             C   s^   dddddg| }|  t||d  | d|k | dddddg|k | d|k d S )Nr   r   r!   r	   rT   r   )r   r   r'   r)   )r   r   rp   r   r   r   r     s
    zListTest.test_containsc             C   s   dg| }|  tt| d S )Nr   )r7   	TypeErrorr   )r   r   rp   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  d dd g |  |dd | ttj||d	 |  t|| dd
dddg||d d < |d
8 }|  t|| |  |dd  d d dd
dddg dd
dddg|d d< |d
8 }|  t|| |  |d d dd
dddd d g ||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 )Nr1   rT   r   r   r   r   iir   r   r	   r   r!   r   ir   )r   r   r7   r   r   r   r$   setitem)r   r   rp   r   r   r   r     sZ    
"""


zListTest.test_index_and_slicec             C   sL   g | }|  | dg| }| t|| |d }| t||d  d S )Nr0   r   )r)   r   r   )r   r   rp   r   r   r   r   /  s    

zListTest.basic_test_repeatc             C   s
   |  |S )N)r   )r   r   r   r   r   r   7  s    zListTest.test_repeat_smallc             C   s
   |  |S )N)r   )r   r   r   r   r   r   ;  s    zListTest.test_repeat_largec             C   sz   dg}||9 }|  t|| | |d |d k ~dg| }|d9 }|  t||d  | ||d  |d k d S )Nr0   r   r1   r   r   )r   r   r'   )r   r   rp   r   r   r   basic_test_inplace_repeatA  s    
z"ListTest.basic_test_inplace_repeatc             C   s
   |  |S )N)r   )r   r   r   r   r   test_inplace_repeat_smallM  s    z"ListTest.test_inplace_repeat_smallc             C   s
   |  |S )N)r   )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, Faiz
se, False]F)r   r   r   r$   )r   r   rp   r   r   r   r   r   U  s    
zListTest.basic_test_reprr   c             C   s
   |  |S )N)r   )r   r   r   r   r   r   ^  s    zListTest.test_repr_smallc             C   s
   |  |S )N)r   )r   r   r   r   r   r   b  s    zListTest.test_repr_largec             C   s\   t  g| }|t   | t||d  | |d |d k | |d |d k d S )Nr   r   r   r1   )objectappendr   r   r'   r)   )r   r   rp   r   r   r   test_appendh  s
    zListTest.test_appendc             C   s:   dddddg| }|  |d| |  |dd d S )Nr   r   r!   r	   rT   1r   )r   r$   )r   r   rp   r   r   r   r%   p  s    zListTest.test_countc             C   s`   t g| }|| | t||d  | |d |d k | ||d  ||d  k d S )Nr   r   r1   r   )r   extendr   r   r'   )r   r   rp   r   r   r   basic_test_extendx  s
    

zListTest.basic_test_extendc             C   s
   |  |S )N)r   )r   r   r   r   r   test_extend_small  s    zListTest.test_extend_smallc             C   s
   |  |S )N)r   )r   r   r   r   r   test_extend_large  s    zListTest.test_extend_largec             C   s   dddddg| }|d9 }|  |dd |  |d|d |d  |  |d|d ||d  | t|jd|d | | t|jd d S )Nr   r   r!   r	   rT   r   r   )r   r6   r7   r8   )r   r   rp   r   r   r   r9     s    zListTest.test_indexc             C   s   dg| }| |d d |d7 }| t|| | |dd  dddg | |d d |d7 }| t|| | |dd  dddg | dd |d7 }| t|| | |d d dddg | ||d d  dddg d S )Ng      ?r   rI   r   BCr!   )insertr   r   )r   r   rp   r   r   r   test_insert  s    
zListTest.test_insertr	   c             C   s  dddddg| }|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 )Nr&   rU   rF   derT   r   r   r   r   )r   r   pop)r   r   rp   rr   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   rT   r   )r   r   remover   )r   r   rp   r   r   r   test_remove  s    



zListTest.test_removec             C   sn   dddddg| }|   | t||d  | |dd  dddddg | |d d dddddg d S )Nr   r   r!   r	   rT   r   )reverser   r   )r   r   rp   r   r   r   test_reverse  s
    zListTest.test_reverseg      ?c             C   sx   dddddg| }|   | t||d  | |d| | |d d dgd  | |dd  dgd  d S )Nr   r   r!   r	   rT   r   i)sortr   r   r$   )r   r   rp   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   r   r%   r   r   r   r9   r  r  r
  r  r  r   r   r   r   r     s<    ($ 8 ($	$  ($    r   c               C   s   t ttttt d S )N)r   Zrun_unittestr   r   r   r   r   r   r   r   r   	test_main  s    
r  __main__)__doc__Ztestr   Ztest.supportr   r   r   r   Zunittestr   r   r   r   r   maxsizer   r   ZTestCaser   r   r   r   r   r  r   r   argvZset_memlimitr   r   r   r   <module>	   s6   0   | ?   1
