o
    h                     @   s   d dl Z d dlZd dlZd dlmZ d dlmZ d dlm	Z	m
Z
 d dlZd dlmZmZ d dlmZ dd Zejdg d	d
d Zdd ZejjepNe dddd Zdd Zejdejdd Zdd Zdd ZdS )    N)using_pyarrow_string_dtype)PYPY)is_dtype_equalis_object_dtype)IndexSeriesc                  C   s`   t jjj} | dsJ t jjj} | dsJ tjj} | ds#J tjj} | ds.J d S )Nz4
DataFrame.notnull is an alias for DataFrame.notna.
z2
DataFrame.isnull is an alias for DataFrame.isna.
z.
Series.notnull is an alias for Series.notna.
z,
Series.isnull is an alias for Series.isna.
)pd	DataFramenotnull__doc__
startswithisnullr   )doc r   o/var/www/html/construction_image-detection-poc/venv/lib/python3.10/site-packages/pandas/tests/base/test_misc.pytest_isnull_notnull_docstrings   s   

r   zop_name, op))add+)sub-)mul*)mod%)powz**)truediv/)floordivz//c                 C   sb   | }|j  }d}d|||g}|t||jv sJ d|||g}|t|d| jv s/J d S )Nother r)__name__lowerjoingetattrr   )frame_or_seriesop_nameopklassoperand1operand2expected_strr   r   r   test_binary_ops_docstring$   s   
r,   c                 C   s   | }dD ]}t ||d d usJ qdD ]	}t||rJ qd}tjt|d |  W d    n1 s5w   Y  |jdksAJ |jt|ksJJ t	dg dksUJ t
dg dks`J d S )N)shapedtypeTnbytes)stridesitemsizebasedataz6can only convert an array of size 1 to a Python scalarmatch   )r$   hasattrpytestraises
ValueErroritemndimsizelenr   r   )index_or_series_objobjpmsgr   r   r   test_ndarray_compat_properties?   s   
rD   z=not relevant for PyPy doesn't work properly for arrow stringsreasonc           
      C   s  | }t |trd}|jj  nd}|j  | }|jdd}t|p+|o+t|j}t |jtj	p<|o<t |jjtj	}t
|dpJ|oJt
|jjd}t|dkrbd}||  kr^|ksaJ  J n|sh|sh|ro||ksnJ n||ksuJ |t| }	t|	dk sJ d S )NTF)deepzstring[python]r   d   )
isinstancer   index_engineclear_mappingmemory_usager   r.   r   CategoricalDtyper   r?   sys	getsizeofabs)
index_or_series_memory_objrA   is_serresres_deep	is_objectis_categoricalis_object_stringexpecteddiffr   r   r   test_memory_usageU   s.   


r[   c                 C   s:   | }|j dd}|j dd}|j  }||| ksJ d S )NTrJ   F)rM   rJ   )series_with_simple_indexseriestotal_usagenon_index_usageindex_usager   r   r   #test_memory_usage_components_series}   s
   
rb   r.   c                 C   sX   t td| dd tdD dd}|jdd}|jdd}|j }||| ks*J d S )	N   c                 S   s   g | ]}d | qS )zi-r   ).0ir   r   r   
<listcomp>   s    z>test_memory_usage_components_narrow_series.<locals>.<listcomp>a)r.   rJ   nameTr\   F)r   rangerM   rJ   )r.   r^   r_   r`   ra   r   r   r   *test_memory_usage_components_narrow_series   s
   "
rj   c                 C   s   |}t |tjr| tjjdd n|jjdkr*t |t	r*tjjdd}| | t
|dd}t||}d|  krCt|ksFJ  J tj||tt|d}d|  kr_t|ksbJ  J d S )Nz7np.searchsorted doesn't work on pd.MultiIndex: GH 14833rE   cz"complex objects are not comparabler   )default)sorter)rI   r   
MultiIndexapplymarkerr9   markxfailr.   kindr   maxnpsearchsortedr?   ri   )requestr@   rA   rp   max_objrJ   r   r   r   test_searchsorted   s   
 $rx   c                 C   s(  | }t |dkrtd t|}|d |jd ksJ |d |jd ks'J |d |jd ks2J t |}|d ||d  ksBJ d| d| }t|jdsVt|jd	rXd
}tjt|d ||  W d    n1 snw   Y  d}tjt|d |j|  W d    d S 1 sw   Y  d S )Nr   z%Test doesn't make sense on empty datarc   r7   zindex z' is out of bounds for axis 0 with size zstring[pyarrow]zstring[pyarrow_numpy]zindex out of boundsr5   z*single positional indexer is out-of-bounds)	r?   r9   skipr   ilocr   r.   r:   
IndexError)
index_flatrJ   r^   r>   rC   r   r   r   test_access_by_position   s*   

"r~   )rO   numpyrt   r9   pandas._configr   pandas.compatr   pandas.core.dtypes.commonr   r   pandasr   r   r   pandas._testing_testingtmr   rp   parametrizer,   rD   skipifr[   rb   NARROW_NP_DTYPESrj   rx   r~   r   r   r   r   <module>   s4    

$
