a
    3j&                     @   sV   d dl Z d dlmZ d dlmZ d dlZd dlZG dd dejZe	dkrRe
  dS )    N)
list_tests)cpython_onlyc                       s   e Zd ZeZdd Zdd Z fddZdd Z fd	d
Z	dd Z
dd Zdd Zdd Zdd Zdd Zdd Zedd Zdd Z  ZS )ListTestc                 C   s   |  tg g  g d}t|}|  || | ||u |  tdg  |  tdg d |  tdg  |  tdg d |  tdd tdD g d	 tjd
kr| ttttjd  g }|dd |D  |  |g  d S )N)r              Zspam)spamc                 s   s   | ]}|d  r|V  qdS )r   Nr   ).0xr   r   J/www/server/python_manager/versions/3.9.10/lib/python3.9/test/test_list.py	<genexpr>       z&ListTest.test_basic.<locals>.<genexpr>
   )r   r         	   ir   c                 s   s   | ]}| V  qd S Nr   )r   yr   r   r   r   *   r   )	assertEquallist
assertTruerangesysmaxsizeassertRaisesMemoryErrorextend)selfZl0_3Zl0_3_bisr   r   r   r   
test_basic
   s"    
zListTest.test_basicc                 C   s:   |  td tg d W d    n1 s,0    Y  d S )Nzkeyword argument)Zsequence)ZassertRaisesRegex	TypeErrorr   r"   r   r   r   test_keyword_args-   s    zListTest.test_keyword_argsc                    s&   t    | g   | dg d S )N*   )super
test_truthr   r%   	__class__r   r   r)   1   s    
zListTest.test_truthc                 C   s   |  g g u d S r   )r   r%   r   r   r   test_identity6   s    zListTest.test_identityc                    sD   t    | tg d | tdgd | tg dd d S )Nr   r   )r   r   r   r   )r(   test_lenr   lenr%   r*   r   r   r-   9   s    
zListTest.test_lenc                 C   s^   g d}t tjd d t| }dd }dd }| ttf||| | ttf||| d S )N   r      r   r   c                 S   s   | | S r   r   r   br   r   r   mulB   r   z#ListTest.test_overflow.<locals>.mulc                 S   s   | |9 } d S r   r   r2   r   r   r   imulC   r   z$ListTest.test_overflow.<locals>.imul)intr   r   r.   r   r    OverflowError)r"   lstnr4   r5   r   r   r   test_overflow?   s    zListTest.test_overflowc                    s     fdd}|d |d d S )Nc                    s6   dg|  }t |} |dddg|   d  d S )Nr   [z, 0])reprr   join)r9   lr
   r%   r   r   checkI   s
    
z'ListTest.test_repr_large.<locals>.checkr   i@B r   )r"   rA   r   r%   r   test_repr_largeG   s    zListTest.test_repr_largec           	      C   s  |  g d}g d}ttjd D ]v}t|}t||f|}t|\}}||d d < | t|t| | t	|| t
| t||f|}t|\}}||d d < | t|t| | t	||dd   tdt|D ]}t
| qt||f|}t|\}}||d d < | t|t| | t	||t|d   | tt
| t||f|}t|\}}||d d < | t	|g  q$d S )Nr/   r                  r   )	type2testr   pickleHIGHEST_PROTOCOLiterdumpsloadsr   typer   nextr.   r   StopIteration	r"   ZorigdataprotoZitorigditr   ir   r   r   test_iterator_pickleQ   s6    
zListTest.test_iterator_picklec           	      C   s  |  g d}g d}ttjd D ]}t|}t||f|}t|\}}||d d < | t|t| | t	||t
|d d d  t| t||f|}t|\}}||d d < | t|t| | t	||t
|d d d  tdt
|D ]}t| qt||f|}t|\}}||d d < | t|t| | t	|g  | tt| t||f|}t|\}}||d d < | t	|g  q$d S )Nr/   rC   r   r   )rI   r   rJ   rK   reversedrM   rN   r   rO   r   r.   rP   r   rQ   rR   r   r   r   test_reversed_pickleu   s6    ""zListTest.test_reversed_picklec                 C   s8   g d}dg|dd t j< | |dd t j dg d S )N)r   r   r   r   r0   r   r   r   )r   r   r   )r"   r   r   r   r   test_step_overflow   s    zListTest.test_step_overflowc                 C   sN   G dd dt }| t  d|ddg  W d    n1 s@0    Y  d S )Nc                   @   s   e Zd ZdS )z*ListTest.test_no_comdat_folding.<locals>.LN)__name__
__module____qualname__r   r   r   r   L   r   r`   )r   r   r   )r   r   r$   )r"   r`   r   r   r   test_no_comdat_folding   s    zListTest.test_no_comdat_foldingc                    st   G fddd}G  fddd}G fddd}| g | g|   k | gdg}| |k d S )Nc                       s   e Zd Z fddZdS )z9ListTest.test_equal_operator_modifying_operand.<locals>.Xc                    s       tS r   clearNotImplementedr"   otherlist2r   r   __eq__   s    z@ListTest.test_equal_operator_modifying_operand.<locals>.X.__eq__Nr]   r^   r_   ri   r   rg   r   r   X   s   rk   c                       s   e Zd Z fddZdS )z9ListTest.test_equal_operator_modifying_operand.<locals>.Yc                    s       tS r   rb   re   list1r   r   ri      s    z@ListTest.test_equal_operator_modifying_operand.<locals>.Y.__eq__Nrj   r   rl   r   r   Y   s   rn   c                       s   e Zd Z fddZdS )z9ListTest.test_equal_operator_modifying_operand.<locals>.Zc                    s       tS r   rb   re   list3r   r   ri      s    z@ListTest.test_equal_operator_modifying_operand.<locals>.Z.__eq__Nrj   r   ro   r   r   Z   s   rq   r   )r   ZassertFalse)r"   rk   rn   rq   Zlist4r   )rm   rh   rp   r   %test_equal_operator_modifying_operand   s    z.ListTest.test_equal_operator_modifying_operandc                 C   sN   dgd }t |}| |t tdgd  | |t ttd d S )Nr   r   )r   	getsizeofr   r   r   )r"   iterableZ	iter_sizer   r   r   test_preallocation   s    

zListTest.test_preallocationc                    s   G  fddd}| g |  t    W d    n1 sD0    Y  G dd dt}|| g    || g |  t    W d    n1 s0    Y  | | g d v  | | g |  v  d S )Nc                       s   e Zd Z fddZdS )z3ListTest.test_count_index_remove_crashes.<locals>.Xc                    s       tS r   rb   re   r8   r   r   ri      s    z:ListTest.test_count_index_remove_crashes.<locals>.X.__eq__Nrj   r   rv   r   r   rk      s   rk   c                   @   s   e Zd Zdd ZdS )z3ListTest.test_count_index_remove_crashes.<locals>.Lc                 S   s   t | tS r   )strrd   re   r   r   r   ri      s    z:ListTest.test_count_index_remove_crashes.<locals>.L.__eq__Nrj   r   r   r   r   r`      s   r`   r   )r   
ValueErrorindexr   countremove)r"   rk   r`   r   rv   r   test_count_index_remove_crashes   s    (
(z(ListTest.test_count_index_remove_crashes)r]   r^   r_   r   rI   r#   r&   r)   r,   r-   r:   rB   rX   r[   r\   ra   rr   r   ru   r|   __classcell__r   r   r*   r   r      s    #
$$
r   __main__)r   testr   Ztest.supportr   rJ   ZunittestZ
CommonTestr   r]   mainr   r   r   r   <module>   s    b