
    xKg                        d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlm	Z	 ddl
mZ ddlmZmZmZmZ dd	lmZmZ  G d
 dee      Z G d dee      Z G d dee      Z G d dee      Z G d dee      Z G d dee      Z G d dee      Z G d dee      Z G d dee      Z G d dee      Z G d dee      Z G d  d!ee      Z G d" d#ee      Z  G d$ d%ee      Z! G d& d'ee      Z" G d( d)ee      Z# G d* d+ee      Z$ G d, d-ee      Z% G d. d/ee      Z& G d0 d1ee      Z' G d2 d3ee      Z( G d4 d5e      Z)ed6        Z* G d7 d8ee      Z+y9):ae   Tests for the compiler components of the Numba typed-list.

The tests here should exercise everything within an `@njit` context.
Importantly, the tests should not return a typed list from within such a
context as this would require code from numba/typed/typedlist.py (this is
tested separately).  Tests in this file build on each other in the order of
writing. For example, the first test, tests the creation, append and len of the
list. These are the barebones to do anything useful with a list. The subsequent
test for getitem assumes makes use of these three operations and therefore
assumes that they work.

    )dedent)njit)int32)register_jitable)types)TypingError)TestCaseMemoryLeakMixinoverride_configforbid_codegen)
listobjectListc                   "    e Zd ZdZd Zd Zd Zy)TestCreateAppendLengthz$Test list creation, append and len. c                 Z    t         d        }dD ]  }| j                   ||      |        y )Nc                     t        j                  t              }t        |       D ]  }|j	                  |        t        |      S Nr   new_listr   rangeappendlennlis      _/home/alanp/www/video.onchill/myenv/lib/python3.12/site-packages/numba/tests/test_listobject.pyfooz4TestCreateAppendLength.test_list_create.<locals>.foo   s4    ##E*A1X q6M    r         d   r   assertEqualselfr   r   s      r   test_list_createz'TestCreateAppendLength.test_list_create   s4    		 
	  ASVQ'  r   c                     t        dd      5  t               5  t        j                  t              }| j                  t        |      t               d d d        d d d        y # 1 sw Y   xY w# 1 sw Y   y xY w)NDISABLE_JITT)r   r   r   r   r   r%   typelistr'   r   s     r   test_list_create_no_jitz.TestCreateAppendLength.test_list_create_no_jit(   sS    ]D1!''.  a$/ " 21!! 21s"   A.9A"A."A+	'A..A7c                    t        dd      5  t               5  t        g d      }| j                  t	        |      t
               | j                  |g d       d d d        d d d        y # 1 sw Y   xY w# 1 sw Y   y xY w)Nr*   Tr!   r"      )r   r   r   r%   r+   r,   r-   s     r    test_nonempty_list_create_no_jitz7TestCreateAppendLength.test_nonempty_list_create_no_jit.   s\    ]D1!O  a$/  I. " 21!! 21s#   A6AA*A6*A3	/A66A?N)__name__
__module____qualname____doc__r(   r.   r2    r   r   r   r      s    .	(0/r   r   c                       e Zd ZdZd Zy)TestBoolzTest list bool.c                 `    t         d        }dD ]  }| j                   ||      |dkD          y )Nc                     t        j                  t              }t        |       D ]  }|j	                  |        t        |      S r   )r   r   r   r   r   boolr   s      r   r   z$TestBool.test_list_bool.<locals>.foo;   s4    ##E*A1X 7Nr   r    r   r$   r&   s      r   test_list_boolzTestBool.test_list_bool:   s8    		 
	  ASVQU+  r   N)r3   r4   r5   r6   r=   r7   r   r   r9   r9   7   s
    	,r   r9   c                       e Zd Zd Zd Zy)TestAllocationc                     t         d        }t        d      D ]  }| j                   ||      |        t         d        }t        d      D ]  }| j                   ||      |        y )Nc                 X    t        j                  t        |       }|j                         S )N)	allocatedr   r   r   
_allocatedr   r   s     r   	foo_kwargz6TestAllocation.test_list_allocation.<locals>.foo_kwargI   s     ##EQ7A<<>!r      c                 V    t        j                  t        |       }|j                         S r   rC   rE   s     r   
foo_posargz7TestAllocation.test_list_allocation.<locals>.foo_posargQ   s     ##E1-A<<>!r   r   r   r%   )r'   rF   r   rI   s       r   test_list_allocationz#TestAllocation.test_list_allocationH   sp    		" 
	" rAYq\1-  
	" 
	" rAZ]A. r   c                     t         d        }| j                  t              5 }| j                   |       d       d d d        | j	                  dt        j                               y # 1 sw Y   /xY w)Nc                  V    t        j                  t        d      } | j                         S NrC   r   s    r   r   z9TestAllocation.test_list_allocation_negative.<locals>.fooY   s     ##E2.A<<>!r   rO   z expecting *allocated* to be >= 0)r   assertRaisesRuntimeErrorr%   assertInstr	exceptionr'   r   raisess      r   test_list_allocation_negativez,TestAllocation.test_list_allocation_negativeX   sc    		" 
	" |,SUB' -.  !	
 -,s   A((A1N)r3   r4   r5   rK   rX   r7   r   r   r?   r?   F   s    / 
r   r?   c                       e Zd Zd Zy)TestToFromMeminfoc                 "   t         d        }t        j                  t              t         fd       } |       }| j	                  |j
                  d       t         ||            }t        t        dd            }| j	                  ||       y)zB
        Exercise listobject.{_as_meminfo, _from_meminfo}
        c                      t        j                  t              } t        dd      D ]  }| j	                  |        t        j
                  |       S N
      )r   r   r   r   r   _as_meminfor   r   s     r   boxerz:TestToFromMeminfo.test_list_to_from_meminfo.<locals>.boxerm   s>    ##E*A2r] #))!,,r   c                     t        j                  |       }|d   |d   |d   |d   |d   |d   |d   |d   |d	   |d
   f
S )Nr   r!   r"   r1                  	   )r   _from_meminfo)mir   lsttypes     r   unboxerz<TestToFromMeminfo.test_list_to_from_meminfo.<locals>.unboxerv   sX    ((W5AQ41qtQqT1Q41qtQqT1Q41MMr   r!   r^   r_   N)r   r   ListTyper   r%   refcountr,   r   )r'   rb   rm   rk   receivedexpectedrl   s         @r   test_list_to_from_meminfoz+TestToFromMeminfo.test_list_to_from_meminfoh   s    
 
	- 
	- ..'		N 
	N Wa($b"&8,r   N)r3   r4   r5   rr   r7   r   r   rZ   rZ   f   s    -r   rZ   c                   F    e Zd ZdZd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zy)TestGetitemzTest list getitem. c                 L    t         d        }| j                   |d      d       y )Nc                 `    t        j                  t              }|j                  |        |d   S Nr   r   r   r   r   rE   s     r   r   z4TestGetitem.test_list_getitem_singleton.<locals>.foo   &    ##E*AHHQKQ4Kr   r   r$   r'   r   s     r   test_list_getitem_singletonz'TestGetitem.test_list_getitem_singleton   s*    		 
	
 	Q#r   c                 L    t         d        }| j                   |d      d       y )Nc                 `    t        j                  t              }|j                  |        |d   S rN   rx   rE   s     r   r   zBTestGetitem.test_list_getitem_singleton_negtive_index.<locals>.foo   s&    ##E*AHHQKR5Lr   r   r$   rz   s     r   )test_list_getitem_singleton_negtive_indexz5TestGetitem.test_list_getitem_singleton_negtive_index   s*    		 
	
 	Q#r   c                 `    t         d        }dD ]  \  }}| j                   ||      |        y )Nc                     t        j                  t              }t        dd      D ]  }|j	                  |        ||    S r]   r   r   r   r   r   r   r   js      r   r   z3TestGetitem.test_list_getitem_multiple.<locals>.foo   6    ##E*A2r] #Q4Kr   r   r^   )ri      )rd      )   )rO   r   )r^   r$   r'   r   r   r   s       r   test_list_getitem_multiplez&TestGetitem.test_list_getitem_multiple   s:    		 
	 NCAaSVQ' Nr   c                     | j                          t        d        }dD ]M  }| j                  t              5 } ||       d d d        | j	                  dt        j                               O y # 1 sw Y   1xY w)Nc                 >    t        j                  t              }||    S r   r   r   r   r   r   s     r   r   z<TestGetitem.test_list_getitem_empty_index_error.<locals>.foo       ##E*AQ4Kr   )r!   r   rO   list index out of rangedisable_leak_checkr   rQ   
