
    bMhQ                     X    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          ZdS )    N)Index
date_rangecartesian_productc                      e Zd Zd Zd Zd Zd Zej        	                    dg g gddgg gg g dgg          d	             Z
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             Zd ZdS )TestCartesianProductc                     t          d          ddg}}t          ||g          \  }}t          j        g d          }t          j        g d          }t	          j        ||           t	          j        ||           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	expected2s          ^/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/pandas/tests/reshape/test_util.pytest_simplez TestCartesianProduct.test_simple   s    E{{QG1,aV44H;;;<<	H22233	
#GY777
#GY77777    c                 ,   t          dd          }d t          ||g          D             \  }}t          g dt          j                  }t          g dt          j                  }t          j        ||           t          j        ||           d S )N
2000-01-01   )periodsc              3   >   K   | ]}t          |          j        V  d S N)r   day).0r   s     r   	<genexpr>z:TestCartesianProduct.test_datetimeindex.<locals>.<genexpr>   s*      LLQE!HHLLLLLLLr   )r   r   r!   r!   dtype)r   r!   r   r!   )r   r   r   r   int32r   assert_index_equal)r   r   r   r   r   r   s         r   test_datetimeindexz'TestCartesianProduct.test_datetimeindex   s     |Q///LL2CQF2K2KLLL,,,bh777	,,,bh777	
gy111
gy11111r   c                     t          ddd          }t          j        ddg          }t          ||g          \  }}|                    d          }t          j        ||           d S )Nr    r!   
US/Pacificr"   tz      )r   r   r   r   repeatr   r+   r   r   r   r   r   expecteds         r   test_tzaware_retainedz*TestCartesianProduct.test_tzaware_retained   sg    |Q<@@@HaV,aV4488A;;
gx00000r   c                     t          ddd                              d          }t          j        ddg          }t	          ||g          \  }}|                    d          }t          j        ||           d S )Nr    r!   r.   r/   categoryr1   r2   )r   astyper   r   r   r3   r   r+   r4   s         r   !test_tzaware_retained_categoricalz6TestCartesianProduct.test_tzaware_retained_categorical'   su    |Q<@@@GG
SSHaV,aV4488A;;
gx00000r   zx, yr   r   )abcc                 6   t          j        g t          j        |          j                  }t          j        g t          j        |          j                  }t	          ||g          \  }}t          j        ||           t          j        ||           d S )Nr(   )r   r   asarrayr)   r   r   r   )r   r   r   r   r   r   r   s          r   
test_emptyzTestCartesianProduct.test_empty/   s     HRrz!}}':;;;	HRrz!}}':;;;	,aV44
#GY777
#GY77777r   c                 8    t          g           }g }||k    sJ d S r$   r   )r   resultr5   s      r   test_empty_inputz%TestCartesianProduct.test_empty_input8   s+    "2&&!!!!!!r   Xr!   r;   r<   c                     d}t          j        t          |          5  t          |           d d d            d S # 1 swxY w Y   d S )Nz'Input must be a list-like of list-likesmatchrD   )pytestraises	TypeErrorr   )r   rD   msgs      r   test_invalid_inputz'TestCartesianProduct.test_invalid_input>   s     8]9C000 	# 	#""""	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	#s   <A A c                    d}t          j        t          |          5  d t          d          D             t	          j        dt          j                  gz   }t          |           d d d            d S # 1 swxY w Y   d S )Nz+Product space too large to allocate arrays!rF   c                 P    g | ]#}t          j        d dt           j                  $S )r   r   r(   )r   arangeint16)r&   is     r   
<listcomp>zBTestCartesianProduct.test_exceed_product_space.<locals>.<listcomp>L   s+    HHHBIa28444HHHr      i;  r(   rH   )rI   rJ   
ValueErrorranger   rP   rQ   r   )r   rL   dimss      r   test_exceed_product_spacez.TestCartesianProduct.test_exceed_product_spaceG   s    ;]:S111 	& 	&HHeBiiHHH5111L D %%%%		& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	&s   AA77A;>A;N)__name__
__module____qualname__r   r,   r6   r:   rI   markparametrizer@   rC   rM   rX    r   r   r   r      s       8 8 82 2 21 1 11 1 1 [Vr2h!Qr???>S%TUU8 8 VU8" " " [a!q!fsAhcUS#J#M # # #& & & & &r   r   )numpyr   rI   pandasr   r   pandas._testing_testingr   pandas.core.reshape.utilr   r   r^   r   r   <module>rd      s                      6 6 6 6 6 6C& C& C& C& C& C& C& C& C& C&r   