
    i                     R    d dl Zd dlZd dlZd dlmZmZ d dlmZ	 d Z
 G d d      Zy)    N)PeriodIndexSeriesc                     t        g dd      } t        j                  g dt              }| j	                         }t        j                  ||       | j	                  d      }t        j                  ||       t        j                  g dt              }| j	                  d	      }t        j                  ||       t        d
t        j                  dgd      } t        j                  g dt              }| j	                  d      }t        j                  ||       t        j                  g dt              }| j	                  d      }t        j                  ||       y )N)
2017-01-01z
2017-01-02
2017-01-03Dfreq)dtypepandas)na_rep)z
01-2017-01z
01-2017-02z
01-2017-03z%m-%Y-%d)date_formatr   r   )r   NaTr   r   )r   r   r   )	r   nparrayobject_get_values_for_csvtmassert_numpy_array_equalpdr   )indexexpectedresults      e/app/cer_product_mecsu/.venv/lib/python3.12/site-packages/pandas/tests/indexes/period/test_formats.pytest_get_values_for_csvr      s   BME xxB&QH&&(F1 &&h&7F1 xxB&QH&&:&>F1 rvv|<3GExx;6JH&&e&4F1xx>fMH&&h&7F1    c                   `    e Zd Zej                  j                  dddg      d        Zd Zd Zy)TestPeriodIndexRenderingmethod__repr____str__c                    t        g d      }t        dgd      }t        ddgd      }t        g dd      }t        g dd      }t        g dd	      }t        j                  d
dd      }t        j                  d
dd      }	t        j                  d
dd      }
t        ddgd      }d}d}d}d}d}d}d}d}d}d}t        ||||||||	|
|g
||||||||||g
      D ]  \  }} t	        ||             }||k(  rJ  y )Nr   r	   
2011-01-01
2011-01-02r#   r$   z
2011-01-03201120122013Yz2011-01-01 09:00z2012-02-01 10:00r   h2013Q1   Qperiodsr
         z
2011-02-013Dz"PeriodIndex([], dtype='period[D]')z.PeriodIndex(['2011-01-01'], dtype='period[D]')z<PeriodIndex(['2011-01-01', '2011-01-02'], dtype='period[D]')zJPeriodIndex(['2011-01-01', '2011-01-02', '2011-01-03'], dtype='period[D]')z<PeriodIndex(['2011', '2012', '2013'], dtype='period[Y-DEC]')zOPeriodIndex(['2011-01-01 09:00', '2012-02-01 10:00', 'NaT'], dtype='period[h]')z.PeriodIndex(['2013Q1'], dtype='period[Q-DEC]')z8PeriodIndex(['2013Q1', '2013Q2'], dtype='period[Q-DEC]')zBPeriodIndex(['2013Q1', '2013Q2', '2013Q3'], dtype='period[Q-DEC]')z=PeriodIndex(['2011-01-01', '2011-02-01'], dtype='period[3D]'))r   r   period_rangezipgetattr)selfr   idx1idx2idx3idx4idx5idx6idx7idx8idx9idx10exp1exp2exp3exp4exp5exp6exp7exp8exp9exp10idxr   r   s                            r   test_representationz,TestPeriodIndexRendering.test_representation-   sJ    2C(L>4L,7cBECP3#>JQTUx=x=x=\<8tD3?M Y 	 N! 	
 @ISO 4tT4tT5I4tT4tT5I
 	&MC *WS&)+FX%%%	&r   c                    t        g d      }t        dgd      }t        ddgd      }t        g dd      }t        g dd      }t        g dd	      }t        j                  d
dd      }t        j                  d
dd      }t        j                  d
dd      }	d}
d}d}d}d}d}d}d}d}t        |||||||||	g	|
||||||||g	      D ]   \  }}t	        t        |            }||k(  r J  y )Nr   r	   r#   r$   r%   r&   r*   r+   r,   r-   r.   r/   r0   r2   r3   zSeries([], dtype: period[D])z 0    2011-01-01
dtype: period[D]z00    2011-01-01
1    2011-01-02
dtype: period[D]z@0    2011-01-01
1    2011-01-02
2    2011-01-03
dtype: period[D]z20    2011
1    2012
2    2013
dtype: period[Y-DEC]zR0    2011-01-01 09:00
1    2012-02-01 10:00
2                 NaT
dtype: period[h]z 0    2013Q1
dtype: period[Q-DEC]z,0    2013Q1
1    2013Q2
dtype: period[Q-DEC]z80    2013Q1
1    2013Q2
2    2013Q3
dtype: period[Q-DEC])r   r   r5   r6   reprr   r8   r9   r:   r;   r<   r=   r>   r?   r@   rA   rC   rD   rE   rF   rG   rH   rI   rJ   rK   rM   r   r   s                         r   test_representation_to_seriesz6TestPeriodIndexRendering.test_representation_to_series\   s,   2C(L>4L,7cBECP3#>JQTUx=x=x=1



 !4tT4tTB4tT4tTB
 	&MC &+&FX%%%	&r   c                    t        g d      }t        dgd      }t        ddgd      }t        g dd      }t        g dd      }t        g dd	      }t        j                  d
dd      }t        j                  d
dd      }t        j                  d
dd      }	d}
d}d}d}d}d}d}d}d}t        |||||||||	g	|
||||||||g	      D ]  \  }}|j	                         }||k(  rJ  y )Nr   r	   r#   r$   r%   r&   r*   r+   r,   r-   r.   r/   r0   r2   r3   zPeriodIndex: 0 entries
Freq: Dz8PeriodIndex: 1 entries, 2011-01-01 to 2011-01-01
Freq: Dz8PeriodIndex: 2 entries, 2011-01-01 to 2011-01-02
Freq: Dz8PeriodIndex: 3 entries, 2011-01-01 to 2011-01-03
Freq: Dz0PeriodIndex: 3 entries, 2011 to 2013
Freq: Y-DECz7PeriodIndex: 3 entries, 2011-01-01 09:00 to NaT
Freq: hz4PeriodIndex: 1 entries, 2013Q1 to 2013Q1
Freq: Q-DECz4PeriodIndex: 2 entries, 2013Q1 to 2013Q2
Freq: Q-DECz4PeriodIndex: 3 entries, 2013Q1 to 2013Q3
Freq: Q-DEC)r   r   r5   r6   _summaryrQ   s                         r   test_summaryz%TestPeriodIndexRendering.test_summary   s+   2C(L>4L,7cBECP3#>JQTUx=x=x= !4tT4tTB4tT4tTB
 	&MC \\^FX%%%	&r   N)	__name__
__module____qualname__pytestmarkparametrizerN   rR   rU    r   r   r   r   ,   s7    [[X
I'>?+& @+&\6&p-&r   r   )numpyr   rY   r   r   r   r   pandas._testing_testingr   r   r   r\   r   r   <module>r`      s*       2@U& U&r   