IndexErrorrS   rT   rU   r'   r   r   rW   s       r   #test_list_getitem_empty_index_errorz/TestGetitem.test_list_getitem_empty_index_error   sl    !		 
	 A"":.&A /MM)F$$% ..   	A00A9	c                     | j                          t        d        }dD ]M  }| j                  t              5 } ||       d d d        | j	                  dt        j                               O y # 1 sw Y   1xY w)Nc                     t        j                  t              }t        dd      D ]  }|j	                  |        ||    S r]   r   r   s      r   r   z?TestGetitem.test_list_getitem_multiple_index_error.<locals>.foo   r   r   )r^   r   r   r   s       r   &test_list_getitem_multiple_index_errorz2TestGetitem.test_list_getitem_multiple_index_error   sl    !		 
	 A"":.&A /MM)F$$% ..r   c                     | j                          t        d        }dD ]M  }| j                  t              5 } ||       d d d        | j	                  dt        j                               O y # 1 sw Y   1xY w)Nc                 >    t        j                  t              }||    S r   r   r   s     r   r   z=TestGetitem.test_list_getitem_empty_typing_error.<locals>.foo   r   r   xyzg      ?y              ?'list indices must be integers or slicesr   r   rQ   r   rS   rT   rU   r   s       r   $test_list_getitem_empty_typing_errorz0TestGetitem.test_list_getitem_empty_typing_error   sl    !		 
	  A"";/6A 0MM9F$$%  //r   c                     t         d        }t        j                  D ]   }| j                   | |d            d       " y )Nc                 `    t        j                  t              }|j                  d       ||    S rw   rx   r   s     r   r   zATestGetitem.test_list_getitem_integer_types_as_index.<locals>.foo   ry   r   r   r   r   signed_domainr%   r'   r   ts      r   (test_list_getitem_integer_types_as_indexz4TestGetitem.test_list_getitem_integer_types_as_index   s>    		 
	 %%AS!A$[!, &r   c                 z    t         j                  D ]'  t        fd       }| j                   |       d       ) y )Nc                  n    t        j                  t              } | j                  d       |  d         S )Nrg   r   rx   r   tys    r   r   zETestGetitem.test_list_getitem_different_sized_uint_index.<locals>.foo   s+    ''.Axr   rg   )r   unsigned_domainr   r%   r'   r   r   s     @r   ,test_list_getitem_different_sized_uint_indexz8TestGetitem.test_list_getitem_different_sized_uint_index   s;    
 ''B   
 SUA& (r   c                 z    t         j                  D ]'  t        fd       }| j                   |       d       ) y )Nc                      t        j                  t              } | j                  d       |  d         |  d         fS )Nrg   r   rO   rx   r   s    r   r   zDTestGetitem.test_list_getitem_different_sized_int_index.<locals>.foo   s9    ''.Ax2b6**r   )rg   rg   )r   r   r   r%   r   s     @r   +test_list_getitem_different_sized_int_indexz7TestGetitem.test_list_getitem_different_sized_int_index   s;    
 %%B+ +
 SUF+ &r   N)r3   r4   r5   r6   r{   r~   r   r   r   r   r   r   r   r7   r   r   rt   rt      s2    $$	( $ -',r   rt   c                       e Zd ZdZd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zy)TestGetitemSlicez-Test list getitem when indexing with slices. c                 J    t         d        }| j                   |       d       y )Nc                  T    t        j                  t              } | d d  }t        |      S r   )r   r   r   r   r   r   s     r   r   zDTestGetitemSlice.test_list_getitem_empty_slice_defaults.<locals>.foo  s$    ##E*A!Aq6Mr   r   r$   rz   s     r   &test_list_getitem_empty_slice_defaultsz7TestGetitemSlice.test_list_getitem_empty_slice_defaults  (    		 
	
 	"r   c                 J    t         d        }| j                   |       d       y )Nc                  v    t        j                  t              } | j                  d       | d d  }t	        |      S rw   r   r   r   r   r   r   s     r   r   zHTestGetitemSlice.test_list_getitem_singleton_slice_defaults.<locals>.foo  s/    ##E*AHHQK!Aq6Mr   r!   r$   rz   s     r   *test_list_getitem_singleton_slice_defaultsz;TestGetitemSlice.test_list_getitem_singleton_slice_defaults  (    		 
	 	"r   c                 `    t         d        }dD ]  \  }}| j                   ||      |        y )Nc                     t        j                  t              }t        dd      D ]  }|j	                  |        |d d  }||    S r]   r   )r   r   r   r   s       r   r   zGTestGetitemSlice.test_list_getitem_multiple_slice_defaults.<locals>.foo  s?    ##E*A2r] #!AQ4Kr   r   r$   r   s       r   )test_list_getitem_multiple_slice_defaultsz:TestGetitemSlice.test_list_getitem_multiple_slice_defaults  s:    		 
	 NCAaSVQ' Nr   c                 x    t         d        } |       \  }}| j                  |d       | j                  |d       y )Nc                      t        j                  t              } t        dd      D ]  }| j	                  |        | dd  }t        |      |d   |d   |d   |d   |d   ffS 	Nr^   r_   re   r   r!   r"   r1   rd   r   r   r   r   s      r   r   zHTestGetitemSlice.test_list_getitem_multiple_slice_pos_start.<locals>.foo"  sf    ##E*A2r] #!"Aq6AaD!A$!adAaD999r   re   r   rG         r   r$   r'   r   lengthitemss       r   *test_list_getitem_multiple_slice_pos_startz;TestGetitemSlice.test_list_getitem_multiple_slice_pos_start!  B    		: 
	: # 45r   c                 x    t         d        } |       \  }}| j                  |d       | j                  |d       y )Nc                      t        j                  t              } t        dd      D ]  }| j	                  |        | d d }t        |      |d   |d   |d   |d   |d   ffS r   r   r   s      r   r   zGTestGetitemSlice.test_list_getitem_multiple_slice_pos_stop.<locals>.foo/  sf    ##E*A2r] #"1Aq6AaD!A$!adAaD999r   re   r^            r   r$   r   s       r   )test_list_getitem_multiple_slice_pos_stopz:TestGetitemSlice.test_list_getitem_multiple_slice_pos_stop.  r   r   c                 x    t         d        } |       \  }}| j                  |d       | j                  |d       y )Nc                      t        j                  t              } t        dd      D ]  }| j	                  |        | dd }t        |      |d   |d   |d   |d   |d   ffS )	Nr^   r_   r"   rg   r   r!   r1   rd   r   r   s      r   r   zQTestGetitemSlice.test_list_getitem_multiple_slice_pos_start_pos_stop.<locals>.foo<  sf    ##E*A2r] #!AAq6AaD!A$!adAaD999r   re   )r   r   r   r   rG   r$   r   s       r   3test_list_getitem_multiple_slice_pos_start_pos_stopzDTestGetitemSlice.test_list_getitem_multiple_slice_pos_start_pos_stop;  r   r   c                 x    t         d        } |       \  }}| j                  |d       | j                  |d       y )Nc                      t        j                  t              } t        dd      D ]  }| j	                  |        | ddd   }t        |      |d   |d   |d   |d   ffS )Nr^   r_   r!   ri   r"   r   r1   r   r   s      r   r   zZTestGetitemSlice.test_list_getitem_multiple_slice_pos_start_pos_stop_pos_step.<locals>.fooI  sd    ##E*A2r] #!Aa%Aq6AaD!A$!ad333r   rd   )r   r   r   r   r$   r   s       r   <test_list_getitem_multiple_slice_pos_start_pos_stop_pos_stepzMTestGetitemSlice.test_list_getitem_multiple_slice_pos_start_pos_stop_pos_stepH  sB    		4 
	4 # 01r   c                 x    t         d        } |       \  }}| j                  |d       | j                  |d       y )Nc                      t        j                  t              } t        dd      D ]  }| j	                  |        | dd  }t        |      |d   |d   |d   |d   |d   ffS 	Nr^   r_   r   r   r!   r"   r1   rd   r   r   s      r   r   zHTestGetitemSlice.test_list_getitem_multiple_slice_neg_start.<locals>.fooV  sf    ##E*A2r] #"#Aq6AaD!A$!adAaD999r   re   r   r$   r   s       r   *test_list_getitem_multiple_slice_neg_startz;TestGetitemSlice.test_list_getitem_multiple_slice_neg_startU  r   r   c                 x    t         d        } |       \  }}| j                  |d       | j                  |d       y )Nc                      t        j                  t              } t        dd      D ]  }| j	                  |        | d d }t        |      |d   |d   |d   |d   |d   ffS r   r   r   s      r   r   zGTestGetitemSlice.test_list_getitem_multiple_slice_neg_stop.<locals>.fooc  sf    ##E*A2r] ##2Aq6AaD!A$!adAaD999r   re   r   r$   r   s       r   )test_list_getitem_multiple_slice_neg_stopz:TestGetitemSlice.test_list_getitem_multiple_slice_neg_stopb  r   r   c                 x    t         d        } |       \  }}| j                  |d       | j                  |d       y )Nc                      t        j                  t              } t        dd      D ]  }| j	                  |        | d d d   }t        |      |d   |d   |d   |d   |d   ffS )	Nr^   r_   r   r!   r"   r1   rd   r   r   s      r   r   zGTestGetitemSlice.test_list_getitem_multiple_slice_neg_step.<locals>.foop  sh    ##E*A2r] #$B$Aq6AaD!A$!adAaD999r   re   )r   r   r   r   r   r$   r   s       r   )test_list_getitem_multiple_slice_neg_stepz:TestGetitemSlice.test_list_getitem_multiple_slice_neg_stepo  r   r   c                 x    t         d        } |       \  }}| j                  |d       | j                  |d       y )Nc                      t        j                  t              } t        dd      D ]  }| j	                  |        | dd d   }t        |      |d   |d   |d   |d   |d   ffS 	Nr^   r_   rd   rO   r   r!   r"   r1   r   r   s      r   r   zQTestGetitemSlice.test_list_getitem_multiple_slice_pos_start_neg_step.<locals>.foo}  sj    ##E*A2r] #!%R%Aq6AaD!A$!adAaD999r   re   r   r   r   r   r^   r$   r   s       r   3test_list_getitem_multiple_slice_pos_start_neg_stepzDTestGetitemSlice.test_list_getitem_multiple_slice_pos_start_neg_step|  r   r   c                 x    t         d        } |       \  }}| j                  |d       | j                  |d       y )Nc                      t        j                  t              } t        dd      D ]  }| j	                  |        | dd d   }t        |      |d   |d   |d   |d   |d	   ffS 
Nr^   r_   irO   r   r!   r"   r1   rd   r   r   s      r   r   zQTestGetitemSlice.test_list_getitem_multiple_slice_neg_start_neg_step.<locals>.foo  sj    ##E*A2r] #"&b&	Aq6AaD!A$!adAaD999r   re   r   r$   r   s       r   3test_list_getitem_multiple_slice_neg_start_neg_stepzDTestGetitemSlice.test_list_getitem_multiple_slice_neg_start_neg_step  r   r   c                 x    t         d        } |       \  }}| j                  |d       | j                  |d       y )Nc                      t        j                  t              } t        dd      D ]  }| j	                  |        | d dd   }t        |      |d   |d   |d   |d   |d   ffS r   r   r   s      r   r   zPTestGetitemSlice.test_list_getitem_multiple_slice_pos_stop_neg_step.<locals>.foo  sj    ##E*A2r] #%1R%Aq6AaD!A$!adAaD999r   re   r   r   r   rG   r   r$   r   s       r   2test_list_getitem_multiple_slice_pos_stop_neg_stepzCTestGetitemSlice.test_list_getitem_multiple_slice_pos_stop_neg_step  r   r   c                 x    t         d        } |       \  }}| j                  |d       | j                  |d       y )Nc                      t        j                  t              } t        dd      D ]  }| j	                  |        | d dd   }t        |      |d   |d   |d   |d   |d	   ffS r   r   r   s      r   r   zPTestGetitemSlice.test_list_getitem_multiple_slice_neg_stop_neg_step.<locals>.foo  sj    ##E*A2r] #&2b&	Aq6AaD!A$!adAaD999r   re   r   r$   r   s       r   2test_list_getitem_multiple_slice_neg_stop_neg_stepzCTestGetitemSlice.test_list_getitem_multiple_slice_neg_stop_neg_step  r   r   c                 x    t         d        } |       \  }}| j                  |d       | j                  |d       y )Nc                      t        j                  t              } t        dd      D ]  }| j	                  |        | ddd   }t        |      |d   |d   |d   |d   |d	   ffS )
Nr^   r_   rh   r1   rO   r   r!   r"   rd   r   r   s      r   r   zZTestGetitemSlice.test_list_getitem_multiple_slice_pos_start_pos_stop_neg_step.<locals>.foo  sj    ##E*A2r] #!Ab&	Aq6AaD!A$!adAaD999r   re   r   r   rG   r   r   r$   r   s       r   <test_list_getitem_multiple_slice_pos_start_pos_stop_neg_stepzMTestGetitemSlice.test_list_getitem_multiple_slice_pos_start_pos_stop_neg_step  r   r   c                 x    t         d        } |       \  }}| j                  |d       | j                  |d       y )Nc                      t        j                  t              } t        dd      D ]  }| j	                  |        | ddd   }t        |      |d   |d   |d   |d	   |d
   ffS )Nr^   r_   r   irO   r   r!   r"   r1   rd   r   r   s      r   r   zZTestGetitemSlice.test_list_getitem_multiple_slice_neg_start_neg_stop_neg_step.<locals>.foo  sj    ##E*A2r] #"R(Aq6AaD!A$!adAaD999r   re   r   r$   r   s       r   <test_list_getitem_multiple_slice_neg_start_neg_stop_neg_stepzMTestGetitemSlice.test_list_getitem_multiple_slice_neg_start_neg_stop_neg_step  r   r   c                 J    t         d        }| j                   |       d       y )Nc                      t        j                  t              } t        dd      D ]  }| j	                  |        | dd  }t        |      S r]   r   r   s      r   r   zQTestGetitemSlice.test_list_getitem_multiple_slice_start_out_of_range.<locals>.foo  sA    ##E*A2r] #"#Aq6Mr   r   r$   rz   s     r   3test_list_getitem_multiple_slice_start_out_of_rangezDTestGetitemSlice.test_list_getitem_multiple_slice_start_out_of_range  (    		 
	 	"r   c                 J    t         d        }| j                   |       d       y )Nc                      t        j                  t              } t        dd      D ]  }| j	                  |        | d d }t        |      S Nr^   r_   r   r   r   s      r   r   zHTestGetitemSlice.test_list_getitem_multiple_slice_stop_zero.<locals>.foo  sA    ##E*A2r] #"1Aq6Mr   r   r$   rz   s     r   *test_list_getitem_multiple_slice_stop_zeroz;TestGetitemSlice.test_list_getitem_multiple_slice_stop_zero  r  r   c                     | j                          t        d        }| j                  t              5 } |        d d d        | j	                  dt        j                               y # 1 sw Y   /xY w)Nc                      t        j                  t              } t        dd      D ]  }| j	                  |        | d d d    y r  r   r   r   s     r   r   zTTestGetitemSlice.test_list_getitem_multiple_slice_zero_step_index_error.<locals>.foo  s8    ##E*A2r] #ccFr   zslice step cannot be zeror   r   rQ   
