
    OwgQ                     P    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y)    N)Index
date_rangecartesian_productc                       e Zd Zd Zd Zd Zd Zej                  j                  dg g gddgg gg g dgg      d	        Z
d
 Zej                  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y)TestCartesianProductc                     t        d      ddg}}t        ||g      \  }}t        j                  g d      }t        j                  g d      }t	        j
                  ||       t	        j
                  ||       y )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          U/var/www/horilla/myenv/lib/python3.12/site-packages/pandas/tests/reshape/test_util.pytest_simplez TestCartesianProduct.test_simple   sd    E{QG1,aV4HH;<	HH23	
##GY7
##GY7    c                    t        dd      }d t        ||g      D        \  }}t        g dt        j                        }t        g dt        j                        }t        j                  ||       t        j                  ||       y )N
2000-01-01   )periodsc              3   F   K   | ]  }t        |      j                    y wN)r   day).0r   s     r   	<genexpr>z:TestCartesianProduct.test_datetimeindex.<locals>.<genexpr>   s     LQE!HLLLs   !)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   si     |Q/L2CQF2KL,bhh7	,bhh7	
gy1
gy1r   c                     t        ddd      }t        j                  ddg      }t        ||g      \  }}|j	                  d      }t        j                  ||       y )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   sR    |Q<@HHaV,aV488A;
gx0r   c                     t        ddd      j                  d      }t        j                  ddg      }t	        ||g      \  }}|j                  d      }t        j                  ||       y )Nr    r!   r.   r/   categoryr1   r2   )r   astyper   r   r   r3   r   r+   r4   s         r   !test_tzaware_retained_categoricalz6TestCartesianProduct.test_tzaware_retained_categorical'   s]    |Q<@GG
SHHaV,aV488A;
gx0r   zx, yr   r   )abcc                 L   t        j                  g t        j                  |      j                        }t        j                  g t        j                  |      j                        }t	        ||g      \  }}t        j                  ||       t        j                  ||       y )Nr(   )r   r   asarrayr)   r   r   r   )r   r   r   r   r   r   r   s          r   
test_emptyzTestCartesianProduct.test_empty/   ss     HHRrzz!}':':;	HHRrzz!}':':;	,aV4
##GY7
##GY7r   c                 ,    t        g       }g }||k(  sJ y 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        y # 1 sw Y   y xY w)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>   s4     8]]9C0 	#"	# 	# 	#s   4=c           	      R   d}t        j                  t        |      5  t        d      D cg c](  }t	        j
                  ddt        j                        * c}t	        j
                  dt        j                        gz   }t        |       d d d        y c c}w # 1 sw Y   y xY w)	Nz+Product space too large to allocate arrays!rF      r   r   r(   i;  rH   )rI   rJ   
ValueErrorranger   arangeint16r   )r   rL   idimss       r   test_exceed_product_spacez.TestCartesianProduct.test_exceed_product_spaceG   s~    ;]]:S1 	&>CBiHBIIa2884H51L D %		& 	&H	& 	&s   B-B6BBB&N)__name__
__module____qualname__r   r,   r6   r:   rI   markparametrizer@   rC   rM   rV    r   r   r   r      s    8211 [[Vr2h!Qr?>S%TU8 V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>rb      s$       6C& C&r   