a
    é´«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/laksyashrimp/venv/lib/python3.9/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>   ó    z:TestCartesianProduct.test_datetimeindex.<locals>.<genexpr>)r   r   r   r   ©Údtype)r   r   r   r   )r   r   r   r   Z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   Z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   Z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   r3   r4   c                 C   s@   d}t jt|d�� t|d� W d   ƒ n1 s20    Y  d S )Nz'Input must be a list-like of list-likes©Úmatch©r9   )ÚpytestÚraisesÚ	TypeErrorr   )r   r9   Úmsgr   r   r   Útest_invalid_input>   s    z'TestCartesianProduct.test_invalid_inputc                 C   sd   d}t jt|d��> dd„ tdƒD ƒtjdtjd�g }t|d� W d   ƒ n1 sV0    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   r#   zBTestCartesianProduct.test_exceed_product_space.<locals>.<listcomp>é   i;  r$   r<   )r=   r>   Ú
ValueErrorÚranger   rB   rC   r   )r   r@   Údimsr   r   r   Útest_exceed_product_spaceG   s    ÿz.TestCartesianProduct.test_exceed_product_spaceN)Ú__name__Ú
__module__Ú__qualname__r   r'   r0   r2   r=   ÚmarkZparametrizer6   r8   rA   rJ   r   r   r   r   r      s   
&
,ÿ
r   )Únumpyr   r=   Zpandasr   r   Zpandas._testingZ_testingr   Zpandas.core.reshape.utilr   r   r   r   r   r   Ú<module>   s
   