ValueErrorrS   rT   rU   rV   s      r   6test_list_getitem_multiple_slice_zero_step_index_errorzGTestGetitemSlice.test_list_getitem_multiple_slice_zero_step_index_error  sb    !		 
	 z*fE +'  !	
 +*   A((A1N)r3   r4   r5   r6   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r7   r   r   r   r      sd    7##
(6662666666666	#	#
r   r   c                   @    e Zd ZdZd Zd Zd Zd Zd Zd Z	d Z
d	 Zy
)TestSetitemzTest list setitem. c                 Z    t         d        }dD ]  }| j                   ||      |        y )Nc                 j    t        j                  t              }|j                  d       | |d<   |d   S rw   rx   rE   s     r   r   z4TestSetitem.test_list_setitem_singleton.<locals>.foo  /    ##E*AHHQKAaDQ4Kr   r    r$   r&   s      r   test_list_setitem_singletonz'TestSetitem.test_list_setitem_singleton  s4    		 
	  ASVQ'  r   c                 Z    t         d        }dD ]  }| j                   ||      |        y )Nc                 j    t        j                  t              }|j                  d       | |d<   |d   S )Nr   rO   rx   rE   s     r   r   zCTestSetitem.test_list_setitem_singleton_negative_index.<locals>.foo  s/    ##E*AHHQKAaDR5Lr   r    r$   r&   s      r   *test_list_setitem_singleton_negative_indexz6TestSetitem.test_list_setitem_singleton_negative_index   s4    		 
	  ASVQ'  r   c                    | j                          t        d        }| j                  t              5   |d       d d d        | j                  t              5   |d       d d d        y # 1 sw Y   0xY w# 1 sw Y   y xY w)Nc                 b    t        j                  t              }|j                  d       d|| <   y Nr   r!   rx   r   s     r   r   z@TestSetitem.test_list_setitem_singleton_index_error.<locals>.foo  s&    ##E*AHHQKAaDr   r!   r   r   r   rQ   r   rz   s     r   'test_list_setitem_singleton_index_errorz3TestSetitem.test_list_setitem_singleton_index_error  sm    !		 
	
 z*F + z*G +* +* +*   	A*	A6*A36A?c                     t         d        }t        t        dd      t        dd            D ]  \  }}| j                   |||      |         y )Nc                     t        j                  t              }t        dd      D ]  }|j	                  |        ||| <   ||    S r]   r   )r   r   r   r   s       r   r   z3TestSetitem.test_list_setitem_multiple.<locals>.foo  s?    ##E*A2r] #AaDQ4Kr   r   r^   r_      r   zipr   r%   r'   r   r   r   s       r   test_list_setitem_multiplez&TestSetitem.test_list_setitem_multiple  sM    		 
	 uQr{E"RL1CAaSAY* 2r   c                    | j                          t        d        }| j                  t              5   |d       d d d        | j                  t              5   |d       d d d        y # 1 sw Y   0xY w# 1 sw Y   y xY w)Nc                     t        j                  t              }t        dd      D ]  }|j	                  |        d|| <   y r  r   r   s      r   r   z?TestSetitem.test_list_setitem_multiple_index_error.<locals>.foo*  s6    ##E*A2r] #AaDr   r^   r   r  rz   s     r   &test_list_setitem_multiple_index_errorz2TestSetitem.test_list_setitem_multiple_index_error'  sm    !		 
	 z*G + z*H +* +* +*r  c                     | j                          t        d        }dD ]M  }| j                  t              5 } ||       d d d        | j	                  dt        j                               O y # 1 sw Y   1xY w)Nc                 b    t        j                  t              }|j                  d       d|| <   y r  rx   r   s     r   r   zJTestSetitem.test_list_setitem_singleton_typing_error_on_index.<locals>.foo:  s&    ##E*AHHQKAaDr   r   r   r   r   s       r   1test_list_setitem_singleton_typing_error_on_indexz=TestSetitem.test_list_setitem_singleton_typing_error_on_index7  sl    !		 
	  A"";/6A 0MM9F$$%  //r   c                     | j                          t        d        }| j                  t              5 } |        d d d        | j	                  dt        j                               y # 1 sw Y   /xY w)Nc                  b    t        j                  t              } | j                  d       d| d d  y r  rx   rP   s    r   r   zITestSetitem.test_list_setitem_singleton_typing_error_on_item.<locals>.fooL  s&    ##E*AHHQKAaDr   zFcan only assign an iterable when using a slice with assignment/setitemr   rV   s      r   0test_list_setitem_singleton_typing_error_on_itemz<TestSetitem.test_list_setitem_singleton_typing_error_on_itemI  sd    !		 
	 {+vE ,&  !	
 ,+r  c                     t         d        }t        j                  D ]   }| j                   | |d            d       " y )Nc                 j    t        j                  t              }|j                  d       d|| <   ||    S r  rx   r   s     r   r   zATestSetitem.test_list_setitem_integer_types_as_index.<locals>.foo]  r  r   r   r!   r   r   s      r   (test_list_setitem_integer_types_as_indexz4TestSetitem.test_list_setitem_integer_types_as_index[  s>    		 
	 %%AS!A$[!, &r   N)r3   r4   r5   r6   r  r  r  r$  r'  r*  r-  r0  r7   r   r   r  r    s-    	(	(+ $
