
    Owg                     X    d dl Zd dlmZmZ d dlmZ d dlm	Z	 d Z
d Zd Zd Zd Zd	 Zy)
    N)	DataFrameoption_context)	get_arrayc                 6   t        dg di      }|j                         }t        |d      }|d d  }|r1t        j                         5  |j                  dd       d d d        n|j                  dd       | rst        j                  t        |d      |      rJ |j                  j                  d      sJ |j                  j                  d      sJ t        j                  ||       y t        j                  t        |d      |      sJ y # 1 sw Y   xY wNag      ?      r
   Tlowerinplacer   )r   copyr   tmassert_cow_warningclipnpshares_memory_mgr_has_no_referenceassert_frame_equal)using_copy_on_writewarn_copy_on_writedfdf_copyarr_aviews         W/var/www/horilla/myenv/lib/python3.12/site-packages/pandas/tests/copy_view/test_clip.pytest_clip_inplace_referencer      s    	C%	&BggiGb#Ea5D""$ 	+GG!TG*	+ 	+ 	a&##Ib#$6>>>ww((+++yy**1---
gt,	"c 2E:::	+ 	+s   DDc                 t   t        dg di      }|j                         }t        |d      }|d d  }|j                  dd       t	        j
                  t        |d      |      sJ | rQ|j                  j                  d      rJ |j                  j                  d      rJ t        j                  ||       y y )Nr   r	   r   Tr   )
r   r   r   r   r   r   r   r   r   r   )r   r   r   r   r   s        r   !test_clip_inplace_reference_no_opr!      s    	C%	&BggiGb#Ea5DGG!TG"Ib#.66677,,Q///99..q111
gt,     c                     t        dg di      }t        |d      }|j                  dd       t        j                  t        |d      |      sJ | r|j
                  j                  d      sJ y y r   )r   r   r   r   r   r   r   )r   r   r   s      r   test_clip_inplacer$   .   sj    	C%	&Bb#EGG!TG"Ib#.666ww((+++ r"   c                 (   t        dg di      }|j                         }|j                  d      }t        j                  t        |d      t        |d            rJ | r|j                  j                  d      sJ t        j                  ||       y )Nr   r	   r
   r   r   )
r   r   r   r   r   r   r   r   r   r   )r   r   df_origdf2s       r   	test_clipr)   9   s{    	C%	&BggiG
'''
C	#s 3Yr35GHHHww((+++'2&r"   c                 6   t        dg di      }|j                  d      }| rJ|j                  j                  d      rJ t	        j
                  t        |d      t        |d            sJ y t	        j
                  t        |d      t        |d            rJ y )Nr   r	   r   r&   )r   r   r   r   r   r   r   )r   r   r(   s      r   test_clip_no_opr+   E   s    	C%	&B
'''
C77,,Q///	#s 3Yr35GHHH##Ic3$72s9KLLLLr"   c                    t        g ddd      }|j                         }| rt        j                         5  |d   j	                  ddd       d d d        t        j
                  ||       t        j                         5  |dg   j	                  ddd       d d d        t        j
                  ||       y t        j                  t        d	      5  |d   j	                  ddd       d d d        t        j                  d       5  t        d
d       5  |dg   j	                  ddd       d d d        d d d        t        j                  d       5  t        d
d       5  ||d   dkD     j	                  ddd       d d d        d d d        y # 1 sw Y   CxY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   PxY w# 1 sw Y   y xY w)N)      r
   r-   )r   br   r
   T)r   zinplace method)matchzmode.chained_assignment)	r   r   r   raises_chained_assignment_errorr   r   assert_produces_warningFutureWarningr   )r   r   r'   s      r   test_clip_chained_inplacer4   P   s   	+	,BggiG//1 	-sGLLAtL,	-
b'*//1 	/uINN1aN.	/
b'*''=MN 	-sGLLAtL,	- ''- 	3 94@ 3C5	q!T23	3 ''- 	9 94@ 92c7Q;$$Q4$89	9 	9	- 	-	/ 	/	- 	-3 3	3 	3
9 9	9 	9sk   FFF*	GF6/GG!G?GFF'*F36F?	;GGG	GG#)numpyr   pandasr   r   pandas._testing_testingr   pandas.tests.copy_view.utilr   r   r!   r$   r)   r+   r4    r"   r   <module>r;      s4      1;(-,	'M9r"   