o
    da                     @   s  d dl Zd dlZd dlm  mZ d dlZd dlm	Z	 d dl
mZ d dlmZ ejdd Zejjejdd Zejejdejejgejd	d geg d
fdgeg d
fdgeg d
fd dgeg d
g dgjfd dgeg d
g dgjfg deg d
g dg dgjfddgeg d
g dgjfddgeg d
g dgjfddgeg d
g dgjfg	dd ZdS )    N)	DataFrame)	get_arrayc                 C   s  t g dg dd}g d|d< |d d  }tdd |jjD s$J |  |jjd j s3J tt	|d	t	|d	sAJ |jjd
 j rLJ |jjd j rWJ |jjd
 j sbJ |jjd j rmJ | rd|j
d< |jjd
 j rJ |jd dksJ d S d S )N         皙?g?g333333?ab         cc                 s   s    | ]}|j  V  qd S )N)refshas_reference).0Zblk r   Y/app/.heroku/python/lib/python3.10/site-packages/pandas/tests/copy_view/test_internals.py	<genexpr>   s    z#test_consolidate.<locals>.<genexpr>r   r   r   r   g        )r   r   )r   r   r	   )r   all_mgrblocksZ_consolidate_inplacer   r   npshares_memoryr   ilocloc)using_copy_on_writedfsubsetr   r   r   test_consolidate   s"   
r"   c                  C   s   t ddp tg dg dd} | d d  }d|jd< | jd dks&J dt jj_tg dg dd} | d d  }d|jd< | jd d	ksJJ dt jj_tg dg dd} | d d  }d|jd< | jd dksnJ W d    d S 1 syw   Y  d S )
Nzmode.copy_on_writeFr   r   r
   r   )r   r   Tr   )pdZoption_contextr   r   optionsmodeZcopy_on_write)r    r!   r   r   r   test_switch_options0   s    




"r&   dtypez	locs, arr)r   r   )ir   )r   r   r   r   c           	      C   s   t g dg dg dg dg dg dd}||}| }|jd d}|jj||d	d
 t|| | rUt|jD ]\}}||vrRt	
t||t||sRJ q<d S |jD ]}t	
t||t||rhJ qXd S )Nr   r   )      	   )
         )         )r   r   r   )r   r   r   def)deepT)Zinplace)r   Zastypecopyr   ZisettmZassert_frame_equal	enumeratecolumnsr   r   r   )	r   ZlocsZarrr'   r    Zdf_origZdf2icolr   r   r   test_iset_splits_blocks_inplaceN   s.   


r@   )numpyr   ZpytestZpandas.util._test_decoratorsutilZ_test_decoratorstdZpandasr#   r   Zpandas._testingZ_testingr;   Zpandas.tests.copy_view.utilr   Zskip_array_manager_invalid_testr"   markZ
single_cpur&   ZparametrizeZintpZint8arrayTr@   r   r   r   r   <module>   s8    
#$