$-r   r  c                   F    e Zd ZdZd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zy)TestPopzTest list pop. c                 J    t         d        }| j                   |       d       y )Nc                      t        j                  t              } | j                  d       | j	                         t        |       fS rw   r   r   r   r   popr   rP   s    r   r   z,TestPop.test_list_pop_singleton.<locals>.foon  s1    ##E*AHHQK557CF?"r   r   r   r$   rz   s     r   test_list_pop_singletonzTestPop.test_list_pop_singletonm  s(    		# 
	#
 	'r   c                 |    t         d        }| j                   |d      d       | j                   |d      d       y )Nc                     t        j                  t              }|j                  d       |j	                  |       t        |      fS rw   r5  r   s     r   r   z2TestPop.test_list_pop_singleton_index.<locals>.foow  s4    ##E*AHHQK558SV##r   r   r7  rO   r$   rz   s     r   test_list_pop_singleton_indexz%TestPop.test_list_pop_singleton_indexv  s>    		$ 
	$
 	Q(R&)r   c                 J    t         d        }| j                   |       d       y )Nc                      t        j                  t              } dD ]  }| j                  |        | j	                         t        |       fS Nr^   r   r   r5  r
  s     r   r   z+TestPop.test_list_pop_multiple.<locals>.foo  s;    ##E*A! "557CF?"r   )r   r"   r$   rz   s     r   test_list_pop_multiplezTestPop.test_list_pop_multiple  s(    		# 
	# 	(r   c                     t         d        }dD ]  \  }}| j                   ||      |df       ! dD ]  \  }}| j                   ||      |df       ! y )Nc                     t        j                  t              }dD ]  }|j                  |        |j	                  |       t        |      fS r>  r5  r   s      r   r   z1TestPop.test_list_pop_multiple_index.<locals>.foo  s>    ##E*A! "558SV##r   )r   )r!   r   )r"   r   r"   ))r^   )r   r   )rO   r   r$   r#  s       r   test_list_pop_multiple_indexz$TestPop.test_list_pop_multiple_index  sd    		$ 
	$ 0DAqSVaV, 0 3DAqSVaV, 3r   c                     t         d        }t        j                  D ]   }| j                   | |d            d       " y )Nc                 x    t        j                  t              }|j                  d       |j	                  |       S rw   r   r   r   r   r6  r   s     r   r   z9TestPop.test_list_pop_integer_types_as_index.<locals>.foo  s*    ##E*AHHQK558Or   r   r   r   s      r   $test_list_pop_integer_types_as_indexz,TestPop.test_list_pop_integer_types_as_index  s>    		 
	 %%AS!A$[!, &r   c                     | j                          t        d        }| j                  t              5 } |        d d d        | j	                  dt        j                               y # 1 sw Y   /xY w)Nc                  V    t        j                  t              } | j                          y r   r   r   r   r6  rP   s    r   r   z=TestPop.test_list_pop_empty_index_error_no_index.<locals>.foo  s    ##E*AEEGr   pop from empty listr   rV   s      r   (test_list_pop_empty_index_error_no_indexz0TestPop.test_list_pop_empty_index_error_no_index  sb    !		 
	 z*fE +!  !	
 +*r  c                 F   | j                          t        d        }| j                  t              5 } |d       d d d        | j	                  dt        j                               | j                  t              5 } |d       d d d        | j	                  dt        |j                               | j                  t              5 } |d       d d d        | j	                  dt        |j                               y # 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   GxY w)Nc                 X    t        j                  t              }|j                  |        y r   rK  r   s     r   r   z?TestPop.test_list_pop_empty_index_error_with_index.<locals>.foo  s    ##E*AEE!Hr   rO   rL  r   r!   r   rV   s      r   *test_list_pop_empty_index_error_with_indexz2TestPop.test_list_pop_empty_index_error_with_index  s    !		 
	 z*fG +!  !	

 z*fF +!  !	

 z*fF +!  !	
! +* +* +*s#   	C?=	D	D?DDD c                    | j                          t        d        }| j                  t              5 } |d       d d d        | j	                  dt        j                               | j                  t              5 } |d       d d d        | j	                  dt        |j                               y # 1 sw Y   zxY w# 1 sw Y   ;xY w)Nc                     t        j                  t              }dD ]  }|j                  |        |j	                  |        y r>  rG  r   s      r   r   zATestPop.test_list_pop_mutiple_index_error_with_index.<locals>.foo  s2    ##E*A! "EE!Hr   r   r1   r   rV   s      r   ,test_list_pop_mutiple_index_error_with_indexz4TestPop.test_list_pop_mutiple_index_error_with_index  s    !		 
	 z*fG +%  !	

 z*fF +%  !	
 +* +*s   	B4=	C 4B= C	c                     | j                          t        d        }dD ]M  }| j                  t              5 } ||       d d d        | j	                  dt        j                               O y # 1 sw Y   1xY w)Nc                 x    t        j                  t              }|j                  d       |j	                  |       S rw   rG  r   s     r   r   zBTestPop.test_list_pop_singleton_typing_error_on_index.<locals>.foo  s*    ##E*AHHQK558Or   r   z#argument for pop must be an integerr   r   s       r   -test_list_pop_singleton_typing_error_on_indexz5TestPop.test_list_pop_singleton_typing_error_on_index  sl    !		 
	  A"";/6A 0MM5F$$%  //r   N)r3   r4   r5   r6   r8  r;  r@  rD  rH  rM  rP  rT  rW  r7   r   r   r2  r2  j  s2    (*)--

