o
    _~#gQ                     @   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/static.ux5.de/https/Moving-Object-Detection-with-OpenCV/env/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    