o
    5c(	                     @   s.   d dl Zd dlZd dlmZ G dd dZdS )    N)TimedeltaArrayc                   @   sD   e Zd Zdd Zdd Zdd Zdd Zd	d
 Zdd Zdd Z	dS )TestTimedeltaArrayConstructorc                 C   s   t jg dddd}tjtdd t|ddd W d    n1 s'w   Y  tjtdd t|d	g   W d    d S 1 sHw   Y  d S )
N)r            zm8[h]dtypem8[ns]zOnly 1-dimensionalmatchr   r   r   )	nparrayastypepytestraises
ValueErrorr   reshapesqueeze)selfarr r   f/var/www/html/gps/gps/lib/python3.10/site-packages/pandas/tests/arrays/timedeltas/test_constructors.pytest_only_1dim_accepted   s   "z5TestTimedeltaArrayConstructor.test_only_1dim_acceptedc                 C   sf   t jg dt jdd d }d}tjt|d t|ddd	 W d    d S 1 s,w   Y  d S )
N)r   r   r   r   i  i ʚ;zQInferred frequency None from passed values does not conform to passed frequency Dr
   ztimedelta64[ns]D)freq)r   r   int64r   r   r   r   view)r   r   msgr   r   r   test_freq_validation   s   "z2TestTimedeltaArrayConstructor.test_freq_validationc                 C   s@   t jtdd tg d W d    d S 1 sw   Y  d S )Nlistr
   r   r   r   )r   r   r   r   r   r   r   r   test_non_array_raises   s   "z3TestTimedeltaArrayConstructor.test_non_array_raisesc                 C   sJ   t jtdd ttjg ddd W d    d S 1 sw   Y  d S )Nzdtype bool cannot be convertedr
   r    boolr   )r   r   r   r   r   r   r!   r   r   r   test_other_type_raises#   s   "z4TestTimedeltaArrayConstructor.test_other_type_raisesc                 C   s   t jtdd ttjg ddddd W d    n1 sw   Y  t jtdd ttjg dddtdd W d    d S 1 sGw   Y  d S )	Nz1category cannot be converted to timedelta64\[ns\]r
   r    i8r   categoryz4dtype int64 cannot be converted to timedelta64\[ns\]r   )r   r   r   r   r   r   r   r!   r   r   r   test_incorrect_dtype_raises'   s   ""z9TestTimedeltaArrayConstructor.test_incorrect_dtype_raisesc                 C   sZ   t jg ddd}t|dd}|j|u sJ t|dd}|j|us#J |jj|us+J d S )Nr    r	   r   F)copyT)r   r   r   _database)r   datar   r   r   r   	test_copy3   s   z'TestTimedeltaArrayConstructor.test_copyc                 C   sF   d}t jt|d tjg td W d    d S 1 sw   Y  d S )Nz3dtype .*object.* cannot be converted to timedelta64r
   r   )r   r   r   r   _from_sequenceobject)r   r   r   r   r   test_from_sequence_dtype<   s   "z6TestTimedeltaArrayConstructor.test_from_sequence_dtypeN)
__name__
__module____qualname__r   r   r"   r$   r'   r,   r/   r   r   r   r   r      s    	r   )numpyr   r   pandas.core.arraysr   r   r   r   r   r   <module>   s    