:
0r   r2  c                   L    e Zd ZdZd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zy)TestListObjectDelitemzTest list delitem.
    c                 J    t         d        }| j                   |       d       y )Nc                  r    t        j                  t              } | j                  d       | d= t	        |       S rw   r   rP   s    r   r   zDTestListObjectDelitem.test_list_singleton_delitem_index.<locals>.foo  s-    ##E*AHHQK!q6Mr   r   r$   rz   s     r   !test_list_singleton_delitem_indexz7TestListObjectDelitem.test_list_singleton_delitem_index   (    		 
	
 	"r   c                 J    t         d        }| j                   |       d       y )Nc                  v    t        j                  t              } | j                  d       | d d = t	        |       S rw   r   rP   s    r   r   zMTestListObjectDelitem.test_list_singleton_delitem_slice_defaults.<locals>.foo  s-    ##E*AHHQK!q6Mr   r   r$   rz   s     r   *test_list_singleton_delitem_slice_defaultsz@TestListObjectDelitem.test_list_singleton_delitem_slice_defaults
  r]  r   c                 J    t         d        }| j                   |       d       y )Nc                  v    t        j                  t              } | j                  d       | dd = t	        |       S rw   r   rP   s    r   r   zJTestListObjectDelitem.test_list_singleton_delitem_slice_start.<locals>.foo  s/    ##E*AHHQK!"q6Mr   r   r$   rz   s     r   'test_list_singleton_delitem_slice_startz=TestListObjectDelitem.test_list_singleton_delitem_slice_start  r]  r   c                 J    t         d        }| j                   |       d       y )Nc                  v    t        j                  t              } | j                  d       | d d= t	        |       S r  r   rP   s    r   r   zITestListObjectDelitem.test_list_singleton_delitem_slice_stop.<locals>.foo   s1    ##E*AHHQK"1"q6Mr   r   r$   rz   s     r   &test_list_singleton_delitem_slice_stopz<TestListObjectDelitem.test_list_singleton_delitem_slice_stop  r]  r   c                 J    t         d        }| j                   |       d       y )Nc                  v    t        j                  t              } | j                  d       | dd= t	        |       S r  r   rP   s    r   r   zOTestListObjectDelitem.test_list_singleton_delitem_slice_start_stop.<locals>.foo*  s1    ##E*AHHQK!A#q6Mr   r   r$   rz   s     r   ,test_list_singleton_delitem_slice_start_stopzBTestListObjectDelitem.test_list_singleton_delitem_slice_start_stop(  r]  r   c                 J    t         d        }| j                   |       d       y )Nc                  x    t        j                  t              } | j                  d       | dd d= t	        |       S r  r   rP   s    r   r   zOTestListObjectDelitem.test_list_singleton_delitem_slice_start_step.<locals>.foo4  s3    ##E*AHHQK!$Q$q6Mr   r   r$   rz   s     r   ,test_list_singleton_delitem_slice_start_stepzBTestListObjectDelitem.test_list_singleton_delitem_slice_start_step2  r]  r   c                 J    t         d        }| j                   |       d       y )Nc                  x    t        j                  t              } | j                  d       | ddd= t	        |       S r  r   rP   s    r   r   zTTestListObjectDelitem.test_list_singleton_delitem_slice_start_stop_step.<locals>.foo>  s3    ##E*AHHQK!Aa%q6Mr   r   r$   rz   s     r   1test_list_singleton_delitem_slice_start_stop_stepzGTestListObjectDelitem.test_list_singleton_delitem_slice_start_stop_step<  r]  r   c                 J    t         d        }| j                   |       d       y )Nc                      t        j                  t              } dD ]  }| j                  |        | d= t	        |       | d   | d   fS )Nr?  r   r!   r   r
  s     r   r   z=TestListObjectDelitem.test_list_multiple_delitem.<locals>.fooH  sG    ##E*A! "!q61Q41%%r   )r"   r   r   r$   rz   s     r   test_list_multiple_delitemz0TestListObjectDelitem.test_list_multiple_delitemF  s(    		& 
	& 	,r   c                 J    t         d        }| j                   |       d       y )Nc                      t        j                  t              } dD ]  }| j                  |        | d d = t	        |       S r>  r   r
  s     r   r   zCTestListObjectDelitem.test_list_multiple_delitem_slice.<locals>.fooS  s7    ##E*A! "!q6Mr   r   r$   rz   s     r    test_list_multiple_delitem_slicez6TestListObjectDelitem.test_list_multiple_delitem_sliceQ  s(    		 
	 	"r   c                 H    t         d        }| j                   |              y )Nc                     t        j                  t              } t        dd      D ]  }| j	                  |        t        j                  t              }t        dd      D ]  }|j	                  |        | dd= || k(  S )Nr^   r_   iir   )r   r   ks      r   r   zHTestListObjectDelitem.test_list_multiple_delitem_off_by_one.<locals>.foo_  sn    ##E*A2r] ###E*A2r] # "S&	6Mr   r   
