
    A[g                     X    d dl Zd dlZd dlmZmZmZmZmZm	Z	m
Z
 d dlmZ  G d d      Zy)    N)	DataFrameDatetimeIndexIndex
MultiIndexSeriesconcat
date_rangec                       e Zd Zd Zd Zd Zd Zd Zd Zd Z	e
j                  j                  d ej                  d	      d
fdg      d        Zd Zd Zy)TestSeriesConcatc           	         t        t        j                  dt        j                        t	        dd      d      }d|_        |d d |dd |dd  g}t        |      }t        j                  ||       |j
                  |j
                  k(  sJ t        |g d	
      }|j                         }t        t        j                  |j                  j                  d            |_        t        j                  g d	|D cg c]  }t        |       c}      t        j                  t        |            g}t!        g d	|j                  g|      }||_        t        j                  ||       y c c}w )N   dtype
2020-01-01periodsfooindexname      r         )keyszM8[ns])levelscodes)r   nparangefloat64r	   r   r   tmassert_series_equalcopyr   arrayr   valuesrepeatlenr   )selftspiecesresultexpectedx	exp_codes	exp_indexs           b/var/www/html/bid-api/venv/lib/python3.12/site-packages/pandas/tests/reshape/concat/test_series.pytest_concat_seriesz#TestSeriesConcat.test_concat_series   s   IIb

+\26

 Ra&"Qr(BrsG,
vr*{{bgg%%%Y/779 "((//!JKYYy6*B6a3q66*BCRYYsSUwEWX	y"((&;9M	"
vx0 +Cs   <E,
c                     t        dg      }t        g t              }|}d}t        j                  t        |      5  t        ||g      }d d d        t        j                  |       y # 1 sw Y    xY w)Nr   r   zDThe behavior of array concatenation with empty entries is deprecated)match)r   objectr"   assert_produces_warningFutureWarningr   r#   )r)   s1s2r-   msgr,   s         r1   1test_concat_empty_and_non_empty_series_regressionzBTestSeriesConcat.test_concat_empty_and_non_empty_series_regression)   sa    QC[Bf%T''SARH%F B
vx0 BAs   A**A3c                    t        t        j                  dt        j                        t	        dd            }|d d |dd  |dd g}t        |d	      }t        |      j                  }t        j                  ||       t        |g d
d      }t        |g d
      j                  }t        j                  ||       y )N
   r   r   r   r   r   r   axis)ABC)r   rA   )
r   r   r    r!   r	   r   r   Tr"   assert_frame_equal)r)   r*   r+   r,   r-   s        r1   test_concat_series_axis1z)TestSeriesConcat.test_concat_series_axis14   s    IIb

+:lTV3W
 Sb'2ab62a8,Q'V$&&
fh/_1=V?;==
fh/    c                    t        t        j                  j                  d      j	                  d      d      }t        t        j                  j                  d      j	                  d      d      }t        ||gd      }t        ||d      }t        j                  ||       d |_	        t        ||gd      }t        j                  |j                  t        dd	gd
             y )Nr   r   rB   r   rC   r   r@   rB   rC   r   r5   r   )r   r   randomdefault_rngstandard_normalr   r   r"   rF   r   assert_index_equalcolumnsr   r)   sr9   r,   r-   s        r1   /test_concat_series_axis1_preserves_series_namesz@TestSeriesConcat.test_concat_series_axis1_preserves_series_namesC   s    299((+;;A>SIBII))!,<<Q?cJBa(12./
fh/Ba(
fnneS!HH.MNrH   c                    t        t        j                  j                  d      j	                  d      g dd      }t        t        j                  j                  d      j	                  d      g dd      }t        ||gd	|
      }t        ||dg d      }|r|j                         }t        j                  ||       y )Nr      )cabrB   r      )drW   rX   rV   rC   r   )rA   sortrK   )rV   rW   rX   rZ   r>   )
