U
    _{fQ                     @   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 dddg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   sj   t dddg }}t||g\}}tddddddg}tddddddg}t|| t|| d S )NABC      ABC)listr   nparraytmassert_numpy_array_equal)selfxyresult1result2	expected1	expected2 r   ]/var/www/html/Darija-Ai-API/env/lib/python3.8/site-packages/pandas/tests/reshape/test_util.pytest_simple   s    z TestCartesianProduct.test_simplec                 C   sn   t ddd}dd t||gD \}}tddddgtjd}tddddg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   dtype)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td S r   )r   AssertionError)r   resultr-   r   r   r   test_empty_input8   s    z%TestCartesianProduct.test_empty_inputXr   c              	   C   s,   d}t jt|d t|d W 5 Q R X d S )Nz'Input must be a list-like of list-likesmatchr8   )pytestraises	TypeErrorr   )r   r8   msgr   r   r   test_invalid_input>   s    z'TestCartesianProduct.test_invalid_inputc              	   C   sP   d}t jt|d4 dd tdD tjdtjdg }t|d W 5 Q R X d S )	Nz+Product space too large to allocate arrays!r9   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   rA   rB   r   )r   r?   Zdimsr   r   r   test_exceed_product_spaceG   s    z.TestCartesianProduct.test_exceed_product_spaceN)__name__
__module____qualname__r   r%   r.   r0   r<   markZparametrizer4   r7   r@   rH   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
   