assertTruerz   s     r   %test_list_multiple_delitem_off_by_onez;TestListObjectDelitem.test_list_multiple_delitem_off_by_one\  s&     
		 
		 	r   N)r3   r4   r5   r6   r\  r`  rc  rf  ri  rl  ro  rr  ru  r{  r7   r   r   rY  rY    s9    #######	-	#r   rY  c                   "    e Zd ZdZd Zd Zd Zy)TestContainszTest list contains. c                 x    t         d        }| j                   |d             | j                   |d             y )Nc                 <    t        j                  t              }| |v S r   r   r   s     r   r   z2TestContains.test_list_contains_empty.<locals>.fooq  s    ##E*A6Mr   r   r!   r   assertFalserz   s     r   test_list_contains_emptyz%TestContains.test_list_contains_emptyp  s:    		 
	 	Q Q r   c                 x    t         d        }| j                   |d             | j                   |d             y )Nc                 ^    t        j                  t              }|j                  d       | |v S rw   rx   r   s     r   r   z6TestContains.test_list_contains_singleton.<locals>.fooz  s&    ##E*AHHQK6Mr   r   r!   )r   rz  r  rz   s     r   test_list_contains_singletonz)TestContains.test_list_contains_singletony  s8    		 
	
 	AQ r   c                     t         d        }t        dd      D ]  }| j                   ||              t        dd      D ]  }| j                   ||              y )Nc                     t        j                  t              }t        dd      D ]  }|j	                  |        | |v S r]   r   r   s      r   r   z5TestContains.test_list_contains_multiple.<locals>.foo  s6    ##E*A2r] #6Mr   r^   r_   r   )r   r   rz  r  r&   s      r   test_list_contains_multiplez(TestContains.test_list_contains_multiple  sZ    		 
	 r2AOOCF#  r2ASV$ r   N)r3   r4   r5   r6   r  r  r  r7   r   r   r}  r}  m  s    !!%r   r}  c                   "    e Zd ZdZd Zd Zd Zy)	TestCountzTest list count. c                 L    t         d        }| j                   |d      d       y )Nc                 V    t        j                  t              }|j                  |       S r   )r   r   r   countr   s     r   r   z,TestCount.test_list_count_empty.<locals>.foo  s     ##E*A771:r   r^   r   r$   rz   s     r   test_list_count_emptyzTestCount.test_list_count_empty  s*    		 
	 	R!$r   c                 |    t         d        }| j                   |d      d       | j                   |d      d       y )Nc                 x    t        j                  t              }|j                  d       |j	                  |       S Nr^   r   r   r   r   r  r   s     r   r   z0TestCount.test_list_count_singleton.<locals>.foo  s+    ##E*AHHRL771:r   r!   r   r^   r$   rz   s     r   test_list_count_singletonz#TestCount.test_list_count_singleton  s>    		 
	
 	Q#R!$r   c                     t         d        }| j                   |d      d       | j                   |d      d       | j                   |d      d       | j                   |d      d	       y )
Nc                     t        j                  t              }dD ]  }|j                  |        |j	                  |       S )N)r   r   r   r   r   r   r  r   s      r   r   z.TestCount.test_list_count_mutiple.<locals>.foo  s5    ##E*A- .771:r   r^   r   r   r!   r   r"   r   r1   r$   rz   s     r   test_list_count_mutiplez!TestCount.test_list_count_mutiple  sf    		 
	 	R!$R!$R!$R!$r   N)r3   r4   r5   r6   r  r  r  r7   r   r   r  r    s    %%%r   r  c                       e Zd ZdZd Zd Zy)
TestExtendzTest list extend. c                     t         d        }| j                   |d      d       | j                   |d      d       | j                   |d      d       y )Nc                 l    t        j                  t              }|j                  |        t	        |      S r   )r   r   r   extendr   )r   r   s     r   r   z.TestExtend.test_list_extend_empty.<locals>.foo  s&    ##E*AHHUOq6Mr   )r!   r!   )r!   r"   r"   r0   r1   r$   rz   s     r   test_list_extend_emptyz!TestExtend.test_list_extend_empty  sR    		 
	
 	TA&UQ'Wq)r   c                     | j                          t        d        }| j                  t              5 } |        d d d        | j	                  dt        j                               y # 1 sw Y   /xY w)Nc                  X    t        j                  t              } | j                  d       y Nr!   r   r   r   r  rP   s    r   r   zBTestExtend.test_list_extend_typing_error_non_iterable.<locals>.foo      ##E*AHHQKr   z extend argument must be iterabler   rV   s      r   *test_list_extend_typing_error_non_iterablez5TestExtend.test_list_extend_typing_error_non_iterable  sb    !		 
	 {+vE ,.  !	
 ,+r  N)r3   r4   r5   r6   r  r  r7   r   r   r  r    s    	*
r   r  c                   4    e Zd ZdZd Zd Zd Zd Zd Zd Z	y)	
TestInsertzTest list insert. c                 Z    t         d        }dD ]  }| j                   ||      d        y )Nc                 x    t        j                  t              }|j                  | d       t	        |      |d   fS Nr!   r   )r   r   r   insertr   r   s     r   r   z.TestInsert.test_list_insert_empty.<locals>.foo  s1    ##E*AHHQNq61Q4<r   )r   r   rO   r   r!   rd   ri   )r!   r!   r$   r&   s      r   test_list_insert_emptyz!TestInsert.test_list_insert_empty  s4    		  
	 
 +ASVV, +r   c                     t         d        }dD ]  }| j                   ||      d        dD ]  }| j                   ||      d        y )Nc                     t        j                  t              }|j                  d       |j	                  | d       t        |      |d   |d   fS r  )r   r   r   r   r  r   r   s     r   r   z2TestInsert.test_list_insert_singleton.<locals>.foo  sC    ##E*AHHQKHHQNq61Q41%%r   )r   rC  r   rO   r   )r"   r!   r   )r!   r"   r1   r^   )r"   r   r!   r$   r&   s      r   test_list_insert_singletonz%TestInsert.test_list_insert_singleton  sT    		& 
	& &ASVY/ & ASVY/ r   c                 Z    t         d        }dD ]  }| j                   ||      d        y )Nc                     t        j                  t              }t        d      D ]  }|j	                  d        |j                  | d       t        |      ||    fS Nr^   r   r!   r   r   r   r   r   r  r   r   s      r   r   z1TestInsert.test_list_insert_multiple.<locals>.foo  J    ##E*A2Y HHQNq61Q4<r   )r   rd   ri   r   r!   r$   r&   s      r   test_list_insert_multiplez$TestInsert.test_list_insert_multiple  s4    		  
	  ASVW- r   c                 Z    t         d        }dD ]  }| j                   ||      d        y )Nc                     t        j                  t              }t        d      D ]  }|j	                  d        |j                  | d       t        |      |d   fS r  r  r   s      r   r   z8TestInsert.test_list_insert_multiple_before.<locals>.foo  r  r   )ir   r   r   r  r$   r&   s      r    test_list_insert_multiple_beforez+TestInsert.test_list_insert_multiple_before  s4    		  
	  $ASVW- $r   c                 Z    t         d        }dD ]  }| j                   ||      d        y )Nc                     t        j                  t              }t        d      D ]  }|j	                  d        |j                  | d       t        |      |d   fS r  r  r   s      r   r   z7TestInsert.test_list_insert_multiple_after.<locals>.foo	  sJ    ##E*A2Y HHQNq61R5= r   r?  r  r$   r&   s      r   test_list_insert_multiple_afterz*TestInsert.test_list_insert_multiple_after  s4    		! 
	! ASVW- r   c                     | j                          t        d        }| j                  t              5 } |        d d d        | j	                  dt        j                               y # 1 sw Y   /xY w)Nc                  Z    t        j                  t              } | j                  dd       y )Nar   )r   r   r   r  rP   s    r   r   z5TestInsert.test_list_insert_typing_error.<locals>.foo  s     ##E*AHHS!r   z$list insert indices must be integersr   rV   s      r   test_list_insert_typing_errorz(TestInsert.test_list_insert_typing_error  sb    !		 
	 {+vE ,2  !	
 ,+r  N)
r3   r4   r5   r6   r  r  r  r  r  r  r7   r   r   r  r    s#    -0 
.
.
.
r   r  c                   .    e Zd ZdZd Zd Zd Zd Zd Zy)
TestRemovezTest list remove. c                     | j                          t        d        }| j                  t              5   |        d d d        y # 1 sw Y   y xY w)Nc                  X    t        j                  t              } | j                  d       y rw   )r   r   r   removerP   s    r   r   z.TestRemove.test_list_remove_empty.<locals>.foo*  r  r   r   r   rQ   r  rz   s     r   test_list_remove_emptyz!TestRemove.test_list_remove_empty'  sA    !		 
	 z*E +**   AAc                 J    t         d        }| j                   |       d       y )Nc                      t        j                  t              } | j                  d       | j	                  d       t        |       S rw   )r   r   r   r   r  r   rP   s    r   r   z2TestRemove.test_list_remove_singleton.<locals>.foo3  s1    ##E*AHHQKHHQKq6Mr   r   r$   rz   s     r   test_list_remove_singletonz%TestRemove.test_list_remove_singleton2  r   r   c                     | j                          t        d        }| j                  t              5   |        d d d        y # 1 sw Y   y xY w)Nc                  z    t        j                  t              } | j                  d       | j	                  d       y r  )r   r   r   r   r  rP   s    r   r   z>TestRemove.test_list_remove_singleton_value_error.<locals>.foo?  s(    ##E*AHHQKHHQKr   r  rz   s     r   &test_list_remove_singleton_value_errorz1TestRemove.test_list_remove_singleton_value_error<  sA    !		 
	
 z*E +**r  c                 J    t         d        }| j                   |       d       y )Nc                      t        j                  t              } t        dd      D ]  }| j	                  |        | j                  d       | j                  d       t        |       S )Nr^   r_   r   r   )r   r   r   r   r   r  r   r
  s     r   r   z1TestRemove.test_list_remove_multiple.<locals>.fooI  sL    ##E*A2r] #HHRLHHRLq6Mr   rh   r$   rz   s     r   test_list_remove_multiplez$TestRemove.test_list_remove_multipleH  s(    		 
	 	"r   c                     | j                          t        d        }| j                  t              5   |        d d d        y # 1 sw Y   y xY w)Nc                      t        j                  t              } t        dd      D ]  }| j	                  |        | j                  d       y Nr^   r_      )r   r   r   r   r   r  r
  s     r   r   z=TestRemove.test_list_remove_multiple_value_error.<locals>.fooW  s8    ##E*A2r] #HHRLr   r  rz   s     r   %test_list_remove_multiple_value_errorz0TestRemove.test_list_remove_multiple_value_errorT  sA    !		 
	 z*E +**r  N)	r3   r4   r5   r6   r  r  r  r  r  r7   r   r   r  r  $  s    	#

#r   r  c                   "    e Zd ZdZd Zd Zd Zy)	TestClearzTest list clear. c                 J    t         d        }| j                   |       d       y )Nc                  j    t        j                  t              } | j                          t	        |       S r   )r   r   r   clearr   rP   s    r   r   z,TestClear.test_list_clear_empty.<locals>.foof  s$    ##E*AGGIq6Mr   r   r$   rz   s     r   test_list_clear_emptyzTestClear.test_list_clear_emptye  r   r   c                 J    t         d        }| j                   |       d       y )Nc                      t        j                  t              } | j                  d       | j	                          t        |       S rw   )r   r   r   r   r  r   rP   s    r   r   z0TestClear.test_list_clear_singleton.<locals>.fooo  s/    ##E*AHHQKGGIq6Mr   r   r$   rz   s     r   test_list_clear_singletonz#TestClear.test_list_clear_singletonn  r   r   c                 J    t         d        }| j                   |       d       y )Nc                      t        j                  t              } t        d      D ]  }| j	                  d        | j                          t        |       S )Nr^   r   )r   r   r   r   r   r  r   r
  s     r   r   z/TestClear.test_list_clear_multiple.<locals>.fooy  s=    ##E*A2Y GGIq6Mr   r   r$   rz   s     r   test_list_clear_multiplez"TestClear.test_list_clear_multiplex  s(    		 
	 	"r   N)r3   r4   r5   r6   r  r  r  r7   r   r   r  r  b  s    ###r   r  c                   "    e Zd ZdZd Zd Zd Zy)TestReversezTest list reverse. c                 J    t         d        }| j                   |       d       y )Nc                  j    t        j                  t              } | j                          t	        |       S r   )r   r   r   reverser   rP   s    r   r   z0TestReverse.test_list_reverse_empty.<locals>.foo  s$    ##E*AIIKq6Mr   r   r$   rz   s     r   test_list_reverse_emptyz#TestReverse.test_list_reverse_empty  r   r   c                 J    t         d        }| j                   |       d       y )Nc                      t        j                  t              } | j                  d       | j	                          t        |       | d   fS rw   )r   r   r   r   r  r   rP   s    r   r   z4TestReverse.test_list_reverse_singleton.<locals>.foo  s8    ##E*AHHQKIIKq61Q4<r   )r!   r   r$   rz   s     r   test_list_reverse_singletonz'TestReverse.test_list_reverse_singleton  s(    		  
	  	'r   c                 J    t         d        }| j                   |       d       y )Nc                      t        j                  t              } t        dd      D ]  }| j	                  |        | j                          t        |       | d   | d   | d   fS Nr^   r   r   r!   r"   )r   r   r   r   r   r  r   r
  s     r   r   z3TestReverse.test_list_reverse_multiple.<locals>.foo  sU    ##E*A2r] #IIKq61Q41qt++r   )r1   r   r   r^   r$   rz   s     r   test_list_reverse_multiplez&TestReverse.test_list_reverse_multiple  s(    		, 
	, 	0r   N)r3   r4   r5   r6   r  r  r  r7   r   r   r  r    s    #(1r   r  c                   "    e Zd ZdZd Zd Zd Zy)TestCopyzTest list copy. c                 J    t         d        }| j                   |       d       y )Nc                      t        j                  t              } | j                         }t	        |       t	        |      fS r   )r   r   r   copyr   r   s     r   r   z*TestCopy.test_list_copy_empty.<locals>.foo  s/    ##E*AAq63q6>!r   r7  r$   rz   s     r   test_list_copy_emptyzTestCopy.test_list_copy_empty  s(    		" 
	"
 	'r   c                 J    t         d        }| j                   |       d       y )Nc                      t        j                  t              } | j                  d       | j	                         }t        |       t        |      | d   |d   fS rw   )r   r   r   r   r  r   r   s     r   r   z.TestCopy.test_list_copy_singleton.<locals>.foo  sG    ##E*AHHQKAq63q61Q41--r   )r!   r!   r   r   r$   rz   s     r   test_list_copy_singletonz!TestCopy.test_list_copy_singleton  s(    		. 
	. 	-r   c                 J    t         d        }| j                   |       d       y )Nc            	          t        j                  t              } t        dd      D ]  }| j	                  |        | j                         }t        |       t        |      | d   | d   | d   | d   | d   | d   fS r  )r   r   r   r   r   r  r   r   s      r   r   z-TestCopy.test_list_copy_multiple.<locals>.foo  so    ##E*A2r] #Aq63q61Q41qtQqT1Q41EEr   )r1   r1   r^   r   r   r^   r   r   r$   rz   s     r   test_list_copy_multiplez TestCopy.test_list_copy_multiple  s+    		F 
	F 	 >?r   N)r3   r4   r5   r6   r  r  r  r7   r   r   r  r    s    (.	@r   r  c                   H    e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zy)	TestIndexc                 J    t         d        }| j                   |       d       y )Nc                  x    t        j                  t              } | j                  d       | j	                  d      S r  r   r   r   r   indexrP   s    r   r   z+TestIndex.test_index_singleton.<locals>.foo  +    ##E*AHHQK771:r   r   r$   rz   s     r   test_index_singletonzTestIndex.test_index_singleton  s(    		 
	
 	"r   c                     t         d        }t        t        d      t        dd            D ]  \  }}| j                   ||      |        y )Nc                     t        j                  t              }t        dd      D ]  }|j	                  |        |j                  |       S r]   r   r   r   r   r   r  r   s      r   r   z*TestIndex.test_index_multiple.<locals>.foo  ;    ##E*A2r] #771:r   r^   r_   r!  )r'   r   r   vs       r   test_index_multiplezTestIndex.test_index_multiple  sI    		 
	 uRy%2,/CAaSVQ' 0r   c                 J    t         d        }| j                   |       d       y )Nc                      t        j                  t              } t        dd      D ]  }| j	                  d        | j                  d      S Nr^   r_   r!   r  )r   _s     r   r   z+TestIndex.test_index_duplicate.<locals>.foo  r  r   r   r$   rz   s     r   test_index_duplicatezTestIndex.test_index_duplicate  s(    		 
	 	"r   c                 l    t         d        }t        d      D ]  }| j                   ||      |        y )Nc                     t        j                  t              }t        dd      D ]  }|j	                  d        |j                  d|       S r	  r  )startr   r
  s      r   r   z6TestIndex.test_index_duplicate_with_start.<locals>.foo  s>    ##E*A2r] #771e$$r   r^   rJ   r&   s      r   test_index_duplicate_with_startz)TestIndex.test_index_duplicate_with_start  s8    		% 
	% rASVQ' r   c                     | j                          t        d        }| j                  t              5 } |        d d d        | j	                  dt        j                               y # 1 sw Y   /xY w)Nc                  x    t        j                  t              } | j                  d       | j	                  d      S r  r  rP   s    r   r   z7TestIndex.test_index_singleton_value_error.<locals>.foo  r  r   item not in listr  rV   s      r    test_index_singleton_value_errorz*TestIndex.test_index_singleton_value_error  sb    !		 
	
 z*fE +  !	
 +*r  c                     | j                          t        d        }| j                  t              5 } |        d d d        | j	                  dt        j                               y # 1 sw Y   /xY w)Nc                      t        j                  t              } t        dd      D ]  }| j	                  |        | j                  d      S r  r  r
  s     r   r   z6TestIndex.test_index_multiple_value_error.<locals>.foo  s;    ##E*A2r] #772;r   r  r  rV   s      r   test_index_multiple_value_errorz)TestIndex.test_index_multiple_value_error  sb    !		 
	 z*fE +  !	
 +*r  c                 <   | j                          t        d        }| j                   |d      d       t        dd      D ]M  }| j	                  t
              5 } ||       d d d        | j                  dt        j                               O y # 1 sw Y   1xY w)Nc                     t        j                  t              }t        dd      D ]  }|j	                  |        |j                  d|       S r]   r  )r  r   r   s      r   r   z<TestIndex.test_index_multiple_value_error_start.<locals>.foo  s>    ##E*A2r] #772u%%r   r   r!   r^   r  	r   r   r%   r   rQ   r  rS   rT   rU   r   s       r   %test_index_multiple_value_error_startz/TestIndex.test_index_multiple_value_error_start  s    !		& 
	& 	Q#qA"":.&A /MM"F$$% ..   	BB	c                 <   | j                          t        d        }| j                   |d      d       t        dd      D ]M  }| j	                  t
              5 } ||       d d d        | j                  dt        j                               O y # 1 sw Y   1xY w)Nc                     t        j                  t              }t        dd      D ]  }|j	                  |        |j                  dd|       S )Nr^   r_   r   r   r  )endr   r   s      r   r   z:TestIndex.test_index_multiple_value_error_end.<locals>.foo(  s@    ##E*A2r] #772q#&&r   r^   ri   r   r  r  r   s       r   #test_index_multiple_value_error_endz-TestIndex.test_index_multiple_value_error_end%  s    !		' 
	' 	R!$qA"":.&A /MM"F$$% ..r  c                     | j                          t        d        }| j                  t              5 } |        d d d        | j	                  dt        j                               y # 1 sw Y   /xY w)Nc                  |    t        j                  t              } | j                  d       | j	                  dd      S )Nr   r  )r  r  rP   s    r   r   z4TestIndex.test_index_typing_error_start.<locals>.foo;  s0    ##E*AHHQK771C7((r   z+start argument for index must be an integerr   rV   s      r   test_index_typing_error_startz'TestIndex.test_index_typing_error_start8  sb    !		) 
	)
 {+vE ,9  !	
 ,+r  c                     | j                          t        d        }| j                  t              5 } |        d d d        | j	                  dt        j                               y # 1 sw Y   /xY w)Nc                  |    t        j                  t              } | j                  d       | j	                  dd      S )Nr   r  )r  r  rP   s    r   r   z2TestIndex.test_index_typing_error_end.<locals>.fooK  s0    ##E*AHHQK771#7&&r   z)end argument for index must be an integerr   rV   s      r   test_index_typing_error_endz%TestIndex.test_index_typing_error_endH  sb    !		' 
	'
 {+vE ,7  !	
 ,+r  N)r3   r4   r5   r   r  r  r  r  r  r  r  r"  r%  r7   r   r   r  r    s4    #	(#	(
 
"&&
 
r   r  c                   4    e Zd ZdZd Zd Zd Zd Zd Zd Z	y)	TestEqualNotEqualzTest list equal and not equal. c                 J    t         d        }| j                   |       d       y )Nc                  z    t        j                  t              } t        j                  t              }| |k(  | |k7  fS r   r   r   os     r   r   z4TestEqualNotEqual.test_list_empty_equal.<locals>.foo]  s4    ##E*A##E*A616>!r   TFr$   rz   s     r   test_list_empty_equalz'TestEqualNotEqual.test_list_empty_equal\  s(    		" 
	"
 	.r   c                 J    t         d        }| j                   |       d       y )Nc                      t        j                  t              } | j                  d       t        j                  t              }|j                  d       | |k(  | |k7  fS rw   rx   r*  s     r   r   z8TestEqualNotEqual.test_list_singleton_equal.<locals>.foof  J    ##E*AHHQK##E*AHHQK616>!r   r,  r$   rz   s     r   test_list_singleton_equalz+TestEqualNotEqual.test_list_singleton_equale  (    		" 
	" 	.r   c                 J    t         d        }| j                   |       d       y )Nc                      t        j                  t              } | j                  d       t        j                  t              }|j                  d       | |k(  | |k7  fS r  rx   r*  s     r   r   z<TestEqualNotEqual.test_list_singleton_not_equal.<locals>.fooq  r0  r   FTr$   rz   s     r   test_list_singleton_not_equalz/TestEqualNotEqual.test_list_singleton_not_equalp  r2  r   c                 J    t         d        }| j                   |       d       y )Nc                      t        j                  t              } | j                  d       t        j                  t              }| |k(  | |k7  fS rw   rx   r*  s     r   r   z8TestEqualNotEqual.test_list_length_mismatch.<locals>.foo|  s?    ##E*AHHQK##E*A616>!r   r5  r$   rz   s     r   test_list_length_mismatchz+TestEqualNotEqual.test_list_length_mismatch{  s(    		" 
	" 	.r   c                 J    t         d        }| j                   |       d       y )Nc                      t        j                  t              } t        j                  t              }t        d      D ]$  }| j	                  |       |j	                  |       & | |k(  | |k7  fS r  r   r   r+  r   s      r   r   z7TestEqualNotEqual.test_list_multiple_equal.<locals>.foo  sZ    ##E*A##E*A2Y  616>!r   r,  r$   rz   s     r   test_list_multiple_equalz*TestEqualNotEqual.test_list_multiple_equal  s(    		" 
	" 	.r   c                 J    t         d        }| j                   |       d       y )Nc                      t        j                  t              } t        j                  t              }t        d      D ]$  }| j	                  |       |j	                  |       & d|d<   | |k(  | |k7  fS )Nr^   *   rO   r   r<  s      r   r   z;TestEqualNotEqual.test_list_multiple_not_equal.<locals>.foo  sc    ##E*A##E*A2Y  AbE616>!r   r5  r$   rz   s     r   test_list_multiple_not_equalz.TestEqualNotEqual.test_list_multiple_not_equal  s(    		" 
	" 	.r   N)
r3   r4   r5   r6   r-  r1  r6  r9  r=  rA  r7   r   r   r'  r'  Y  s#    )/	/	//
//r   r'  c                       e Zd ZdZd Zd Zy)TestIterzTest list iter. c                 b    t         d        }d}| j                   ||      t        |             y )Nc                 v    t        j                  t              }|j                  |        d}|D ]  }||z  }	 |S rw   r  )r   r   rr   s       r   r   z$TestIter.test_list_iter.<locals>.foo  s:    ##E*AHHUOAQ Hr   r!   r"   r1   rd   )r   r%   sumr'   r   r   s      r   test_list_iterzTestIter.test_list_iter  s7    		 
	 JJ	
r   c                    | j                          t        d        }| j                  t              5 } |        d d d        | j	                   dj
                  di t               t        j                               y # 1 sw Y   GxY w)Nc                      t        j                  t              } | j                  d       | D ]  }| j	                  |        y )NrG  )r   r   r   r  r   ra   s     r   r   z2TestIter.test_list_iter_self_mutation.<locals>.foo  s3    ##E*AHH\" r   z!list was mutated during iterationr7   )	r   r   rQ   rR   rS   formatlocalsrT   rU   rV   s      r   test_list_iter_self_mutationz%TestIter.test_list_iter_self_mutation  su    !		 
	 |,E -6/66BB  !	
 -,s   B  B	N)r3   r4   r5   r6   rJ  rO  r7   r   r   rC  rC    s    
$
r   rC  c                       e Zd ZdZd Zy)TestStringItemz%Test list can take strings as items. c                 d    t         d        } |       }| j                  g dt        |             y )Nc                      t        j                  t        j                        } | j	                  d       | j	                  d       | j	                  d       | j	                  d       | d   | d   | d   | d   fS )	Nr  bcdr   r!   r"   r1   )r   r   r   unicode_typer   rP   s    r   r   z,TestStringItem.test_string_item.<locals>.foo  sc    ##E$6$67AHHSMHHSMHHSMHHSMQ41qtQqT))r   )r  rT  rU  rV  )r   r%   r,   rI  s      r   test_string_itemzTestStringItem.test_string_item  s2    		* 
	* -tE{;r   N)r3   r4   r5   r6   rX  r7   r   r   rQ  rQ    s
    /<r   rQ  c                   F    e Zd Zed        Zd Zd Zd Zd Zd Z	d Z
d Zy	)
TestItemCastingc                 \    t        j                  |      }|j                   | d             y rw   )r   r   r   )fromtytotyr   s      r   r   zTestItemCasting.foo  s"    %	r   c                 0    t         j                  ||       y r   )rZ  r   )r'   r\  r]  s      r   
check_goodzTestItemCasting.check_good  s    FD)r   c                     | j                  t              5 }t        j                  ||       d d d        | j	                   dj
                  di t               t        j                               y # 1 sw Y   GxY w)Nz%cannot safely cast {fromty} to {toty}r7   )	rQ   r   rZ  r   rS   rM  rN  rT   rU   )r'   r\  r]  rW   s       r   	check_badzTestItemCasting.check_bad  s`    {+v- ,:3::FVXF  !	
 ,+s   A33A<c                 ,   | j                  t        j                  t        j                         | j                  t        j                  t        j                         | j                  t        j                  t        j
                         | j                  t        j                  t        j
                         | j                  t        j                  t        j                         | j                  t        j                  t        j                         y r   )