r   r   rL   rM   rN   r   r   
sort_indexr"   rF   )r)   r[   rR   r9   r,   r-   s         r1   %test_concat_series_axis1_with_reindexz6TestSeriesConcat.test_concat_series_axis1_with_reindexP   s    II!!!$44Q7UX
 II!!!$44Q7&

 Bad312.6JK**,H
fh/rH   c                    t        g d      }t        g d      }t        ||gdddgdg      }t        ddgd	d
gddggt        ddgd            }t	        j
                  ||       t        ||gdddgddg      }t        ddgd	d
gddggt        j                  ddgddg            }t	        j
                  ||       y )N)r   r   rU   )rY   r      r   rW   rX   rB   )rA   r   namesrY   r   r   rU   r_   rJ   rP   )rW   r   )rX   r   rC   )r`   )r   r   r   r   r"   rF   r   from_tuplesrQ   s        r1   &test_concat_series_axis1_names_appliedz7TestSeriesConcat.test_concat_series_axis1_names_applied`   s    9IBasCjFVaVaV$eS#JS.I
 	fh/Bax.B3PS*UVaVaV$**Hh+?SzR
 	fh/rH   c                    t        ddd      dd }t        t        j                  j	                  d      j                  t        |            |d	      }t        t        j                  j	                  d      j                  t        |            |d	      }t        ||gd
d      }t        t        d            }t        j                  |j                  |d       y )Nz01-Jan-2013z01-Jan-2014MS)freqr   r   valuer   r   TrA   ignore_index)exact)r	   r   r   rL   rM   rN   r(   r   r   ranger"   rO   rP   )r)   datesr8   r9   r,   r-   s         r1   0test_concat_series_axis1_same_names_ignore_indexzATestSeriesConcat.test_concat_series_axis1_same_names_ignore_indexq   s    =-dCAbIII!!!$44SZ@

 II!!!$44SZ@
 Rqt<q?
fnnhdCrH   zs1name,s2name   +   r   )ro   rp   c                     t        ddd|      }t        ddd|      }t        ||g      }t        ddddd      }t        j                  ||       y )	Nr   r   )rW   rX   rJ   r   r_   )rV   rZ   )rW   rX   rV   rZ   )r   r   r"   r#   )r)   s1names2namer8   r9   r,   r-   s          r1   &test_concat_series_name_npscalar_tuplez7TestSeriesConcat.test_concat_series_name_npscalar_tuple   sW    
 !!$62!!$62R!:;
vx0rH   c                    t        ddgd      }t        ddg      }t        ddg      }t        |||gd      }t        ddgddgddgdg d	      }t        j                  ||       t        |||gdg d
      }t        ddgddgddgd
g d
	      }t        j                  ||       t        |||gdd      }t        ddgddgddgd      }t        j                  ||       y )Nr   r   r   rJ   rY   r   r@   )r   r   r   ra   )redblueyellow)rA   r   Tri   r   )r   r   r   r"   rF   )r)   named_seriesunnamed_series1unnamed_series2r,   r-   s         r1   (test_concat_series_partial_columns_namesz9TestSeriesConcat.test_concat_series_partial_columns_names   s   q!f51 !Q. !Q.HqQF1v1a&1=
 	fh/?O<*

 FQFq!f=-
 	fh/?O<1SW
 !QQF1v>?
fh/rH   c                 z     |dg      }t        |j                  d d d   g      }t        j                  ||       y )Nd   rg   )r   ilocr"   assert_equal)r)   frame_or_seriesobjr,   s       r1   &test_concat_series_length_one_reversedz7TestSeriesConcat.test_concat_series_length_one_reversed   s5    se$$B$()
$rH   N)__name__
__module____qualname__r2   r;   rG   rS   r]   rc   rn   pytestmarkparametrizer   int64ru   r}   r    rH   r1   r   r      sm    10	10O0 0"D$ [[8288C='2NC110:%rH   r   )numpyr   r   pandasr   r   r   r   r   r   r	   pandas._testing_testingr"   r   r   rH   r1   <module>r      s+        _% _%rH   