
    Owg,                     \    d dl m Z  d dlZd dlZd dlmZmZmZmZm	Z	 d dl
mZ  G d d      Zy)    )datetimeN)PeriodSeries
date_rangeperiod_rangeto_datetimec                   <    e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
y	)
TestCombineFirstc           
         t        ddd      }t        t        d      t        d      d      }||fD ]  }t        dt        j
                  t        j
                  d	d
t        j
                  dg|      }t        g d|      }|j                  |      }t        g d|t        j                        }t        j                  ||        y )Nz
1950-01-31z
1950-07-31ME)startendfreqz1950-1z1950-7M            index)	   r   r   r   r   r   r   )r   r   r   r   r   r   r   r   dtype)
r   r   r   r   npnancombine_firstfloat64tmassert_series_equal)selfdidxpidxidxabresultexpecteds           e/var/www/horilla/myenv/lib/python3.12/site-packages/pandas/tests/series/methods/test_combine_first.py"test_combine_first_period_datetimez3TestCombineFirst.test_combine_first_period_datetime   s    ,TJ&"2x8HsS$< 	5C2662661a;3GA,C8A__Q'F33bjjQH""684	5    c                 b    |j                  |d d       }|j                  |j                  k(  sJ y )Nr   )r   name)r    datetime_seriesr&   s      r(   test_combine_first_namez(TestCombineFirst.test_combine_first_name   s1     ..r/BC{{o22222r*   c                    t        j                  dt         j                        }t        |t        j                  dt         j                              }|dz  }t         j
                  |d d d<   |j                  |      }t        j                  ||       |j                  |      }t        j                  |      j                         sJ t        j                  |d d d   |d d d          t        j                  |dd d   |dd d          t        j                  t        d      D cg c]  }t        |       c}      }t        t         j                  j!                  d      j#                  d      |      }t        t        d      D cg c]  }t        |       c}|d d d   t$              }|j                  |      }t        j                  ||j&                  |d d d             t        j                  |dd d   j)                  t$              |j&                  |dd d             t        g dg d	      }	t        g g t$              }
d
}t        j*                  t,        |      5  |	j                  |
      }d d d        |	j.                  j)                  d      |	_        t        j                  |	       y c c}w c c}w # 1 sw Y   JxY w)N   r   r      r   
   r   )      ?r2      )r   r   r2   DThe behavior of array concatenation with empty entries is deprecatedmatchO)r   aranger   r   int64r   r   r   r   isfiniteallpdIndexrangestrrandomdefault_rngstandard_normalobjectlocastypeassert_produces_warningFutureWarningr   )r    valuesseriesseries_copycombinedir   floatsstringsseremptymsgr&   s                r(   test_combine_firstz#TestCombineFirst.test_combine_first"   s@   2RZZ0bii"((&CDqj66CaC ''4
x0 ,,V4{{8$((***
x!}fSqSk:
x1~{14a4/@A %)4Q#a&45		--a0@@DER%)4Q#a&4E#A#JfU((0
wU3Q3Z(@A
vadd|226:HLLqtRSt<UV [	2r62T''SA 	.&&u-F	.II$$S)	
sF+! 54	. 	.s   .KK
4KKc                    t        t        dt        j                  g            j                  j                  |      }t        t        t        j                  dg            j                  j                  |      }|j                  |      }t        t        ddg            j                  j                  |      }t        j                  ||       t        t        dt        j                  g            j                  j                  |      }t        t        j                  dg      }|j                  |      }t        t        ddd      dgd      }t        j                  ||       y )N20102011i  r   zdatetime64[ns]r1   )
r   r   r   r   dtas_unitr   r   r   r   )r    units0s1rsxps         r(   test_combine_first_dt64z(TestCombineFirst.test_combine_first_dt64H   s    01255==dC 01255==dCb! 01255==dC
r2& 01255==dCRVVV$%b!XdAq)62:JK
r2&r*   c                 4   t        t        j                  g d|      d      }t        t        j                  g d|      g dd      }|j                  |      }t        j                  g d	|      }t        |d      }t	        j
                  ||       y )
N)201501012015010220150103tzser1)r,   )201605142016051520160516)r2   r5   r   ser2)r   r,   )ra   rb   rc   rh   ri   )r   r>   DatetimeIndexr   r   r   )r    tz_naive_fixturerf   rj   r&   exp_valsexps          r(   test_combine_first_dt_tz_valuesz0TestCombineFirst.test_combine_first_dt_tz_valuesW   s    AFVW
 AFVW

 ##D)##H
 XF+
sF+r*   c           	      H   t        t        dddd      t        dddd      dd      }t        t        d      |      }t        |      }d}t	        j
                  t        |	      5  |j                  |      }d d d        t	        j                  |       y # 1 sw Y    xY w)
Ni  r   r3   hzEurope/Rome)r   re   r   r6   r7   )	r   r   r   r@   r   rH   rI   r   r   )r    
time_indexr\   s2rS   r&   s         r(   4test_combine_first_timezone_series_with_empty_serieszETestCombineFirst.test_combine_first_timezone_series_with_empty_seriesi   s    T1a#T1a$	

 E"IZ0*%T''SA 	*%%b)F	*
vr*	* 	*s   'BB!c                     t        ddg      }t        g d      }|j                  |      }t        g d      }t        j                  ||       y )N   +YNJ9    M,YNJ9 )r   r2   r5   )rv   rw   r5   )r   r   r   r   )r    r\   rs   r&   r'   s        r(   "test_combine_first_preserves_dtypez3TestCombineFirst.test_combine_first_preserves_dtypex   sH    (*=>?I!!"%GH
vx0r*   c           
         t        t        j                  dd      di      }t        t        j                  dd      dt        j                  dd      d	i      }|j                  |      }t        dd	gt        j                  t        j                  d
d      t        j                  dd      gd            }t        j                  ||       y )Nz
2019-05-01UTCrd   r4   z2019-05-01 01:00:00+0100zEurope/Londong       @z
2019-05-02g      @z2019-05-01 00:00:00+00:00z2019-05-02 00:00:00+00:00rE   r1   r   )r   r>   	Timestampr   r?   r   r   )r    
uniform_tzmulti_tzr&   r'   s        r(   test_combine_mixed_timezonez,TestCombineFirst.test_combine_mixed_timezone   s    R\\,5A3GH
7OLc\e4c
 ))(3#J((LL!<GLL!<G 	
 	vx0r*   N)__name__
__module____qualname__r)   r.   rT   r_   ro   rt   rx   r~    r*   r(   r
   r
      s+    53$,L',$+11r*   r
   )r   numpyr   pandasr>   r   r   r   r   r   pandas._testing_testingr   r
   r   r*   r(   <module>r      s)        E1 E1r*   