r_  r   r   float32float64
complex128int64ra  	complex64int8r'   s    r   test_cast_int_toz TestItemCasting.test_cast_int_to  s    U]]3U]]3U%5%56U%5%56u{{EOO4

EOO4r   c                    | j                  t        j                  t        j                         | j                  t        j                  t        j                         | j                  t        j                  t        j
                         y r   )r_  r   rc  rd  rg  re  ri  s    r   test_cast_float_toz"TestItemCasting.test_cast_float_to  sF    u}}5u7u'7'78r   c                    | j                  t        j                  t        j                         | j                  t        j                  t        j                         | j                  t        j                  t        j
                         y r   )r_  r   booleanr   rd  re  ri  s    r   test_cast_bool_toz!TestItemCasting.test_cast_bool_to  sF    u{{3u}}5u'7'78r   c                     t         d        }| j                  t              5 } |        d d d        | j                  dt	        j
                               y # 1 sw Y   /xY w)Nc                  X    t        j                  t              } | j                  d       y )Nr   rx   rP   s    r   r   z7TestItemCasting.test_cast_fail_unicode_int.<locals>.foo  s    ##E*AHHUOr   z(cannot safely cast unicode_type to int32r   rQ   r   rS   rT   rU   rV   s      r   test_cast_fail_unicode_intz*TestItemCasting.test_cast_fail_unicode_int  sV    		 
	 {+vE ,6  !	
 ,+   AA!c                     t         d        }| j                  t              5 } |        d d d        | j                  dt	        j
                               y # 1 sw Y   /xY w)Nc                  ~    t        j                  t        j                        } | j	                  t        d             y rw   )r   r   r   rW  r   r   rP   s    r   r   z7TestItemCasting.test_cast_fail_int_unicode.<locals>.foo  s(    ##E$6$67AHHU1Xr   z!Cannot cast int32 to unicode_typerr  rV   s      r   test_cast_fail_int_unicodez*TestItemCasting.test_cast_fail_int_unicode	  sV    		 
	 {+vE ,/  !	
 ,+rt  N)r3   r4   r5   r   r   r_  ra  rj  rl  ro  rs  rw  r7   r   r   rZ  rZ    s7    	 
