
    .i*                     T    d Z ddlZddlZddlmZmZmZmZm	Z	 ddl
mZ  G d d      Zy)z
test_insert is specifically for the DataFrame.insert method; not to be
confused with tests with "insert" in their names that are really testing
__setitem__.
    N)	DataFrameIndex
MultiIndexNaT	Timestampc                   6    e Zd Zd Zd Zd Zd Zd Zd Zd Z	y)	TestDataFrameInsertc                    t        t        j                  j                  d      j	                  d      t        j
                  d      g d      }|j                  dd|d          t        j                  |j                  t        g d	             t        j                  |d   |d   d
       |j                  dd|d          t        j                  |j                  t        g d             t        j                  |d   |d   d
       t        j                  t        d      5  |j                  dd|d          d d d        d}t        j                  t        |      5  |j                  dd|d          d d d        d|j                  _        |j                  dd|d          |j                  j                   dk(  sJ y # 1 sw Y   xY w# 1 sw Y   XxY w)N   )      r   )cba)indexcolumnsr   foor   )r   r   r   r   F)check_namesbarr   )r   r   r   r   r   zalready existsmatch   r   zcannot insert c, already exists	some_namebaz)r   nprandomdefault_rngstandard_normalarangeinserttmassert_index_equalr   r   assert_series_equalassert_almost_equalpytestraises
ValueErrornameselfdfmsgs      e/var/www/app/trading-bot/venv/lib/python3.12/site-packages/pandas/tests/frame/indexing/test_insert.pytest_insertzTestDataFrameInsert.test_insert   sv   II!!!$44V<))A,#
 			!UBsG$
bjj%0F*GH
r#w5	uE
		!UBsG$
bjj%0M*NO
r#w5	uE]]:-=> 	'IIabg&	' 0]]:S1 	'IIabg&	' &


		!UBsG$zz+---	' 	'	' 	's   )G%GGGc                    t        dddgi      }|j                  i       }|j                  ddddg       |j                  i       }t        ddgddggddg      }t        j                  ||       |j                  dd	d
dg       |j                  i       }t        g dg dgg d      }t        j                  ||       y )Nr   皙?皙@r   r   r   r   r   r   ?ffffff@)r3   r   r0   )r4   r   r1   )r   r   r   )r   renamer    r!   assert_frame_equal)r*   r+   resultexpecteds       r-   test_insert_column_bug_4032z/TestDataFrameInsert.test_insert_column_bug_40320   s    c3Z()YYrY"
		!S1a&!2&q#hC1C:F
fh/
		!S3*%2&m];_U
fh/    c                     t               }|j                  ddg dd       |j                  ddg dd       |j                  ddg dd       t        g dg d	g d
gg d      }t        j                  ||       y )Nr   A)ghiT)allow_duplicates)def)r   r   r   )r   rA   r=   )r   rB   r>   )r   rC   r?   )r<   r<   r<   r2   )r   r    r!   r6   )r*   r+   exps      r-   test_insert_with_columns_dupsz1TestDataFrameInsert.test_insert_with_columns_dupsA   sm    [
		!S/D	A
		!S/D	A
		!S/D	Ao?
 	b#&r:   c                    t        t        j                  j                  d      j	                  ddd      d      }t        j                  d       5  t        j                  g d      |d	<   d d d        y # 1 sw Y   y xY w)
Nr   r   d   )r   rG   )sizeInt64)dtype)r   r   r   r   )r   r   r   r   integersr!   assert_produces_warningarrayr*   r+   s     r-   test_insert_EA_no_warningz-TestDataFrameInsert.test_insert_EA_no_warningL   sk     II!!!$--a8-DG
 ''- 	*hhy)BsG	* 	* 	*s   A66A?c                     t        ddgddgd      }d}t        j                  t        |      5  |j	                  dd|       d d d        y # 1 sw Y   y xY w)	Nr   r   r      )col1col2zJExpected a one-dimensional object, got a DataFrame with 2 columns instead.r   newcol)r   r%   r&   r'   r    r)   s      r-   test_insert_framez%TestDataFrameInsert.test_insert_frameU   sY    AA78 Y 	 ]]:S1 	'IIa2&	' 	' 	's   AAc                     t        dddgi      }|j                  t        j                  d      dd       t	        j
                  |t        ddgddgd             y )Nr   r   r   r   r   )r   r   )r   r    r   int64r!   r6   rN   s     r-   test_insert_int64_locz)TestDataFrameInsert.test_insert_int64_loc_   sN    aV}%
		"((1+sA&
b)1a&1v,F"GHr:   c           	      Z   t        dt        d      fdgi      }|j                  dddg       t        ddggt        j                  dt        d      fdt
        fg            }t        j                  ||       |d= t        dt        d      fdgi      }t        j                  ||       y )Nr<   z
2024-01-01r   r   Br2   )r   r   r    r   from_tuplesr   r!   r6   )r*   r+   r8   s      r-   +test_insert_delete_mixed_multiindex_columnsz?TestDataFrameInsert.test_insert_delete_mixed_multiindex_columnse   s     i56<=
		!S1#VH**y./#s<
 	b(+ sGsIl$;<qcBC
b(+r:   N)
__name__
__module____qualname__r.   r9   rE   rO   rU   rX   r\    r:   r-   r	   r	      s&    .60"	'*'I,r:   r	   )__doc__numpyr   r%   pandasr   r   r   r   r   pandas._testing_testingr!   r	   r`   r:   r-   <module>rf      s-       c, c,r:   