o
    Û­jQ  ã                   @   sJ   d dl Zd dlZd dlmZmZ d dlmZ d dl	m
Z
 G dd„ dƒZdS )é    N)ÚIndexÚ
date_range©Úcartesian_productc                   @   sª   e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zej 	d	g g gd
dgg gg g d¢gg¡dd„ ƒZ
dd„ Zej 	dddgddgdgdgddgddgdgdgg¡dd„ ƒZdd„ ZdS )ÚTestCartesianProductc                 C   sZ   t dƒddg}}t||gƒ\}}t g d¢¡}t g d¢¡}t ||¡ t ||¡ d S )NÚABCé   é   )ÚAr
   ÚBr   ÚCr   )r   r	   r   r	   r   r	   )Úlistr   ÚnpÚarrayÚtmÚassert_numpy_array_equal)ÚselfÚxÚyÚresult1Úresult2Ú	expected1Ú	expected2© r   ú[/var/www/html/CropPilot/venv/lib/python3.10/site-packages/pandas/tests/reshape/test_util.pyÚtest_simple   s   z TestCartesianProduct.test_simplec                 C   sf   t ddd�}dd„ t||gƒD ƒ\}}tg d¢tjd�}tg d¢tjd�}t ||¡ t ||¡ d S )	Nú
2000-01-01é   )Úperiodsc                 s   s   � | ]}t |ƒjV  qd S ©N)r   Úday)Ú.0r   r   r   r   Ú	<genexpr>   s   € z:TestCartesianProduct.test_datetimeindex.<locals>.<genexpr>)r   r   r   r   ©Údtype)r   r   r   r   )r   r   r   r   Úint32r   Úassert_index_equal)r   r   r   r   r   r   r   r   r   Útest_datetimeindex   s   z'TestCartesianProduct.test_datetimeindexc                 C   sF   t dddd�}t ddg¡}t||gƒ\}}| d¡}t ||¡ d S )Nr   r   ú
US/Pacific©r   Útzé   é   )r   r   r   r   Úrepeatr   r&   ©r   r   r   r   r   Úexpectedr   r   r   Útest_tzaware_retained   s
   
z*TestCartesianProduct.test_tzaware_retainedc                 C   sL   t dddd� d¡}t ddg¡}t||gƒ\}}| d¡}t ||¡ d S )Nr   r   r(   r)   Úcategoryr+   r,   )r   Úastyper   r   r   r-   r   r&   r.   r   r   r   Ú!test_tzaware_retained_categorical'   s
   
z6TestCartesianProduct.test_tzaware_retained_categoricalzx, yr   r   )ÚaÚbÚcc                 C   sX   t jg t  |¡jd�}t jg t  |¡jd�}t||gƒ\}}t ||¡ t ||¡ d S )Nr#   )r   r   Úasarrayr$   r   r   r   )r   r   r   r   r   r   r   r   r   r   Ú
test_empty/   s
   zTestCartesianProduct.test_emptyc                 C   s   t g ƒ}g }||ksJ ‚d S r   r   )r   Úresultr/   r   r   r   Útest_empty_input8   s   z%TestCartesianProduct.test_empty_inputÚXr   r4   r5   c                 C   sB   d}t jt|d�� t|d� W d   ƒ d S 1 sw   Y  d S )Nz'Input must be a list-like of list-likes©Úmatch©r;   )ÚpytestÚraisesÚ	TypeErrorr   )r   r;   Úmsgr   r   r   Útest_invalid_input>   s   "ÿz'TestCartesianProduct.test_invalid_inputc                 C   sf   d}t jt|d��  dd„ tdƒD ƒtjdtjd�g }t|d� W d   ƒ d S 1 s,w   Y  d S )	Nz+Product space too large to allocate arrays!r<   c                 S   s   g | ]}t jd dt jd�‘qS )r   r	   r#   )r   ÚarangeÚint16)r!   Úir   r   r   Ú
<listcomp>L   s    zBTestCartesianProduct.test_exceed_product_space.<locals>.<listcomp>é   i;  r#   r>   )r?   r@   Ú
ValueErrorÚranger   rD   rE   r   )r   rB   Údimsr   r   r   Útest_exceed_product_spaceG   s   ÿ"üz.TestCartesianProduct.test_exceed_product_spaceN)Ú__name__Ú
__module__Ú__qualname__r   r'   r0   r3   r?   ÚmarkÚparametrizer8   r:   rC   rL   r   r   r   r   r      s    
&
,ÿ
r   )Únumpyr   r?   Úpandasr   r   Úpandas._testingÚ_testingr   Úpandas.core.reshape.utilr   r   r   r   r   r   Ú<module>   s    