*
59
9


r   rZ  c                  l    t        j                  t              } | j                  t        d             | S r  rx   rP   s    r   make_test_listry    s'    E"AHHU1XHr   c                   0    e Zd Zd Zd Zd Zd Zd Zd Zy)TestImmutablec                 H    t         d        }| j                   |              y )Nc                  6    t               } | j                         S r   )ry  _is_mutablerP   s    r   r   z,TestImmutable.test_is_immutable.<locals>.foo"  s     A==?"r   ry  rz   s     r   test_is_immutablezTestImmutable.test_is_immutable!  s$    		# 
	# 	r   c                 H    t         d        }| j                   |              y )Nc                  V    t               } | j                          | j                         S r   ry  _make_immutabler~  rP   s    r   r   z;TestImmutable.test_make_immutable_is_immutable.<locals>.foo)  s"     A==?"r   r  rz   s     r    test_make_immutable_is_immutablez.TestImmutable.test_make_immutable_is_immutable(  s&    		# 
	# 	r   c                 v    t         d        } |       \  }}| j                  |d       | j                  |       y )Nc                  l    t               } | j                          t        |       | j                         fS r   )ry  r  r   r~  rP   s    r   r   zATestImmutable.test_length_still_works_when_immutable.<locals>.foo1  s+     Aq6!--/))r   r!   r   r%   r  )r'   r   r   mutables       r   &test_length_still_works_when_immutablez4TestImmutable.test_length_still_works_when_immutable0  s?    		* 
	* %#!r   c                 v    t         d        } |       \  }}| j                  |d       | j                  |       y )Nc                  `    t               } | j                          | d   | j                         fS rw   r  rP   s    r   r   zBTestImmutable.test_getitem_still_works_when_immutable.<locals>.foo;  s+     AQ4((r   r!   r  )r'   r   	test_itemr  s       r   'test_getitem_still_works_when_immutablez5TestImmutable.test_getitem_still_works_when_immutable:  s@    		) 
	) !U	7A&!r   c                     | j                          t        d        }| j                  t              5 } |        d d d        | j	                  dt        j                               y # 1 sw Y   /xY w)Nc                  l    t               } | j                          | j                  t        d             y r  )ry  r  r   r   rP   s    r   r   z,TestImmutable.test_append_fails.<locals>.fooG  s&     AHHU1Xr   list is immutabler  rV   s      r   test_append_failszTestImmutable.test_append_failsD  sb    !		 
	 z*fE +  !	
 +*r  c                     | j                          d }dD ]T  } ||      }| j                  t              5 } |        ddd       | j                  dt	        j
                               V y# 1 sw Y   1xY w)z@ Test that any attempt to mutate an immutable typed list fails. c                 j    i }t        t        dj                  |             |       t        |d         S )NaJ  
                from numba.typed import listobject
                from numba import int32
                def bar():
                    lst = listobject.new_list(int32)
                    lst.append(int32(1))
                    lst._make_immutable()
                    zero = int32(0)
                    {}
                bar)execr   rM  r   )linecontexts     r   generate_functionz<TestImmutable.test_mutation_fails.<locals>.generate_functionW  s<    G 	 F4L	" $+	, ''r   )	zlst.append(zero)zlst[0] = zeroz	lst.pop()z
del lst[0]zlst.extend((zero,))zlst.insert(0, zero)zlst.clear()zlst.reverse()z
lst.sort()Nr  )r   rQ   r  rS   rT   rU   )r'   r  r  r   rW   s        r   test_mutation_failsz!TestImmutable.test_mutation_failsS  sk    !	(	D $D)C"":.& /MM#F$$%	 /.s   A..A7	N)	r3   r4   r5   r  r  r  r  r  r  r7   r   r   r{  r{    s      ""
!r   r{  N),r6   textwrapr   numbar   r   numba.extendingr   
numba.corer   numba.core.errorsr   numba.tests.supportr	   r
   r   r   numba.typedr   r   r   r9   r?   rZ   rt   r   r  r2  rY  r}  r  r  r  r  r  r  r  r  r'  rC  rQ  rZ  ry  r{  r7   r   r   <module>r     s      ,  )1 1 (/_h /:, ,
_h 
@- -:y,/8 y,xp
 p
fu-/8 u-pOox OdnOX nb"%?H "%J %  %F
( 
<N
( N
b;( ;|# #B1/8 1B@ @DP
 P
fC/ C/L$
 $
N<_h <">
h >
B  UOX Ur   