o
    5cJ                    @   s  d Z ddlmZ ddlmZ ddlZddlmZ ddlZddlm	Z	 ddl
Z
ddlmZ ddlZddlZddlZddlZddlZddlZddlmZmZ ddlm  mZ ddlZdd	lmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z( ddl)m*Z+ ddl,m  m-  m.Z/ ddl0m  m-  m1Z1 e pe Z2ej3g d
ddd Z4ej3dd Z5ej3dd Z6dd Z7dd Z8dd Z9dd Z:dd Z;dd Z<dd Z=d d! Z>ej?@d"G d#d$ d$ZAd%d& ZBG d'd( d(ZCG d)d* d*ZDd+d, ZEG d-d. d.ZFG d/d0 d0ZGG d1d2 d2ZHG d3d4 d4ZIG d5d6 d6ZJG d7d8 d8ZKG d9d: d:ZLG d;d< d<ZMG d=d> d>ZNd?d@ ZOdAdB ZPejQdCdD ZRej?@dEej?SdFg dGej?SdHg dIdJdK ZTej?@dLej?SdFg dGdMdN ZUdOdP ZVdS )QzJ
Test output formatting for Series/DataFrame, including to_string & reprs
    )datetime)StringION)methodcaller)Path)get_terminal_size)IS64is_platform_windows)	DataFrameIndex
MultiIndexNaTSeries	Timestamp
date_range
get_optionoption_contextread_csvreset_option
set_option)stringpathlikebuffer)paramsc                 C   s   | j S )zE
    A fixture yielding test ids for filepath_or_buffer testing.
    )param)request r   Y/var/www/html/gps/gps/lib/python3.10/site-packages/pandas/tests/io/formats/test_format.pyfilepath_or_buffer_id1   s   r   c                 c   sZ    | dkrt  }|V  |jrJ dS t|tsJ | dkr$|d V  dS t|d V  dS )z
    A fixture yielding a string representing a filepath, a path-like object
    and a StringIO buffer. Also checks that buffer is not closed.
    r   r   fooN)r   closed
isinstancer   str)r   tmp_pathbufr   r   r   filepath_or_buffer9   s   r$   c                    s    fdd}|S )z;
    Assertion helper for checking filepath_or_buffer.
    c                    st   dkrt  d}| }W d    n1 sw   Y  ndkr*j d}ndkr2 }|| ks8J d S )Nr   )encodingr   r   )openread	read_textgetvalue)expectedfresultr%   r$   r   r   r   !_assert_filepath_or_buffer_equalsS   s   
zKassert_filepath_or_buffer_equals.<locals>._assert_filepath_or_buffer_equalsr   )r$   r   r%   r.   r   r-   r    assert_filepath_or_buffer_equalsK   s   
r/   c                  C   s   t jt jt\} }| S N)ospathsplitabspath__file__)pth_r   r   r   curpath`   s   r8   c                 C   s8   t | }|dd d}|dd d}|p|S )N
r   <class	&lt;class)reprr3   
startswith)dfrc1c2r   r   r   has_info_repre   s   rB   c                 C   s*   t | }t| }t|ddk}|o|S )Nr9      )rB   r<   lenr3   )r>   has_infor?   nvr   r   r   has_non_verbose_info_reprl   s   rG   c                 C   s   zt t|  d  }t |dkd d }W n
 ty$   Y dS w t| }t| D ]\}}| | dks> dS q/dS )Nr   ...FT)nparrayr<   
splitlinesr3   where
IndexError	enumerate)r>   fst_linecand_colr?   ixlr   r   r   has_horizontally_truncated_reprz   s   rS   c                 C   s.   t | }d}| D ]
}td|rd}q
|S )NFz	^[\.\ ]+$T)r<   rK   rematch)r>   r?   only_dot_rowrowr   r   r   has_vertically_truncated_repr   s   rX   c                 C   s   t | pt| S r0   rS   rX   r>   r   r   r   has_truncated_repr      r[   c                 C   s   t | ot| S r0   rY   rZ   r   r   r   has_doubly_truncated_repr   r\   r]   c                 C   s,   t | }|dD ]
}|dr dS q	dS )Nr9   \TF)r<   r3   endswith)r>   r?   liner   r   r   has_expanded_repr   s   
ra   zignore::FutureWarning:.*formatc                   @   s  e Zd Zdd Zejdg dg dg dg dg dg d	gd
d Zdd Zdd Z	dd Z
dd Zdd Zdd Zdd Zdd Zdd Zdd Zd d! Zd"d# Zd$d% Zd&d' Zd(d) Zd*d+ Zd,d- Zd.d/ Zd0d1 Zd2d3 Zd4d5 Zd6d7 Zd8d9 Zd:d; Zd<d= Z d>d? Z!ejd@e"j#e"j$e"j%e"j&gejdAdBdCgejdDdBdCgdEdF Z'dGdH Z(dIdJ Z)dKdL Z*dMdN Z+ejdOg dPdQdR Z,dSdT Z-dUdV Z.dWdX Z/dYdZ Z0d[d\ Z1d]d^ Z2d_d` Z3dadb Z4dcdd Z5dedf Z6dgdh Z7didj Z8dkdl Z9dmdn Z:dodp Z;dqdr Z<dsdt Z=dudv Z>dwdx Z?dydz Z@d{d| ZAd}d~ ZBdd ZCdd ZDdd ZEdd ZFdd ZGdd ZHdd ZIdd ZJdd ZKdd ZLdd ZMdd ZNdd ZOdd ZPdd ZQdd ZRdd ZSdd ZTdd ZUdd ZVdd ZWdd ZXdd ZYdd ZZdd Z[ejddgdfddgdfe\j]gdfdgdfde\j]gdfde\j]gdfde\j]dgdfg ddfgdd Z^ejddj_dfdj_dfgddȄ Z`ddʄ Zadd̄ Zbdd΄ Zcejdg dТdd҄ ZddS )TestDataFrameFormattingc                 C   sR   |}d|j d< t  t| tjdd t| tjdd t| t  d S )Nr      T)use_eng_prefix)accuracy)locfmtset_eng_float_formatr<   tmreset_display_optionsselffloat_framer>   r   r   r   test_eng_float_formatter   s   
z0TestDataFrameFormatting.test_eng_float_formatterz!row, columns, show_counts, result)   ro   NT)ro   ro   TT)ro   ro   FF)rc   rc   NF)rc   rc   TF)rc   rc   FFc              	   C   s   t dtdtdd}tj|jd< td|d|5 t }|j||d d| v |u s.J W d    n1 s8w   Y  W d    d S W d    d S 1 sPw   Y  d S )	N   
   columnsindex)rp   rp   zdisplay.max_info_rowsdisplay.max_info_columns)r#   show_countsnon-null)	r	   rangerI   nanilocr   r   infor)   )rl   rW   rs   rv   r,   r>   r#   r   r   r   test_show_counts   s   "z(TestDataFrameFormatting.test_show_countsc                 C   s   t dtdtdd}tjtdd t }|j|dd d| v s%J W d    n1 s/w   Y  tj	t
d	d |jddd
 W d    d S 1 sNw   Y  d S )Nrp   rq   rr   znull_counts is deprecated.+rU   T)r#   null_countsrw   z#null_counts used with show_counts.+)r~   rv   )r	   rx   ri   assert_produces_warningFutureWarningr   r{   r)   pytestraises
ValueError)rl   r>   r#   r   r   r   !test_show_null_counts_deprecation   s   "z9TestDataFrameFormatting.test_show_null_counts_deprecationc                    sD  d t d T ttjd fddtdD d}t|}||dd d  }t	 }t
|d|d	 D ]\}}||d  krMd
|v sLJ q9d
|vsSJ q9W d    n1 s^w   Y  t dd d
t|vsqJ W d    n1 s{w   Y  t d d  d
t|vsJ W d    d S 1 sw   Y  d S )Nro   display.max_colwidthrq   c              	      s(   g | ]}t tj d   d  qS rp   )ri   randsrI   randomrandint.0imax_lenr   r   
<listcomp>   s    z@TestDataFrameFormatting.test_repr_truncation.<locals>.<listcomp>ABr9   rp   r   rH   i?B    )r   r	   rI   r   randnrx   r<   findrg   get_adjustmentzipr3   rD   )rl   r>   r?   adjr`   valuer   r   r   test_repr_truncation   s0   

	"z,TestDataFrameFormatting.test_repr_truncationc                 C   sJ   t d}tt tdd W d    n1 sw   Y  td| d S )Nr   )r   ri   r   r   r   )rl   widthr   r   r   "test_repr_deprecation_negative_int   s
   z:TestDataFrameFormatting.test_repr_deprecation_negative_intc                 C   s   t ddgddgg}td t|dksJ tdd t|dks$J W d    n1 s.w   Y  tdd t|d	ksAJ W d    n1 sKw   Y  tdd  t|dks^J W d    d S 1 siw   Y  d S )
N皙?      ?gdisplay.chop_thresholdz#     0    1
0  0.1  0.5
1  0.5 -0.1g?z#     0    1
0  0.0  0.5
1  0.5  0.0g333333?z#     0    1
0  0.0  0.0
1  0.0  0.0)r	   r   r<   r   rl   r>   r   r   r   test_repr_chop_threshold   s   "z0TestDataFrameFormatting.test_repr_chop_thresholdc                 C   s   t g dg dgj}tdd t|dksJ W d    n1 s#w   Y  tdd t|dks6J W d    n1 s@w   Y  tdd t|d	ksSJ W d    d S 1 s^w   Y  d S )
N)rq   ro      (   )g|>gdyg&.!>gdyr   r   zm      0             1
0  10.0  8.000000e-10
1  20.0 -1.000000e-11
2  30.0  2.000000e-09
3  40.0 -2.000000e-11g:0yE>zm      0             1
0  10.0  0.000000e+00
1  20.0  0.000000e+00
2  30.0  0.000000e+00
3  40.0  0.000000e+00g|=zm      0             1
0  10.0  8.000000e-10
1  20.0  0.000000e+00
2  30.0  2.000000e-09
3  40.0  0.000000e+00)r	   Tr   r<   r   r   r   r   %test_repr_chop_threshold_column_below
  s    
	
	
"z=TestDataFrameFormatting.test_repr_chop_threshold_column_belowc                 C   s   t dd ttttddksJ W d    n1 sw   Y  t dd ttttddk s9J W d    n1 sCw   Y  t dd ttttddk s]J W d    d S 1 shw   Y  d S )Nzdisplay.max_seq_itemsi    rc   d   rp   	   )r   rD   printingpprint_thinglistrx   rl   r   r   r   test_repr_obeys_max_seq_limit*  s      "z5TestDataFrameFormatting.test_repr_obeys_max_seq_limitc                 C   s   t dhdks
J d S )Nrp   z{1})r   r   r   r   r   r   test_repr_set4     z%TestDataFrameFormatting.test_repr_setc                 C   s4   t ddg}tdt| }tt|t| d S )Nabzpd.)r
   evalr<   ri   assert_series_equalr   )rl   idxresr   r   r   $test_repr_is_valid_construction_code7  s   z<TestDataFrameFormatting.test_repr_is_valid_construction_codec                 C   s<   g d}g d}dg}t |||d}t| tksJ d S )N)   rc      rc   )   σu   τu   υu   φu   ψrr   )r	   type__repr__r!   )rl   dataindex1colsr>   r   r   r   test_repr_should_return_str>  s
   z3TestDataFrameFormatting.test_repr_should_return_strc                 C   sR   t dd ttjdd}dt|vsJ W d    d S 1 s"w   Y  d S )Nmode.sim_interactiveTrq      r^   )r   r	   rI   r   r   r<   r   r   r   r   test_repr_no_backslashJ  s   "z.TestDataFrameFormatting.test_repr_no_backslashc              
   C   s  t ddgdgd}t ddgtdd}t dtdtdd}tdd td	dd
dddddz tdd, t|r<J t|rBJ t|rHJ t|sNJ t|sTJ t|sZJ W d    n1 sdw   Y  tdd, t|ruJ t|r{J t|rJ t|rJ t|sJ t|rJ W d    n1 sw   Y  W d    n1 sw   Y  W d    d S W d    d S 1 sw   Y  d S )Nhellor   rt   rs   rq   r   rc   r   Tdisplay.max_columnsdisplay.widthro   display.max_rowsdisplay.show_dimensionsdisplay.expand_frame_reprF)r	   rx   r   r[   ra   rX   rS   )rl   df_smalldf_widedf_tallr   r   r   test_expand_frame_reprO  sF   
"z.TestDataFrameFormatting.test_expand_frame_reprc                 C   sf   t dtdtdd}tddddd	d
 t|rJ t|r!J W d    d S 1 s,w   Y  d S )Nr   r   rc   r   r   Fr   r   r   i  )r	   rx   r   r[   ra   r   r   r   r   test_repr_non_interactiveo  s   "z1TestDataFrameFormatting.test_repr_non_interactivec           	         s   d | d fdd td}tddg}td||d	}t|}|d
d d \}}d|v s3J d|v s9J d|v s?J d|v sEJ tddgddgd}t|}|jd |d
d v sbJ d S )N)v   `   *pandas.io.formats.format.get_terminal_sizec                          S r0   r   r   terminal_sizer   r   <lambda>      zKTestDataFrameFormatting.test_repr_truncates_terminal_size.<locals>.<lambda>rc   )z%This is a long title with > 37 chars.cat)z,This is a loooooonger title with > 43 chars.dogrp   r   r9   r   longloooooongerr   r   ))AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA)BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBr   )setattrrx   r   from_tuplesr	   r<   r3   rs   )	rl   monkeypatchrt   rs   r>   r,   h1h2df2r   r   r   !test_repr_truncates_terminal_sizez  s(    z9TestDataFrameFormatting.test_repr_truncates_terminal_sizec                    s>   d t tjdd}|d fdd dt|vsJ d S )N)P      rp      r   c                      r   r0   r   r   r   r   r   r     r   zPTestDataFrameFormatting.test_repr_truncates_terminal_size_full.<locals>.<lambda>rH   )r	   rI   r   randr   r!   )rl   r   r>   r   r   r   &test_repr_truncates_terminal_size_full  s   z>TestDataFrameFormatting.test_repr_truncates_terminal_size_fullc                 C   sN   t ddgddgddgddgdgd d}dt|v sJ dt|vs%J d S )	Ni inx  i90  2aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar   )r   r   cderH   z    ...    )r	   r!   r   r   r   r    test_repr_truncation_column_size  s   	z8TestDataFrameFormatting.test_repr_truncation_column_sizec              
   C   s&  t  \}}|dk s|dk rtd| d|  dd }|d}|d}tdd td	|d
  tdddd$ t|drBJ t|drJJ t|rPJ t|sVJ W d    n1 s`w   Y  tdddd t|rsJ t|ryJ W d    n1 sw   Y  tdddd t|rJ t|sJ W d    n1 sw   Y  W d    n1 sw   Y  tddd|d d	d + ||d d
 }t|rJ ||d d
 }t	|
  t|sJ W d    n1 sw   Y  W d    d S W d    d S 1 sw   Y  d S )Nrq   zterminal size too small, z x c                 S   s   dd t | D }td||S )Nc                 S   s   g | ]}|d qS )05dr   r   r   r   r   r         z[TestDataFrameFormatting.test_repr_max_columns_max_rows.<locals>.mkframe.<locals>.<listcomp>r   )rx   r	   )nrt   r   r   r   mkframe  s   zGTestDataFrameFormatting.test_repr_max_columns_max_rows.<locals>.mkframerC   r   Tr   r   r   rc   r   r   ro   r   r   r   )r   r   skipr   ra   r]   r[   rX   r   r   _repr_fits_horizontal_)rl   
term_widthterm_heightr   df6df10r>   r   r   r   test_repr_max_columns_max_rows  sR   
$z6TestDataFrameFormatting.test_repr_max_columns_max_rowsc                 C   s  t dtdi}dt|vsJ d| vsJ t dtdi}dt|v s(J d| v s0J tdddd( dt|v s@J d	t|vsHJ d
| v sPJ d| vsXJ W d    n1 sbw   Y  tdddd  dt|v swJ d| v sJ W d    n1 sw   Y  tdddd dt|vsJ d| vsJ W d    n1 sw   Y  tdd dd dt|vsJ d| vsJ W d    d S 1 sw   Y  d S )Nr   ro   ..=   r   rq   display.min_rowsr   2  rH   z
<td>2</td>   z5    5z
<td>5</td>)r	   rx   r<   _repr_html_r   r   r   r   r   test_repr_min_rows  s0   "z*TestDataFrameFormatting.test_repr_min_rowsc                 C   s~   t ddddddddddg}|g d t|dksJ td	d
 t|dks-J W d    d S 1 s8w   Y  d S )Nr   barz*uncomfortably long line with lots of stuffrp   r   r   r   r   stuffr   r   r   z     a    b                                           c  d
0  foo  bar  uncomfortably long line with lots of stuff  1
1  foo  bar                                       stuff  1max_colwidthro   zk     a    b                    c  d
0  foo  bar  uncomfortably lo...  1
1  foo  bar                stuff  1)r	   	set_indexr!   r   r   r   r   r   test_str_max_colwidth  s$   
"z-TestDataFrameFormatting.test_str_max_colwidthc              
   C   s  t  \}}d}tt|| }td}t||d}tdd tdd # tdd  t|s1J W d    n1 s;w   Y  W d    n1 sJw   Y  tdd# tdd t|saJ W d    n1 skw   Y  W d    n1 szw   Y  tt|| }t||d}tdd) tdd  t|sJ t|sJ W d    n1 sw   Y  W d    n1 sw   Y  tdd # tdd t|sJ W d    n1 sw   Y  W d    n1 sw   Y  W d    d S W d    d S 1 sw   Y  d S )	Ng?rq   r   r   Tr   r   r   )r   rx   intr	   r   ra   rS   rX   )rl   r   r   facr   rt   r>   r   r   r   test_auto_detect  sH   
$z(TestDataFrameFormatting.test_auto_detectc           
   	   C   s   t  }dgd }tj|td}td|i}|jd|d t| tg d}ttj	
t||}t|d}t|d }|d	d  D ]"}z	|td
}W n	 tyX   Y nw |dsft||ksfJ qDtj}	zd t_t| W |	t_d S |	t_w )Nr   rq   dtypeunicode)	col_spacer#   )abcu   σaaegdvgr9   r   rp   zdisplay.encodingdtype:)r   rI   rJ   objectr	   	to_stringr<   r
   r   r   r   rD   r3   decoder   AttributeErrorr=   sysstdin)
rl   r#   unicode_valuesr>   r   serrsline_lenr`   _stdinr   r   r   test_to_string_repr_unicode9  s0   


z3TestDataFrameFormatting.test_to_string_repr_unicodec                 C   s>  t g dg ddg dd}d}t||ksJ t g dg ddg dd}d}t||ks2J t g dg ddg dd}d	}t||ksKJ t g dg dd
g dd}d}t||ksdJ t g dg ddg dd}d}t||ks}J t g dg ddtg dddd}d}t||ksJ t g dg ddtg dddd}d}t||ksJ tg d}t g dg dd|d}d}t||ksJ tdddd8 t g dg dg dg ddg dd }d!}t||ksJ g d"|_d#}t||ksJ W d    d S 1 sw   Y  d S )$N   あ	   いいい   う   ええええええrp      i5  r   r   r   r   bbr   dddrt   ut             a      b
a         あ      1
bb      いいい    222
c         う  33333
ddd  ええええええ      4ut            a       b
a        1       あ
bb     222     いいい
c    33333       う
ddd      4  ええええええ   あああああ   いr!  	   えええu            a       b
a    あああああ       あ
bb       い     いいい
c        う       う
ddd    えええ  ええええええr   r+  u~             b  あああああ
a         あ      1
bb      いいい    222
c         う  33333
ddd  ええええええ      4	   あああu   いいいいいい   うう   えu               a       b
あああ     あああああ       あ
いいいいいい      い     いいい
うう          う       う
え         えええ  ええええええr  r,  r1  r2     おおおおnameu             a       b
おおおお               
あ     あああああ       あ
い         い     いいい
うう        う       う
え       えええ  ええええええr0  r,  r!  u   えええええr  r   r!  u   ええr0  u   いいいいいr  r   r1  r2     おu          あああ いいいいい
お               
あ      あああ     あ
いいい      い   いいい
うう       う     う
え    えええええ    ええ)r     いい)r!  r2  )u	   おおおu   かかかか)u   きu   くくu                 a       b
あ   いい    あああああ       あ
う   え         い     いいい
おおお かかかか      う       う
き   くく      えええ  ええええええr   r   r   r;  u   かu	   きききu   くくくくくくu   さu   しu   すu   せr   r   r   u   ああああrs   u           a  ... ああああ
0   あああああ  ...    さ
..    ...  ...  ...
3     えええ  ...    せ

[4 rows x 4 columns]r0     いいいいr!  aaau            a  ... ああああ
あああ  あああああ  ...    さ
..     ...  ...  ...
aaa    えええ  ...    せ

[4 rows x 4 columns])r	   r<   r
   r   r   r   rt   rl   r>   r*   r   r   r   r   test_east_asian_unicode_falseX  s   
$z5TestDataFrameFormatting.test_east_asian_unicode_falsec              	   C   s  t dd@ tg dg ddg dd}d}t||ks J tg dg ddg dd}d	}t||ks9J tg d
g ddg dd}d}t||ksRJ tg dg ddg dd}d}t||kskJ tg d
g ddg dd}d}t||ksJ tg d
g ddtg dddd}d}t||ksJ tg dg ddtg dddd}d}t||ksJ tg d}tg d
g dd|d}d}t||ksJ t dddd8 tg d
g dg dg d d!g d!d"}d#}t||ksJ g d$|_d%}t||ksJ W d    n	1 sw   Y  tg d&g ddg d'd}d(}t||ks>J W d    d S 1 sJw   Y  d S ))N display.unicode.east_asian_widthTr  r#  r%  r&  r)  u                   a      b
a              あ      1
bb         いいい    222
c              う  33333
ddd  ええええええ      4u            a             b
a        1            あ
bb     222        いいい
c    33333            う
ddd      4  ええええええr*  u                 a             b
a    あああああ            あ
bb           い        いいい
c            う            う
ddd      えええ  ええええええr.  u                   b  あああああ
a              あ           1
bb         いいい         222
c              う       33333
ddd  ええええええ           4r/  u                          a             b
あああ        あああああ            あ
いいいいいい          い        いいい
うう                  う            う
え                えええ  ええええええr3  r4  r5  u                      a             b
おおおお                          
あ        あああああ            あ
い                い        いいい
うう              う            う
え            えええ  ええええええr7  r8  r9  r:  r;  u               あああ いいいいい
お                           
あ          あああ         あ
いいい          い     いいい
うう            う         う
え      えええええ       ええr<  u                             a             b
あ     いい      あああああ            あ
う     え                い        いいい
おおお かかかか          う            う
き     くく          えええ  ええええええr   r   r   r>  r?  r@  rA  u                a  ... ああああ
0   あああああ  ...       さ
..         ...  ...      ...
3       えええ  ...       せ

[4 rows x 4 columns]rB  u                    a  ... ああああ
あああ  あああああ  ...       さ
...            ...  ...      ...
aaa         えええ  ...       せ

[4 rows x 4 columns])r  r      ¡¡r"  )r   r'  r   u   ¡¡¡u                   b  あああああ
a              あ           1
bb         いいい         222
c              ¡¡       33333
¡¡¡  ええええええ           4)r   r	   r<   r
   r   r   rt   rE  r   r   r   test_east_asian_unicode_true  s   
  $z4TestDataFrameFormatting.test_east_asian_unicode_truec                 C   sP   t  }tdttdi}tdtg di}t||d t||d |  d S )N   c/σr  rp   r   r   )file)r   r	   r   r  printr)   )rl   r#   emptynonemptyr   r   r   !test_to_string_buffer_all_unicode  s   z9TestDataFrameFormatting.test_to_string_buffer_all_unicodec                 C   s   t tjjdd}t|jdddd }t|jdddd }t|jdddd }||  k r;|k s>J  J |jdd}| d }|jdd	d
}t|t|ks[J d S )N)rp   r   sizerq   r  r9   rp   ro   r   F)r  header)r	   rI   r   rD   r  r3   rK   )rl   r>   c10c20c30with_headerwith_header_row1	no_headerr   r   r   test_to_string_with_col_space  s   z5TestDataFrameFormatting.test_to_string_with_col_spacec                 C   s   t tjjddg dd}d}tjt|d |jddgd	 W d    n1 s)w   Y  tjt|d |jg d
d	 W d    n1 sHw   Y  d}tjt|d |jddddd	 W d    d S 1 slw   Y  d S )Nr   r   rQ  r  rA  zGCol_space length\(\d+\) should match DataFrame number of columns\(\d+\)r}   r   r   rS  )r   r   2   <   zunknown columnr      "   )r   r   r   )r	   rI   r   r   r   r   r  )rl   r>   msgr   r   r   4test_to_string_with_column_specific_col_space_raises  s   "zLTestDataFrameFormatting.test_to_string_with_column_specific_col_space_raisesc                 C   sv   t tjjddg dd}|jddddd}t|d	d
 dks$J |jg dd}t|d	d
 dks9J d S )Nr\  rQ  r  rA  rq      r   rS  r9   rp   %   )rq   rc  r   )r	   rI   r   r  rD   r3   rl   r>   r,   r   r   r   -test_to_string_with_column_specific_col_space  s
   zETestDataFrameFormatting.test_to_string_with_column_specific_col_spacert   hrq   ro   wc              	   C   sF  t dd t||t|d}t dd |dkr"t|s!J nt|r(J W d    n1 s2w   Y  t dd |dkrHt|sGJ nt|rNJ W d    n1 sXw   Y  t dddd |dkrt|dkrtt|ssJ nt|rzJ W d    n1 sw   Y  W d    d S W d    d S 1 sw   Y  d S )Nr   Fr   r      ro   r   )r   r	   ri   makeStringIndexrX   rS   r]   )rl   rt   rg  rh  r>   r   r   r   test_to_string_truncate_indices  s.   "z7TestDataFrameFormatting.test_to_string_truncate_indicesc                 C   s\   g dg dg}t ||d}tdddd t|sJ W d    d S 1 s'w   Y  d S )Nr  r  bazrm  r   r   quxrn  onetworp  rq  rp  rq  rp  rq  r   r   r   r   )r	   r   r]   )rl   arraysr>   r   r   r   "test_to_string_truncate_multilevel  s   "z:TestDataFrameFormatting.test_to_string_truncate_multilevelc                 C   s   dd l }t| dddgd | dddg | dddgd  }tdd	 t|}d
|v s2J W d    n1 s<w   Y  tddgd gd  i}tdd	dd t|}d|v s_J d|vseJ W d    d S 1 spw   Y  d S )Nr     rp   rq   i  r   r   r   r   r  textz
some wordsr   r   NoneNaN)r   r   r   r!   r	   )rl   r   sr,   r>   r   r   r   #test_truncate_with_different_dtypes  s$   "z;TestDataFrameFormatting.test_truncate_with_different_dtypesc                 C   sT   t dtdi}tj|gdgddgd}t|}t|jd d }||s(J d S )NValsr   Sweepr
   )keysnamesrc   )r	   rx   pdconcatr<   rz   r=   )rl   r>   framer,   result2r   r   r   .test_truncate_with_different_dtypes_multiindex  s
   zFTestDataFrameFormatting.test_truncate_with_different_dtypes_multiindexc                 C   s  t dtddgtgd  i}tdd$ t|}d|v s!J d|v s'J d|v s-J d	|v s3J W d    n1 s=w   Y  td
ddgd tgd  }t |g dd}tdd d}t||ksiJ W d    n1 ssw   Y  tgd td
ddgd  }t |g dd}tdd d}t||ksJ W d    n1 sw   Y  td
ddgd td
ddgd  }t |g dd}tdd d}t||ksJ W d    d S 1 sw   Y  d S )Ndate20130101UTCrc   r   2013-01-01 00:00:00+00:00r   rH   z[6 rows x 1 columns]
2011-01-01z
US/Eastern)tz)
rp   r   r   r   rc   rC   r   r   r   rq   )dtxz                          dt   x
0  2011-01-01 00:00:00-05:00   1
1  2011-01-01 00:00:00-05:00   2
..                       ...  ..
8                        NaT   9
9                        NaT  10

[10 rows x 2 columns]z                          dt   x
0                        NaT   1
1                        NaT   2
..                       ...  ..
8  2011-01-01 00:00:00-05:00   9
9  2011-01-01 00:00:00-05:00  10

[10 rows x 2 columns]z
Asia/Tokyoz                           dt   x
0   2011-01-01 00:00:00+09:00   1
1   2011-01-01 00:00:00+09:00   2
..                        ...  ..
8   2011-01-01 00:00:00-05:00   9
9   2011-01-01 00:00:00-05:00  10

[10 rows x 2 columns])r	   r   tz_localizer   r   r!   r<   )rl   r>   r,   dtsr*   r   r   r   test_datetimelike_frame  sB   "		
	"z/TestDataFrameFormatting.test_datetimelike_frame
start_datez2017-01-01 23:59:59.999999999z2017-01-01 23:59:59.99999999z2017-01-01 23:59:59.9999999z2017-01-01 23:59:59.999999z2017-01-01 23:59:59.99999z2017-01-01 23:59:59.9999c                 C   sf   t dt|dddi}t|}||v sJ t|ddd}t dtdi|d}t|j}||v s1J d S )Nr   Drc   startfreqperiodsr)  )r	   r   r!   rx   rt   )rl   r  r>   r,   dtir   r   r    test_datetimeindex_highprecision;  s   
z8TestDataFrameFormatting.test_datetimeindex_highprecisionc                 C   sF   t ddgddgg}| }|d}t|d t|d ks!J d S )Nu
   aaÃ¤Ã¤rp   bbbbr   r9   )r	   r  r3   rD   )rl   r>   rep_strlinesr   r   r   "test_nonunicode_nonascii_alignmentS  s   
 z:TestDataFrameFormatting.test_nonunicode_nonascii_alignmentc                 C   s&   t dtdtjii}t|  d S )NrJ  test)r	   r   rI   ry   r!   r  )rl   dmr   r   r   &test_unicode_problem_decoding_as_asciiY  s   z>TestDataFrameFormatting.test_unicode_problem_decoding_as_asciic                 C   s4   |dddd}t |d dd}t| t|d  d S )Nioparserr   zunicode_series.csvlatin1)rT  r%   rp   )r   r<   )rl   datapathfilepathr>   r   r   r   test_string_repr_encoding]  s   z1TestDataFrameFormatting.test_string_repr_encodingc                 C   s"   t dtj tjgi}t| d S )Nr   )r	   rI   infr<   r   r   r   r   test_repr_cornerc  s   z(TestDataFrameFormatting.test_repr_cornerc                 C   sF   ddg}t dd tg d|d}t| t|j t dd d S )Nz'Til There Was You (1997)zldum klaka (Cold Fever) (1994)r   rp   r  rr      )rg   r   r	   r<   r   )rl   rt   r>   r   r   r   test_frame_info_encodingh  s   
z0TestDataFrameFormatting.test_frame_info_encodingc              	   C   s8  t dddddd td}ttjdd|d fd	}t d
d t|}W d    n1 s/w   Y  d|d  d|v s@J t d
d t|}W d    n1 sTw   Y  ||ks_J t dd t|}t|t|k ssJ W d    n1 s}w   Y  W d    d S W d    d S 1 sw   Y  d S )Nr   Tr   r   ro      rq   rp   rQ  r   Fz
10 rows x z columnsr   x   )r   r   r	   ri   rands_arrayr<   rD   rl   max_colsr>   r  	wide_repr
wider_reprr   r   r   test_wide_reprp  s2   

"z&TestDataFrameFormatting.test_wide_reprc                 C   sj   t dddd$ ttjddg dd}t|}t| dks#J W d    d S 1 s.w   Y  d S )	Nr   Tr   ro   rc   r   )ZaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaZbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbZccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccrA  )r   r	   rI   r   r   r<   rD   rK   )rl   r>   r  r   r   r   test_wide_repr_wide_columns  s   "z3TestDataFrameFormatting.test_wide_repr_wide_columnsc              	   C   s8  t dddd td}ttjdd|d fd}d	|j_t d
d t|}W d    n1 s1w   Y  t d
d t|}W d    n1 sJw   Y  ||ksUJ t dd t|}t|t|k siJ W d    n1 ssw   Y  |	 dd d D ]}d	|v sJ qW d    d S 1 sw   Y  d S )Nr   Tr   ro   r  rq   rp   rQ  zDataFrame Indexr   Fr         )
r   r   r	   ri   r  rt   r6  r<   rD   rK   )rl   r  r>   r  r  r  r`   r   r   r   test_wide_repr_named  s&   

"z,TestDataFrameFormatting.test_wide_repr_namedc              	   C   sT  t dddd ttjddd}td}ttjdd	|d
 fd|d}ddg|j_t dd t	|}W d    n1 s?w   Y  t dd t	|}W d    n1 sXw   Y  ||kscJ t dd t	|}t
|t
|k swJ W d    n1 sw   Y  | d
d d D ]}d|v sJ qW d    d S 1 sw   Y  d S )Nr   Tr   ro   rc   r   rq   rQ  r  rq   rp   r)  Level 0Level 1r   Fr   r  r  zLevel 0 Level 1)r   r   from_arraysri   r  r   r	   rt   r}  r<   rD   rK   )rl   midxr  r>   r  r  r  r`   r   r   r   test_wide_repr_multiindex  s(   

"z1TestDataFrameFormatting.test_wide_repr_multiindexc              	   C   sP  t ddddq td}ttjddd}ttjdd	|d
 fd}ttdd|d
 f||d}ddg|j_t dd t	|}W d    n1 sMw   Y  t dd t	|}W d    n1 sfw   Y  ||ksqJ W d    n1 s{w   Y  t dddd t	|}t
|t
|k sJ W d    d S 1 sw   Y  d S )Nr   Tr   ro   rc   r  rQ  r   r   rp   r  rq   r   r  r  r   Fr   r  )r   r   r   r  ri   r  r	   rt   r}  r<   rD   )rl   r  r  mcolsr>   r  r  r  r   r   r   test_wide_repr_multiindex_cols  s(   

"z6TestDataFrameFormatting.test_wide_repr_multiindex_colsc              	   C   s  t dddd{ d}ttjdd|d fd}t d	d
 t|}W d    n1 s+w   Y  t d	d t|}W d    n1 sDw   Y  ||ksOJ t dd t|}t|t|k scJ W d    n1 smw   Y  W d    d S W d    d S 1 sw   Y  d S )Nr   Tr   ro   r  rq   rp   rQ  r   Fr   r  )r   r	   ri   r  r<   rD   r  r   r   r   test_wide_repr_unicode  s"   

	"z.TestDataFrameFormatting.test_wide_repr_unicodec                 C   sf   t dd$ tddgddgd}t|}d|v sJ d	|v s!J W d    d S 1 s,w   Y  d S )
Nr   TaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbFccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccPddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddr%  cccccddddd)r   r	   r<   re  r   r   r    test_wide_repr_wide_long_columns  s   "z8TestDataFrameFormatting.test_wide_repr_wide_long_columnsc                 C   s\   d}t tjdd|dd t|D dd}dd l}t|}t|d	|}|d
ks,J d S )Nr   ir]  c                 S   s   g | ]}d |dqS )rx  04dr   r   r  r   r   r   r         z<TestDataFrameFormatting.test_long_series.<locals>.<listcomp>int64rt   r  r   r  rp   )	r   rI   r   r   rx   rT   r!   rD   findall)rl   r   rx  rT   str_repnmatchesr   r   r   test_long_series  s   z(TestDataFrameFormatting.test_long_seriesc                 C   s~  t dddtjddddddddd	}|g d
}| }d}||ks)J |d}| }d}||ks:J |ddgjddd}| }d}||ksRJ | }tj|jd d df< |d}| }d}||ksqJ | }tj|jd d df< |ddg}| }d}||ksJ t tjddtjddtjdddddd	}|g d
}| }d}||ksJ d S )N1a39h4)r   rp   d6778d79d{   @   )id1id2id3r   )r  r  r  zK             value
id1 id2 id3       
1a3 NaN 78d    123
9h4 d67 79d     64r  zS     id1  id3  value
id2                 
NaN  1a3  78d    123
d67  9h4  79d     64r  r  T)appendzS     id1  id3  value
id2                 
NaN  1a3  78d    123
NaN  9h4  79d     64zO         id1  value
id2 id3            
NaN 78d  1a3    123
    79d  9h4     64zK             value
id1 id2 id3       
NaN NaN NaN    123
9h4 d67 79d     64)r	   rI   ry   r  r  copyrf   )rl   r>   yr,   r*   r   r   r   r   test_index_with_nan  s`   






	z+TestDataFrameFormatting.test_index_with_nanc                 C   s  t tjdtddtdd}tj|jd ddf< tj|jd ddf< |	 }t
 }|j	|d}|d u s:J | |ksBJ t|tsIJ |j	ddgdd	jd
}|d}|d   }ddd |dd  D }tt
||d dd}	t|	d |d  |	d  |d  ksJ t|	d  |d   dk  sJ |j	dgdd}|dd   }dg}
||
ksJ |j	ddgddd id |j	ddgtd |j	ddgdtd
 t tdd}|	  d S )Nr  r   r)  ro   r   r   r#      z%.5f)rs   r  float_formatr9   r   c                 S   s   g | ]}t d d| qS )z\s+ )rT   substripr  r   r   r   r   R      z:TestDataFrameFormatting.test_to_string.<locals>.<listcomp>rp   r  )r}  rT  sepr   )rs   r  c                 S      | dS )Nz.1fr   r  r   r   r   r   `      z8TestDataFrameFormatting.test_to_string.<locals>.<lambda>)rs   
formatters)rs   r  r   )r	   rI   r   r   ri   rj  arangery   rf   r  r   r)   r    r!   __mod__r3   r  joinr   r   countabsdropnaall)rl   biggierx  r#   retvalr,   r  rT  joinedreconsr*   r  r   r   r   test_to_string9  s>   
*z&TestDataFrameFormatting.test_to_stringc                 C   s6   t g dg dd}|jdd}d}||ksJ d S )NrK  r   rc   rC   r  r  FrT  z0  1  4
1  2  5
2  3  6r	   r  rl   r>   df_sr*   r   r   r   test_to_string_no_headerh  s   z0TestDataFrameFormatting.test_to_string_no_headerc                 C   s|   t g dg dd}|jddgd}d}||ksJ d}tjt|d	 |jdgd W d    d S 1 s7w   Y  d S )
NrK  r  r  XYr  z   X  Y
0  1  4
1  2  5
2  3  6z Writing 2 cols but got 1 aliasesr}   )r	   r  r   r   r   )rl   r>   r  r*   ra  r   r   r   test_to_string_specified_headerp  s   "z7TestDataFrameFormatting.test_to_string_specified_headerc                 C   s`   t ddgddgddgd}|jdd	}d
}||ksJ |g d jdd	}d}||ks.J d S )Nrc     !   iAAAz   )r  r  zFr)  z  x   y   z
11  33 AAA
22 -44    )r  r  r  z   y  x   z
 33 11 AAA
-44 22    r  r  r   r   r   test_to_string_no_index|  s   z/TestDataFrameFormatting.test_to_string_no_indexc                 C   s   t g dg dd}|jddd}d}||ksJ t g dg dd}|jddd}d	}||ks4J t g d
g dd}|jddd}d}||ksNJ d S )NrK  r  r  rp   F)
line_widthrt   z, x  \
 1   
 2   
 3   

 y  
 4  
 5  
 6  )rc  r   r  z, x  \
11   
22   
33   

 y  
 4  
 5  
 6  )rc  r   i)r   rc   iz0  x  \
 11   
 22   
-33   

 y  
 4  
 5  
-6  r  r  r   r   r   "test_to_string_line_width_no_index  s   z:TestDataFrameFormatting.test_to_string_line_width_no_indexc                 C   s   t   tdddd tddddd	d
ddtjdg	i}| }t r&d}nd}||ks.J tdddgi}| }d}||ksBJ t   t	ddksNJ tdddgi}| }t r`d}nd}||kshJ d S )Ndisplay.precisionrc   display.notebook_repr_htmlFr  r   g      ?g      @gw2ЀIg    @9A    CAg'?g    .z              x
0  0.00000e+000
1  2.50000e-001
2  3.45600e+003
3  1.20000e+046
4  1.64000e+006
5  1.70000e+008
6  1.25346e+000
7  3.14159e+000
8 -1.00000e+006z             x
0  0.00000e+00
1  2.50000e-01
2  3.45600e+03
3  1.20000e+46
4  1.64000e+06
5  1.70000e+08
6  1.25346e+00
7  3.14159e+00
8 -1.00000e+06  x&1?z#          x
0  3234.000
1     0.253rC   g    eAg2U0*?z2               x
0  1.000000e+009
1  2.512000e-001z/              x
0  1.000000e+09
1  2.512000e-01)
ri   rj   rg   r   r	   rI   pir  _three_digit_expr   r  r   r   r   test_to_string_float_formatting  s:   z7TestDataFrameFormatting.test_to_string_float_formattingc                 C   sP   t ddgi}d}|jdd|ksJ t ddgi}d}|jdd|ks&J d S )	Nr  gvöE?z      x
0 0.200z%.3fr  g      Y@z    x
0 100z%.0fr  rl   r>   r*   r   r   r   *test_to_string_float_format_no_fixed_width  s   zBTestDataFrameFormatting.test_to_string_float_format_no_fixed_widthc                 C   sL   t dg di}| }t rd}nd}||ksJ |d }| }d}d S )Nr   )      ?gFFg<gavtzC               a
0  1.500000e+000
1  1.000000e-017
2 -5.500000e-007z?              a
0  1.500000e+00
1  1.000000e-17
2 -5.500000e-07r   z   0
0  0
1  0
2 -0)r	   r  r  rl   r>   r,   r*   r   r   r   !test_to_string_small_float_values  s   z9TestDataFrameFormatting.test_to_string_small_float_valuesc                 C   s:   t g d}ttd|d}| }d}||ksJ d S )N)r  r   r   r   rc   rc   r)  z)     0
1.5  0
2.0  1
3.0  2
4.0  3
5.0  4)r
   r	   rI   r  r  )rl   rt   r>   r,   r*   r   r   r   test_to_string_float_index  s
   z2TestDataFrameFormatting.test_to_string_float_indexc                 C   sX   t dd tdg di}| }d}||ksJ W d    d S 1 s%w   Y  d S )Nr  rc   r  )yV?d~	O?y:s-kM?\x?yD惒C?Zn(?y             zc                  x
0  0.44678+0.07152j
1  0.27394+0.23515j
2  0.26975+0.32506j
3 -0.00000-1.00000j)r   r	   r  r  r   r   r   'test_to_string_complex_float_formatting  s   
"z?TestDataFrameFormatting.test_to_string_complex_float_formattingc                 C   s   dg}t |}t| d S )N)z0  z#                        .gitignore z     5 u    â¢â¢â¢â¢â¢r	   r<   )rl   r   r>   r   r   r   test_to_string_ascii_error  s   z2TestDataFrameFormatting.test_to_string_ascii_errorc                 C   sD   t dg di}t|d jjtjsJ | }d}||ks J d S )Nr  )iro   r  iz    x
0 -15
1  20
2  25
3 -35)r	   
issubclassr  r   rI   integerr  )rl   r>   outputr*   r   r   r   test_to_string_int_formatting#  s
   z5TestDataFrameFormatting.test_to_string_int_formattingc                 C   sF   t tdtddtddg}|jddd id}d}||ks!J d S )	Nrc   rq   ri  	__index__c                 S   s   d|  S Nr  r   r  r   r   r   r   .  r  zHTestDataFrameFormatting.test_to_string_index_formatter.<locals>.<lambda>)r  zW    0   1   2   3   4
a   0   1   2   3   4
b   5   6   7   8   9
c  10  11  12  13  14)r	   rx   r  )rl   r>   r  xpr   r   r   test_to_string_index_formatter+  s   z6TestDataFrameFormatting.test_to_string_index_formatterc                 C   s8   t   tdddgi}|jdd}d}||ksJ d S )Nr  r
  r  left)justifyz#   x       
0  3234.000
1     0.253)ri   rj   r	   r  r  r   r   r    test_to_string_left_justify_cols9  s
   z8TestDataFrameFormatting.test_to_string_left_justify_colsc                 C   s   t   ttjddddgtjddddgd	}| }d
}||ks#J ttjddddgtjddddgd	}| }d}||ksBJ d S )Nr   x# r   r   r   foooofooooor  r   zk        A       B
0     NaN     NaN
1 -1.0000     foo
2 -2.1234   foooo
3  3.0000  fooooo
4  4.0000     bar                   @      @zY     A       B
0  NaN     NaN
1 -1.0     foo
2 -2.0   foooo
3  3.0  fooooo
4  4.0     bar)ri   rj   r	   rI   ry   r  r  r   r   r   test_to_string_format_na@  s&   z0TestDataFrameFormatting.test_to_string_format_nac                 C   s   t   ttj tjddddgtj tjddddgd	}| }d
}||ks)J ttj tjddddgtj tjddddgd	}| }d}||ksNJ d S )Nr   r$  r   r   r   r%  r&  r  r   z}        A       B
0    -inf    -inf
1     inf     inf
2 -1.0000     foo
3 -2.1234   foooo
4  3.0000  fooooo
5  4.0000     barr'  r(  r)  r*  zh     A       B
0 -inf    -inf
1  inf     inf
2 -1.0     foo
3 -2.0   foooo
4  3.0  fooooo
5  4.0     bar)ri   rj   r	   rI   r  r  r  r   r   r   test_to_string_format_inff  s&   		z1TestDataFrameFormatting.test_to_string_format_infc                 C   s,   t dg di}d}|jdd|ksJ d S )Nr   )g      @g@g@z     A
0  6,0
1  3,1
2  2,2,)decimalr  r  r   r   r   test_to_string_decimal  s   z.TestDataFrameFormatting.test_to_string_decimalc                 C   sH   t dtddtdd}|jdd}tdd	 |d
D dks"J d S )Nr  rq   ri  r   r   r   )r  c                 s   s    | ]}t |V  qd S r0   )rD   r   r`   r   r   r   	<genexpr>  s    zDTestDataFrameFormatting.test_to_string_line_width.<locals>.<genexpr>r9   )r	   rx   r  maxr3   )rl   r>   rx  r   r   r   test_to_string_line_width  s   $z1TestDataFrameFormatting.test_to_string_line_widthc                 C   s  t dtddtdd}tddddd	d
dddd
 dt|v s"J d| v s*J W d    n1 s4w   Y  tddddd	d
dddd
 dt|vsOJ d| vsWJ W d    n1 saw   Y  tddddd	d
dddd
 dt|v s|J d| v sJ W d    n1 sw   Y  tddddd	d
dddd
 dt|vsJ d| vsJ W d    d S 1 sw   Y  d S )Nr  rq   ri  r   r   r   r   r   r     r   r{   r   Tz5 rowsFr   truncate)r	   rx   r   r!   r   r   r   r   r   test_show_dimensions  sz   "z,TestDataFrameFormatting.test_show_dimensionsc                 C   s   |}|   tdddd |   tdd |   t  tddgddgg}td	d
 d|  v s8J td	d d|  vsFJ t  d S )Nr   rp   r   r  Fr   r   r   r   Tz2 rows)r   rg   r   ri   rj   r	   rk   r   r   r   test_repr_html  s   z&TestDataFrameFormatting.test_repr_htmlc                 C   sd   t ddgddgg}d| vsJ tdd d| v s J W d    d S 1 s+w   Y  d S )Nrp   r   r   r   tex2jax_ignorezdisplay.html.use_mathjaxF)r	   r   r   r   r   r   r   test_repr_html_mathjax  s
   "z.TestDataFrameFormatting.test_repr_html_mathjaxc                 C   s   d}t tjdd|d fd}tdddd d	| vsJ W d    n1 s)w   Y  t tjdd|d fd}tdddd d	| v sKJ W d    d S 1 sVw   Y  d S )
Nro   r  rq   rp   rQ  r   r^  r   rH   )r	   ri   r  r   r   )rl   r  r>   wide_dfr   r   r   test_repr_html_wide  s   "z+TestDataFrameFormatting.test_repr_html_widec                 C   s   d}t jt|d ddggddgd}ttjdd	t|fd
|d}| }d|vs-J t jtd|d  ddgfddgd}ttjdd	t|fd
|d}t	dddd d| v s`J W d    d S 1 skw   Y  d S )Nro   r   r   r  firstsecondr}  r  rq   rQ  rA  rH   rp   r   r^  r   )
r   from_productrI   r  r	   ri   r  rD   r   r   )rl   r  r  r>   reg_reprr   r   r   #test_repr_html_wide_multiindex_cols  s   "z;TestDataFrameFormatting.test_repr_html_wide_multiindex_colsc                 C   s
  t ddv td}|d }ttdd| tdd| d}| }d|vs+J td|d  |v s7J |d }ttdd| tdd| d}| }d|v sXJ td|d  |vsdJ | d|v smJ d	|v ssJ W d    d S 1 s~w   Y  d S )
Nr   r^  rp   )   r   r   r    rows 	2 columns)r   r   r	   rI   r  r   r!   rl   max_rowsrg  r>   r@  	long_reprr   r   r   test_repr_html_long  s   &&"z+TestDataFrameFormatting.test_repr_html_longc              	   C   s"  t dd td}|d }ttdd|tdd| tdd| dd}| }d	|vs4J d
d|  d|v s@J |d }ttdd|tdd| tdd| dd}| }d	|v sjJ d|vspJ | d|v syJ d|v sJ W d    d S 1 sw   Y  d S )Nr   r^  rp   irq   rB  )r   r   r   r   r   z<td>r   z</td>z<td>31</td>rC  rD  )r   r   r	   rI   linspacer  r  r   rE  r   r   r   test_repr_html_float  s:   "z,TestDataFrameFormatting.test_repr_html_floatc                 C   s  d}|d }t tt|ddg}tj|ddgd}ttj	|d d|dd	gd
}t
dddd | }W d    n1 sBw   Y  d|vsMJ t tt|d ddg}tj|ddgd}ttj	|d d d|dd	gd
}| }d|v sJ d S )Nr^  r   r   r  r<  r=  r>  r   r   r   r   r   ro   rH   rp   )r   	itertoolsproductrI   r  r   r   r	   r   r   r   r   )rl   rF  max_L1tuplesr   r>   r@  rG  r   r   r   test_repr_html_long_multiindex;  s     
z6TestDataFrameFormatting.test_repr_html_long_multiindexc                    s   d}d}|d |d  }t  fddt|D }tdddd d| vs+J W d    n1 s5w   Y  |d |d  }t  fd	dt|D }tdddd d| v saJ W d    d S 1 slw   Y  d S )
Nro   r^  rp   c                       i | ]}|t d d   qS r   rI   r  r   krg  r   r   
<dictcomp>S  r  zHTestDataFrameFormatting.test_repr_html_long_and_wide.<locals>.<dictcomp>r   r   rH   c                    rP  r   rQ  rR  rT  r   r   rU  X  r  )r	   rI   r  r   r   )rl   r  rF  rh  r>   r   rT  r   test_repr_html_long_and_wideN  s   "z4TestDataFrameFormatting.test_repr_html_long_and_widec                    s  t  \}}d}dt|dd d  }|d |d  }t fddt|D }t|s/J tdd	 t|s;J W d    n1 sEw   Y  |d |d  }t fd
dt|D }t|sgJ tdd	d| t|suJ W d    d S 1 sw   Y  d S )Nr^  ro   r   r   rp   c                    rP  r   rQ  rR  rT  r   r   rU  e  r  z:TestDataFrameFormatting.test_info_repr.<locals>.<dictcomp>display.large_reprr{   c                    rP  r   rQ  rR  rT  r   r   rU  l  r  r   )	r   r2  r	   rI   r  rX   r   rB   rS   )rl   r   r   rF  r  rh  r>   r   rT  r   test_info_repr\  s"   
"z&TestDataFrameFormatting.test_info_reprc                 C   s   t tjdd}tdddddd t|sJ W d    n1 s#w   Y  tdddddd t|r8J W d    d S 1 sCw   Y  d S )	Nrq   rc   rW  r{   r   rp   ru   r   )r	   rI   r   r   r   rG   r   r   r   r   test_info_repr_max_colss  s*   
"z/TestDataFrameFormatting.test_info_repr_max_colsc                    s  d}d}|d |d  }t  fddt|D }d| vs#J tdd d| v s1J W d    n1 s;w   Y  |d |d  }t  fd	dt|D }d
| vs_J tddd| d| v soJ W d    d S 1 szw   Y  d S )Nr^  ro   rp   c                    rP  r   rQ  rR  rT  r   r   rU    r  z?TestDataFrameFormatting.test_info_repr_html.<locals>.<dictcomp>r;   rW  r{   c                    rP  r   rQ  rR  rT  r   r   rU    r  r:   r   )r	   rI   r  r   r   )rl   rF  r  rh  r>   r   rT  r   test_info_repr_html  s    "z+TestDataFrameFormatting.test_info_repr_htmlc                 C   sP   |}dd }|  }|d usJ tdddd |  }d|v s"J t  d S )Nc                   S   s   ddddiiiS )Nconfig	KernelAppparent_appnamezipython-qtconsoler   r   r   r   r   get_ipython  r\   zJTestDataFrameFormatting.test_fake_qtconsole_repr_html.<locals>.get_ipythonr   rc   r   r   class)r   rg   r   ri   rj   )rl   rm   r>   r^  repstrr   r   r   test_fake_qtconsole_repr_html  s   z5TestDataFrameFormatting.test_fake_qtconsole_repr_htmlc                 C   s&   G dd d}t | g}t| dS )z<
        If the test fails, it at least won't hang.
        c                   @   s   e Zd Zdd ZdS )zBTestDataFrameFormatting.test_pprint_pathological_object.<locals>.Ac                 S      dS )Nr   r   )rl   keyr   r   r   __getitem__     zNTestDataFrameFormatting.test_pprint_pathological_object.<locals>.A.__getitem__N)__name__
__module____qualname__rd  r   r   r   r   r     s    r   Nr  )rl   r   r>   r   r   r   test_pprint_pathological_object  s   z7TestDataFrameFormatting.test_pprint_pathological_objectc                 C   sl   g d}d}t td|idd d D ]}|drqt r)d|v s(|s(J nd|v s1|s1J d	}qd S )
Ng  J\aiBg  if Bg  
Z{Bg  Bg  ŉ*BTr   r9   r  +010+10F)r<   r	   r3   r=   r  )rl   valsr   r`   r   r   r   test_float_trim_zeros  s   "
z-TestDataFrameFormatting.test_float_trim_zeroszdata, expected3.50z0    3.50
dtype: objectg333333?z1.00z!0     1.2
1    1.00
dtype: objectz0   NaN
dtype: float64Nz0    None
dtype: objectz!0    3.50
1     NaN
dtype: object      @z 0    3.5
1    NaN
dtype: float64z+0     3.5
1     NaN
2    3.50
dtype: object)rq  Nrp  z+0     3.5
1    None
2    3.50
dtype: objectc                 C   s    t |}t|}||ksJ d S r0   )r   r<   )rl   r   r*   seriesr,   r   r   r   test_repr_str_float_truncation  s   z6TestDataFrameFormatting.test_repr_str_float_truncationzfloat_format,expectedz{:,.0f}z!0   1,000
1    test
dtype: objectz{:.4f}z)0   1000.0000
1        test
dtype: objectc                 C   sN   t ddg}td| t|}W d    n1 sw   Y  ||ks%J d S )Ng     @@r  zdisplay.float_formatr   r   r<   )rl   r  r*   r>   r,   r   r   r   $test_repr_float_format_in_object_col  s
   	
z<TestDataFrameFormatting.test_repr_float_format_in_object_colc                 C   s8   t ddddgi}| }d|v sJ d|v sJ d S )Nr   rp   r   r%  z'a': 1z'b': 2r  )rl   r>   valr   r   r   test_dict_entries  s   z)TestDataFrameFormatting.test_dict_entriesc                 C   sT   ddgddgddgg}ddg}t ||d}t |t|d}| | ks(J d S )Nr   r   r   	aaaaaaaaar   rA  )r	   r~  CategoricalIndexr  )rl   r   r   r>   df_cat_colsr   r   r   test_categorical_columns  s
   z0TestDataFrameFormatting.test_categorical_columnsc              	   C   sh   t tjddddtjdddtjdddtjd	d
dtjdddgtdd}d}t||ks2J d S )N2013-01r   Mr  r  2011-01r  
2011-02-01r  2011-03-01 09:00Hz2011-04abcd)r   r   Cz         A                 B  C
0  2013-01           2011-01  a
1  2013-02        2011-02-01  b
2  2013-03  2011-03-01 09:00  c
3  2013-04           2011-04  d)r	   r~  period_rangePeriodr   r!   )rl   r>   expr   r   r   test_period  s   z#TestDataFrameFormatting.test_periodz$length, max_rows, min_rows, expected))rq   rq   rq   rq   )rq   rq   Nrq   )rq   r   Nr   )ro   r   rq   r   )r]  r   rq   rq   )r   r^  rq   rq   )r^  r^  rq   r^  )r   r^  rq   rq   c                 C   s4   t jttj|d||d}|j}||ksJ dS )zCheck that display logic is correct.

        GH #37359

        See description here:
        https://pandas.pydata.org/docs/dev/user_guide/options.html#frequently-used-options
        r   )rF  min_rowsN)rg   DataFrameFormatterr	   rI   r   r   max_rows_fitted)rl   lengthr  rF  r*   	formatterr,   r   r   r   test_max_rows_fitted  s   z,TestDataFrameFormatting.test_max_rows_fitted)erf  rg  rh  rn   r   markparametrizer|   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r
  r  rF  rI  rP  r[  rb  rf  ri   rj  makeIntIndexmakeDateIndexmakePeriodIndexrk  rs  ry  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r#  r+  r,  r/  r3  r6  r7  r9  r;  rA  rH  rJ  rO  rV  rX  rY  rZ  ra  ri  ro  rI   ry   rs  formatru  rw  r{  r  r  r   r   r   r   rb      s   
	 
 
-# 
 $
			8
	M/1&)<





	rb   c                  C   sH   t dgd } t dgd }t g d}|d d d }| |||d}|S )Nr   r   ab)r   r  r  r  abcdeabcdefr   )oneltwolascdesc)r   )s1s2s3s4	test_sersr   r   r   gen_series_formatting4  s   r  c                   @   s  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d Z
dd Zdd Zejdg ddd Zdd Zdd Zdd Zdd  Zd!d" Zd#d$ Zd%d& Zd'd( Zd)d* Zd+d, Zd-d. Zd/d0 Zd1d2 Zd3d4 Zd5d6 Zd7d8 Z d9d: Z!d;d< Z"d=d> Z#d?d@ Z$dAS )BTestSeriesFormattingc                 C   s6   t dgd }t| t dgd }d|_t| d S )Nr   rq   u   אr   title1)r   r<   r6  )rl   rx  r   r   r   r   test_repr_unicode>  s
   z&TestSeriesFormatting.test_repr_unicodec           	         s  t  }t }| }|j|d}|d u sJ |  |ks!J dj |j d}dd |dd d D } fdd|D }||ksGJ |d d	  }|d
ksUJ |d d	 jd	d}|d
kseJ | }d|_	|jdddd}|dd  }|dt
| dksJ d S )Nr  z%.4fr  c                 S   s   g | ]}|  d  qS r   )r3   r  r   r   r   r   S  r  z7TestSeriesFormatting.test_to_string.<locals>.<listcomp>r9   r   c                    s   g | ]} |qS r   r   r  r  r   r   r   T  r   r   zSeries([], Freq: B))r  r   T)r  r6  r  zFreq: B, Name: foo, Length: z, dtype: float64)ri   makeTimeSeriesr   r  r)   r  r  r3   r  r6  rD   )	rl   tsr#   rx  r  r,   r*   cp	last_liner   r  r   r  F  s(   z#TestSeriesFormatting.test_to_stringc                 C   s6   t tjdtddddd}t|}d|v sJ d S )Nrq   z1/1/2000r  r   rt   r6  zFreq: D, Name: 0)r   rI   r   r   r   r<   )rl   rx  r,   r   r   r   test_freq_name_separatione  s
   z.TestSeriesFormatting.test_freq_name_separationc                 C   s|   t dtjddg}| }d}||ksJ t dtjddg}| }d}||ks*J t g d}| }d	}||ks<J d S )
Nr   gGzg=
ףp=@z'0     foo
1     NaN
2   -1.23
3    4.56r  rm  z#0    foo
1    NaN
2    bar
3    baz)r   rc   r  rm  z#0    foo
1      5
2    bar
3    bazr   rI   ry   r  rl   rx  r,   r*   r   r   r   test_to_string_mixedm  s   z)TestSeriesFormatting.test_to_string_mixedc                 C   s8   t g d}tj|d d d< | }d}||ksJ d S )N)g        ghs?g       @g      r*  r   z;0       NaN
1    1.5678
2       NaN
3   -3.0000
4       NaNr  r  r   r   r   test_to_string_float_na_spacing~  s   z4TestSeriesFormatting.test_to_string_float_na_spacingc                 C   s,   t g d}|jdd}d}||ksJ d S )N)rp   r   r   r   Fr)  z1
2
3
4)r   r  r  r   r   r   test_to_string_without_index  s   z1TestSeriesFormatting.test_to_string_without_indexc                 C   s*   t ddgdd}tj|dd}|  d S )Nrp   r   u
   עבריתr5  )r   rg   SeriesFormatter_get_footer)rl   rx  sfr   r   r   test_unicode_name_in_footer  s   z0TestSeriesFormatting.test_unicode_name_in_footerc              	   C   s  t g dg dd}d}t||ksJ t g dg dd}d}t||ks(J t g dg dd}d}t||ks<J t g dg dd	d
}d}t||ksQJ tg d}t g d|d}d}t||ksjJ t g dddtjdgd}d}t||ksJ t g dddtddgd}d}t||ksJ tdd) t g dd	d}d}t||ksJ g d|_d}t||ksJ W d    n1 sw   Y  tdd t g dg dd}d}t||ksJ t g dg dd}d}t||ksJ t g dg dd}d}t||ksJ t g dg dd	d
}d}t||ks(J tg d}t g d|d}d }t||ksBJ t g dddtjdgd}d!}t||ksZJ t g dddtddgd}d"}t||kssJ tdd+ t g dd	d}d#}t||ksJ g d|_d$}t||ksJ W d    n	1 sw   Y  t g d%g d&d}d'}t||ksJ W d    d S 1 sw   Y  d S )(N)r   r'  CCCr  )r  r=  	   ううう   ええええr)  uQ   あ         a
いい       bb
ううう     CCC
ええええ      D
dtype: objectr&  uQ   a         あ
bb       いい
c       ううう
ddd    ええええ
dtype: object)   ああrC  r!  r-  ui   ああ         あ
いいいい      いい
う        ううう
えええ     ええええ
dtype: objectu   おおおおおおおr  u   ああ         あ
いいいい      いい
う        ううう
えええ     ええええ
Name: おおおおおおお, dtype: objectr<  )rp   r   i  i  uv   あ    いい          1
う    え          22
おおお  かかかか     3333
き    くく      44444
dtype: int64rp   ABr0  uF   1          1
AB        22
NaN     3333
あああ    44444
dtype: int64r  u   1                          1
AB                        22
2011-01-01 00:00:00     3333
あああ                    44444
dtype: int64r   r   r5  u]   0       あ
     ... 
3    ええええ
Name: おおおおおおお, Length: 4, dtype: objectum   ああ        あ
       ... 
えええ    ええええ
Name: おおおおおおお, Length: 4, dtype: objectrG  TuW   あ            a
いい         bb
ううう      CCC
ええええ      D
dtype: objectuW   a            あ
bb         いい
c        ううう
ddd    ええええ
dtype: objectuu   ああ              あ
いいいい        いい
う            ううう
えええ      ええええ
dtype: objectu   ああ              あ
いいいい        いい
う            ううう
えええ      ええええ
Name: おおおおおおお, dtype: objectu   あ      いい            1
う      え             22
おおお  かかかか     3333
き      くく        44444
dtype: int64uO   1             1
AB           22
NaN        3333
あああ    44444
dtype: int64u   1                          1
AB                        22
2011-01-01 00:00:00     3333
あああ                 44444
dtype: int64ud   0          あ
       ...   
3    ええええ
Name: おおおおおおお, Length: 4, dtype: objectux   ああ            あ
            ...   
えええ    ええええ
Name: おおおおおおお, Length: 4, dtype: object)rH  u   い¡¡r  r  )r  u   ¡¡¡¡いいrH  r-  uz   ああ              ¡¡
¡¡¡¡いい        い¡¡
¡¡            ううう
えええ      ええええ
dtype: object)	r   r<   r   r   rI   ry   r   r   rt   )rl   rx  r*   r   r   r   r   test_east_asian_unicode_series  s   

$z3TestSeriesFormatting.test_east_asian_unicode_seriesc                 C   sP   g d}t t|dD ]}|drqt rd|v sJ qd|v s%J qd S )Nrj  r9   r  rl  rm  )r<   r   r3   r=   r  )rl   rn  r`   r   r   r   ro  W	  s   
z*TestSeriesFormatting.test_float_trim_zerosc                 C   s|   t ddd}td|d}| }d|v sJ tdtdtgd}t||g}| }d	|v s1J t|j}d	|v s<J d S )
N20130102rC   r  rp   r)  
2013-01-02r   20130111r   )	r   r   r  r   r   r~  r  r!   rt   )rl   rt   rx  r,   r  r   r   r   test_datetimeindexg	  s   
z'TestSeriesFormatting.test_datetimeindexr  r  c                 C   sZ   t t|ddd}t|}||v sJ t|ddd}t d|d}t|j}||v s+J d S )Nr  rc   r  r   r)  )r   r   r!   rt   )rl   r  r  r,   r  r  r   r   r   r  x	  s   
z5TestSeriesFormatting.test_datetimeindex_highprecisionc           	   	   C   s  ddl m }m} ttjddgdd  ttddd	d
}||d }| }d|v s/J d|vs5J d|v s;J t|dddddgd }|| }| }d|v sVJ t|ddddgd }|| }| }d|v spJ d|v svJ t|dddddgd }|| }| }d|v sJ d|v sJ t|dddddddgd }|| }| }d|v sJ d|v sJ |ddd}ttddd	d
| }|| }| }d|v sJ |dd}ttddd	d
| }|| }| }d|v sJ ttj	ddd}| }|d ksJ d S )!Nr   )r   	timedeltaiL  ro   ztimedelta64[ns]r  z2012-1-1r   r  r~  rp   1 days00:00:00r   rt  r  )microsecondz-1 days +23:59:59.999850z-1 days +23:00:00z1 days 23:00:00z-1 days +22:59:00z1 days 22:59:00z-1 days +22:58:59.999850z0 days 22:58:59.999850rc   )minutessecondsz-1 days +23:54:57i&  )microsecondsz2012-01-01 23:59:59.999450r  z 0   1 days
1   2 days
2   3 days)
r   r  r   rI   rJ   r  r   shiftr~  timedelta_range)	rl   r   r  rx  r  r,   otdr  r   r   r   test_timedelta64	  sP   
z%TestSeriesFormatting.test_timedelta64c                 C   sD   t ddgddgd}t|j|d< t|jd }d|v s J d S )Nrp   r   z
2012-01-01z
2012-01-02r   r   r   )r	   r~  to_datetimer   r<   rf   re  r   r   r   test_mixed_datetime64	  s   z*TestSeriesFormatting.test_mixed_datetime64c                 C   s   t jdddd}ttjddd|d}d}t||ksJ t|}d	}t||ks+J tt jd
ddt jdddt jdddg}d}t||ksKJ d S )Nr|  rC   r}  r~  r  r  r)  zc2013-01    0
2013-02    1
2013-03    2
2013-04    3
2013-05    4
2013-06    5
Freq: M, dtype: int64z^0    2013-01
1    2013-02
2    2013-03
3    2013-04
4    2013-05
5    2013-06
dtype: period[M]r  r  r  r  r  r  zO0             2011-01
1          2011-02-01
2    2011-03-01 09:00
dtype: object)r~  r  r   rI   r  r!   r  )rl   rt   rx  r  r   r   r   r  	  s$   		z TestSeriesFormatting.test_periodc                 C   s  g dg dg}t t| }tj|ddgd}ttjd|d}tdd	 t	t
|d
d	ks4J W d    n1 s>w   Y  tdd t	t
|d
dksVJ W d    n1 s`w   Y  tdd t	t
|d
dksxJ W d    n1 sw   Y  tdd t	t
|d
dksJ W d    n1 sw   Y  tdd t	t
|d
d	ksJ W d    n1 sw   Y  ttjdd }tdd	 t	t
|d
dksJ W d    n1 sw   Y  tdd t	t
|d
dks
J W d    n	1 sw   Y  tdd t	t
|d
dks.J W d    n	1 s9w   Y  tdd t	t
|d
dksRJ W d    n	1 s]w   Y  tdd t	t
|d
dksvJ W d    d S 1 sw   Y  d S )Nrl  ro  r<  r=  r>  r   r)  r   rq   r9   r   rc   r   rp   r   r   r   )r   r   r   r   r   rI   r   r   r   rD   r!   r3   )rl   rr  rN  rt   rx  r   r   r   test_max_multi_index_display	  sJ   $z1TestSeriesFormatting.test_max_multi_index_displayc                 C   sZ   t g dd }tdddd t|}W d    n1 sw   Y  d}||ks+J d S )N)rp   rp   rp   rp   rp   rp   rp   rp   rp   rp   H.?rp   rp   rq   r   r   Fz0      1.0000
1      1.0000
2      1.0000
3      1.0000
4      1.0000
        ...  
125    1.0000
126    1.0000
127    0.9999
128    1.0000
129    1.0000
dtype: float64rt  rl   rx  r   r  r   r   r   test_consistent_format'
  s   
z+TestSeriesFormatting.test_consistent_formatc                 C   s~   t dd t|}W d    n1 sw   Y  |d}dd t|dD d d }tdd |D }|d	ks=J d S )
Nr   rq   r9   c                 S   s   g | ]
}t d |s|qS )z	[^\.]*\.+)rT   rU   r0  r   r   r   r   7
  s
    z3TestSeriesFormatting.chck_ncols.<locals>.<listcomp>r   c                 S   s   h | ]}t | qS r   )rD   r  r0  r   r   r   	<setcomp>:
  r  z2TestSeriesFormatting.chck_ncols.<locals>.<setcomp>rp   )r   r<   r3   rD   )rl   rx  r   r  	ncolsizesr   r   r   
chck_ncols3
  s   

zTestSeriesFormatting.chck_ncolsc                 C   s   t  }tddddA t|d }d}||ksJ t|d }d}||ks'J t|d	 }d
}||ks5J t|d }d}||ksCJ W d    d S 1 sNw   Y  d S )Nr   r   r   Fr  z50     a
1     a
     ..
98    a
99    a
dtype: objectr  z:0     ab
1     ab
      ..
98    ab
99    ab
dtype: objectr  zI0         a
1        ab
      ...  
4     abcde
5    abcdef
dtype: objectr  zI5    abcdef
4     abcde
      ...  
1        ab
0         a
dtype: object)r  r   r<   )rl   r  r   r  r   r   r   test_format_explicit=
  s"   "z)TestSeriesFormatting.test_format_explicitc                 C   s"   t  }| D ]}| | qd S r0   )r  valuesr  )rl   r  rx  r   r   r   
test_ncolsS
  s   zTestSeriesFormatting.test_ncolsc                 C   s   t tddd}tdd t|d}W d    n1 sw   Y  ddg}|d  }||ks4J d	g}|d  }||ksCJ d S )
Nrq   r  r  r   rp   r9   0r   r   )r   rx   r   r<   r3   )rl   rx  strreprexp1res1exp2res2r   r   r   test_max_rows_eq_oneX
  s   z)TestSeriesFormatting.test_max_rows_eq_onec                 C   s   dd }t g d}tdd t|dd}W d    n1 s"w   Y  ||dks/J t g d}tdd t|dd}W d    n1 sMw   Y  ||d	ksZJ d S )
Nc                 S   s   t td|  d S )Nz[^\.]*(\.*)r   )rD   rT   rU   groups)rx  r   r   r   getndotsd
  r   z:TestSeriesFormatting.test_truncate_ndots.<locals>.getndots)r   r   r   rC   r   r   r9    )r   r   r  i  r   )r   r   r<   replace)rl   r  rx  r  r   r   r   test_truncate_ndotsc
  s   z(TestSeriesFormatting.test_truncate_ndotsc                 C   s   t td}dt|vsJ tdd dt|v sJ W d    n1 s&w   Y  tdd dt|v s9J W d    n1 sCw   Y  tdddd dt|vsXJ W d    d S 1 scw   Y  d S )Nrc   Lengthr   r   r   TFr   rx   r<   r   rl   rx  r   r   r   r6  q
  s   "z)TestSeriesFormatting.test_show_dimensionsc                 C   sF  t td}dt|vsJ t td}dt|v sJ tdddd dt|v s,J dt|vs4J W d    n1 s>w   Y  tdd	dd  d
t|v sSJ W d    n1 s]w   Y  tdddd	 d
t|vsrJ W d    n1 s|w   Y  tdd dd	 dt|vsJ W d    d S 1 sw   Y  d S )Nro   r   r   r   rq   r   r   r   r   z5      5r  r  r   r   r   r   
  s"   "z'TestSeriesFormatting.test_repr_min_rowsc                 C   sV   t tddd}d|_|jddd}d}||ksJ |jdd	d}d
}||ks)J d S )Nr   r  r  myserr   T)rF  r6  z&0      0
      ..
99    99
Name: myserF0      0
      ..
99    99)r   rx   r6  r  r  r   r   r   test_to_string_name
  s   z(TestSeriesFormatting.test_to_string_namec                 C   sP   t tddd}|jddd}d}||ksJ |jddd}d	}||ks&J d S )
Nr   r  r  r   T)rF  r  z'0      0
      ..
99    99
dtype: int64Fr  r   rx   r  r  r   r   r   test_to_string_dtype
  s   z)TestSeriesFormatting.test_to_string_dtypec                 C   s2   t tddd}|jddd}d}||ksJ d S )Nr   r  r  r   T)rF  r  z&0      0
      ..
99    99
Length: 100r  r  r   r   r   test_to_string_length
  s   z*TestSeriesFormatting.test_to_string_lengthc                 C   s4   t tdtjd}|jddd}d}||ksJ d S )Nr   r  r   r   )na_reprF  z0    foo
      ..
99   foo)r   rx   rI   float64r  r  r   r   r   test_to_string_na_rep
  s   z*TestSeriesFormatting.test_to_string_na_repc                 C   s6   t tddd}|jdd dd}d}||ksJ d S )	Nrq   r  r  c                 S   r  )Nz2.1fr   r  r   r   r   r   
  r  zBTestSeriesFormatting.test_to_string_float_format.<locals>.<lambda>r   )r  rF  z0   0.0
     ..
9   9.0r  r  r   r   r   test_to_string_float_format
  s   z0TestSeriesFormatting.test_to_string_float_formatc                 C   sX   t tddd}d|j_|jddd}d}||ksJ |jd	dd}d
}||ks*J d S )Nrq   r  r  r   Tr   )rT  rF  zfoo
0    0
    ..
9    9Fz0    0
    ..
9    9)r   rx   rt   r6  r  r  r   r   r   test_to_string_header
  s   z*TestSeriesFormatting.test_to_string_headerc                 C   sH   t dgdgdgdgdddg}|jdd	gd
}d}||ks"J d S )Nr   rp   r   r   r  r   r   r1r2r  z    r1 r2
a b      
0 1  2  3)r	   r  r  )rl   r>   r   r  r   r   r   test_to_string_multindex_header
  s   $z4TestSeriesFormatting.test_to_string_multindex_headerc                 C   s0   t g d}|jdd}d}t||sJ d S )N)r  HelloWorldr  r  Mooooor  r  Fr)  z7      
 Hello
 World
      
      
Mooooo
      
      )r   r  rT   rU   r  r   r   r   test_to_string_empty_col
  s   z-TestSeriesFormatting.test_to_string_empty_colN)%rf  rg  rh  r  r  r  r  r  r  r  r  ro  r  r   r  r  r  r  r  r  r  r  r  r  r  r  r  r6  r   r  r  r  r  r  r  r  r  r   r   r   r   r  =  sJ     @
?)(

	
r  c                   @   ,   e Zd Zdd Zdd Zdd Zdd Zd	S )
TestGenericArrayFormatterc                 C   sP   t tddg}| }t|dksJ |d dksJ |d dks&J d S )NTFr   r   z  Truerp   z Falserg   GenericArrayFormatterrI   rJ   
get_resultrD   rl   objr   r   r   r   test_1d_array
  s
   z'TestGenericArrayFormatter.test_1d_arrayc                 C   sX   t tddgddgg}| }t|dksJ |d dks"J |d dks*J d S )NTFr   r   z [True, False]rp   z [False, True]r  r  r   r   r   test_2d_array
  s
   z'TestGenericArrayFormatter.test_2d_arrayc                 C   sh   t tddgddggddgddggg}| }t|dks"J |d dks*J |d dks2J d S )NTFr   r   z [[True, True], [False, False]]rp   z [[False, True], [True, False]]r  r  r   r   r   test_3d_array
  s   $z'TestGenericArrayFormatter.test_3d_arrayc                    sV   G dd dt jjj G  fdddt jjj}t| }t|}d}||ks)J d S )Nc                   @   s$   e Zd Zedd Zedd ZdS )zCTestGenericArrayFormatter.test_2d_extension_type.<locals>.DtypeStubc                 S   s   t jS r0   )rI   ndarrayr   r   r   r   r   
     zHTestGenericArrayFormatter.test_2d_extension_type.<locals>.DtypeStub.typec                 S   rb  )N	DtypeStubr   r   r   r   r   r6  
  s   zHTestGenericArrayFormatter.test_2d_extension_type.<locals>.DtypeStub.nameN)rf  rg  rh  propertyr   r6  r   r   r   r   r  
  s
    
r  c                       s,   e Zd Zdd Zdd Ze fddZdS )zETestGenericArrayFormatter.test_2d_extension_type.<locals>.ExtTypeStubc                 S   rb  )Nr   r   r   r   r   r   __len__  re  zMTestGenericArrayFormatter.test_2d_extension_type.<locals>.ExtTypeStub.__len__c                 S   s   |dk|dkgS )Nrp   r   r   )rl   rQ   r   r   r   rd    r\   zQTestGenericArrayFormatter.test_2d_extension_type.<locals>.ExtTypeStub.__getitem__c                    s     S r0   r   r   r  r   r   r  	  r  zKTestGenericArrayFormatter.test_2d_extension_type.<locals>.ExtTypeStub.dtypeN)rf  rg  rh  r  rd  r  r  r   r	  r   r   ExtTypeStub  s
    r
  z60    [False  True]
1    [ True False]
dtype: DtypeStub)r~  api
extensionsExtensionDtypeExtensionArrayr   r<   )rl   r
  rr  r   r*   r   r	  r   test_2d_extension_type
  s   	
z0TestGenericArrayFormatter.test_2d_extension_typeN)rf  rg  rh  r  r  r  r  r   r   r   r   r  
  s
    
	r  c                   C   s   dddkS )Nr	  z.4gz1.7e+008r   r   r   r   r   r    s   r  c                	   @   sv   e Zd Zdd Zdd Zdd Zejddgd	fd
gdfdgdfddgdfg ddfgdd Z	dd Z
dd ZdS )TestFloatArrayFormatterc                 C   s2   t tjg tjd}| }t|dksJ d S )Nr  r   )rg   FloatArrayFormatterrI   rJ   r  r  rD   rl   r   r,   r   r   r   	test_misc  s   z!TestFloatArrayFormatter.test_miscc                 C   sF   t tjddgtjd}| }|d dksJ |d dks!J d S )Nr   r   r  z 12.0rp   z  0.0)rg   r  rI   rJ   r  r  r  r   r   r   test_format  s   z#TestFloatArrayFormatter.test_formatc                 C   sP   t dd tddg}d}t||ksJ W d    d S 1 s!w   Y  d S )Nr  r   g     @@g     h@z"0     840
1    4200
dtype: float64)r   r   r!   )rl   rx  expected_outputr   r   r   -test_output_display_precision_trailing_zeroes#  s
   "zETestFloatArrayFormatter.test_output_display_precision_trailing_zeroeszvalue,expectedgOe"@z	   0
0  9g\(\?z       0
0  5e-01gr%@z    0
0  11gǘ#@g333333#@z    0
0  10
1  10)gq=
ףp?g(\?gr#z#       0
0  5e-01
1  8e-01
2 -1e+01c                 C   sH   t dd t|}t||ksJ W d    d S 1 sw   Y  d S )Nr  r   r   r	   r!   )rl   r   r*   df_valuer   r   r   test_set_option_precision,  s   "z1TestFloatArrayFormatter.test_set_option_precisionc                 C   s~   t dd0 tdg di}ddddd	d
}| D ]\\}}}t||| |ks,J qW d    d S 1 s8w   Y  d S )Nr  rC   col1)g}Bz>gHz>gz>gH׊>gƠ>gƠ>g5Ǡ>gv!>g.6ư>gư>gT5eǰ>g>g$>gh㈵>gB>gTqs*>zo           col1
0  9.999000e-08
1  1.000000e-07
2  1.000100e-07
3  2.000000e-07
4  4.999000e-07
5  5.000000e-07z_           col1
1  1.000000e-07
2  1.000100e-07
3  2.000000e-07
4  4.999000e-07
5  5.000000e-07z           col1
1  1.000000e-07
2  1.000100e-07
3  2.000000e-07
4  4.999000e-07
5  5.000000e-07
6  5.000100e-07
7  6.000000e-07z            col1
8   9.999000e-07
9   1.000000e-06
10  1.000100e-06
11  2.000000e-06
12  4.999000e-06
13  5.000000e-06
14  5.000100e-06
15  6.000000e-06zg        col1
9   0.000001
10  0.000001
11  0.000002
12  0.000005
13  0.000005
14  0.000005
15  0.000006))r   rC   )rp   rC   )rp   r   )r      )r   r  )r   r	   itemsr!   )rl   r   r  r  stopvr   r   r   test_output_significant_digits?  s   	)"z6TestFloatArrayFormatter.test_output_significant_digitsc                 C   s   t dd7 tddgi}t|dksJ tddgi}t|dks$J tdddgi}t|dks4J W d    d S 1 s?w   Y  d S )	Nr  r   r  g1@z            x
0  12345.6789g    >Az           x
0  2000000.0z)            x
0  1.2346e+04
1  2.0000e+06r  r   r   r   r   test_too_long  s   "z%TestFloatArrayFormatter.test_too_longN)rf  rg  rh  r  r  r  r   r  r  r  r  r   r   r   r   r   r    s     	



	Ir  c                   @   r  )
TestRepr_timedelta64c                 C      t jddd}t jddd}t jddd}t jddd}dd	 }||d
ks(J || dks1J ||dks9J ||dksAJ ||dksIJ ||| dksSJ || | dks^J ||| dkshJ || | dkssJ d S )Nrp   r  unitr   rx  r4  msc                 S   s   |   S r0   
_repr_baser  r   r   r   r     r  z0TestRepr_timedelta64.test_none.<locals>.<lambda>r  -1 days0 days0 days 00:00:010 days 00:00:00.5000001 days 00:00:01-1 days +00:00:011 days 00:00:00.500000-1 days +00:00:00.500000r~  to_timedeltarl   delta_1ddelta_0ddelta_1sdelta_500msdreprr   r   r   	test_none     zTestRepr_timedelta64.test_nonec                 C   r"  )Nrp   r  r#  r   rx  r4  r%  c                 S      | j ddS )Nsub_dayr  r&  r  r   r   r   r         z3TestRepr_timedelta64.test_sub_day.<locals>.<lambda>r  r(  r  z00:00:01z00:00:00.500000r,  r-  r.  r/  r0  r2  r   r   r   test_sub_day  r9  z!TestRepr_timedelta64.test_sub_dayc                 C   r"  )Nrp   r  r#  r   rx  r4  r%  c                 S   r:  )Nr   r  r&  r  r   r   r   r     r<  z0TestRepr_timedelta64.test_long.<locals>.<lambda>z1 days 00:00:00z-1 days +00:00:00z0 days 00:00:00r*  r+  r,  r-  r.  r/  r0  r2  r   r   r   	test_long  r9  zTestRepr_timedelta64.test_longc                 C   s   t jddd}t jddd}t jddd}dd }||dks!J || d	ks*J ||d
ks2J ||dks:J || | dksEJ d S )Nrp   r  r#  r   nsc                 S   r:  )Nr  r  r&  r  r   r   r   r     r<  z/TestRepr_timedelta64.test_all.<locals>.<lambda>z1 days 00:00:00.000000000z-1 days +00:00:00.000000000z0 days 00:00:00.000000000z0 days 00:00:00.000000001z-1 days +00:00:00.000000001r0  )rl   r3  r4  	delta_1nsr7  r   r   r   test_all  s   zTestRepr_timedelta64.test_allN)rf  rg  rh  r8  r=  r>  rA  r   r   r   r   r!    s
    r!  c                   @   s4   e Zd Zdd Zdd Zdd Zdd Zd	d
 ZdS )TestTimedelta64Formatterc                 C   s   t jttdtg dd}tj|dd }|d  dks!J |d  d	ks+J tj|dd
 dd }|d  d	ksBJ tj|dd }|d  dksUJ |d  dks_J tj|dd
 dd }|d  dksvJ d S )Nrc   r  r#  Tboxr   '0 days'rp   z'1 days'r   Fr)  r  	r~  r1  r   rx   r   rg   Timedelta64Formatterr  r  rl   r  r,   r   r   r   	test_days  s   z"TestTimedelta64Formatter.test_daysc                 C   \   t jttdtg dd}tj| dd }|d  dks"J |d  d	ks,J d S )
Nrc   r  r#  TrC  r   rE  rp   z	'-1 days'rF  rH  r   r   r   test_days_neg     z&TestTimedelta64Formatter.test_days_negc                 C   sZ   t jttdtg dd}tj|dd }|d  dks!J |d  d	ks+J d S )
Nrc   rx  r#  TrC  r   '0 days 00:00:00'rp   z'0 days 00:00:01'rF  rl   r  r,   r   r   r   test_subdays  s   z%TestTimedelta64Formatter.test_subdaysc                 C   rJ  )
Nrc   rx  r#  TrC  r   rM  rp   z'-1 days +23:59:59'rF  rN  r   r   r   test_subdays_neg  rL  z)TestTimedelta64Formatter.test_subdays_negc                 C   s   t jttdtg dd}tj|dd }|d  dks!J t jttddd}tj|dd }|d  dks?J d S )Nrp   r  r#  TrC  r   rE  rF  rH  r   r   r   	test_zero  s   z"TestTimedelta64Formatter.test_zeroN)rf  rg  rh  rI  rK  rO  rP  rQ  r   r   r   r   rB    s    rB  c                   @   s<   e Zd Zdd Zdd Zdd Zdd Zd	d
 Zdd ZdS )TestDatetime64Formatterc                 C   sZ   t tdddtddddtg}t| }|d  dks!J |d  dks+J d S )N  rp   r   r   z2013-01-01 00:00:00z2013-01-01 12:00:00r   r   r   rg   Datetime64Formatterr  r  rH  r   r   r   
test_mixed  s    z"TestDatetime64Formatter.test_mixedc                 C   sX   t tdddtdddtg}t| }|d  dks J |d  dks*J d S )NrS  rp   r   r   z
2013-01-01r  rT  rH  r   r   r   
test_dates
  s   z"TestDatetime64Formatter.test_datesc                 C   s4   t tdg}t| }|d  dksJ d S )Nr  r   1970-01-01 00:00:00.000000200)r   r   rg   rU  r  r  rH  r   r   r   test_date_nanos  s   z'TestDatetime64Formatter.test_date_nanosc                 C   s  t tdddd}tj|jd< t| }|d  dks J |d  dks*J |d	  d
ks4J t tdddd}tj|jd< t| }|d  dksTJ |d  dks^J |d	  dkshJ t tdddd}tj|jd< t| }|d  dksJ |d  dksJ |d	  dksJ t tdddd}tj|jd< t| }|d  dksJ |d  dksJ |d	  dksJ t tdddd}tj|jd< t| }|d  dksJ |d  dksJ |d	  dksJ d S )Nz20130101 09:00:00rc   r  r~  rp   r   z2013-01-01 09:00:00r   r   z2013-01-05 09:00:00rx  z2013-01-01 09:00:04r%  z2013-01-01 09:00:00.000z2013-01-01 09:00:00.004usz2013-01-01 09:00:00.000000z2013-01-01 09:00:00.000004Nz2013-01-01 09:00:00.000000000z2013-01-01 09:00:00.000000004)	r   r   rI   ry   rz   rg   rU  r  r  rH  r   r   r   test_dates_display  s<   z*TestDatetime64Formatter.test_dates_displayc                 C   sN   t tdddtdddg}dd }tj||d}| }|ddgks%J d S )	Ni  rp   r   c                 S   
   |  dS )Nz%Y-%mstrftimer  r   r   r   format_func?     
zOTestDatetime64Formatter.test_datetime64formatter_yearmonth.<locals>.format_funcr  z2016-01z2016-02)r   r   rg   rU  r  rl   r  r`  r  r,   r   r   r   "test_datetime64formatter_yearmonth<  s
   z:TestDatetime64Formatter.test_datetime64formatter_yearmonthc                 C   sH   t tjddgdd}dd }tj||d}| }|dd	gks"J d S )
Nz10:10:10.100z12:12:12.120z%H:%M:%S.%fr  c                 S   r]  )Nz%H:%Mr^  r  r   r   r   r`  L  ra  zPTestDatetime64Formatter.test_datetime64formatter_hoursecond.<locals>.format_funcrb  z10:10z12:12)r   r~  r  rg   rU  r  rc  r   r   r   #test_datetime64formatter_hoursecondF  s   z;TestDatetime64Formatter.test_datetime64formatter_hoursecondN)	rf  rg  rh  rV  rW  rY  r\  rd  re  r   r   r   r   rR    s    '
rR  c                   @      e Zd Zdd Zdd ZdS )TestNaTFormattingc                 C      t tdksJ d S Nr   )r<   r   r   r   r   r   	test_reprU     zTestNaTFormatting.test_reprc                 C   rh  ri  )r!   r   r   r   r   r   test_strX  rk  zTestNaTFormatting.test_strN)rf  rg  rh  rj  rl  r   r   r   r   rg  T  s    rg  c                   @   s$   e Zd Zdd Zdd Zdd ZdS )TestPeriodIndexFormatc                 C   s   t jtddddd gdd}| }|d dksJ |d dks"J |d |d d ks/J |d d tju s;J t jd	d
dd}| }||d k sRJ |d d	ksZJ |d dksbJ d S )N  rp   r   r  r  r   z2003-01-01 12:00r   2003-01-01 12:01:01.123456789r   r   r~  z2003-01-01 12:01:01.123456790)	r~  PeriodIndexr   r  r_  rI   ry   r  r  rl   per	formattedr   r   r   'test_period_format_and_strftime_default]  s   z=TestPeriodIndexFormat.test_period_format_and_strftime_defaultc                 C   s   t jdddd}|jdd}|d dksJ |d	 d
ksJ t jdddd}|jdd}|d dks4J |d	 dks<J t jdddd}|jdd}|d dksRJ |d	 dksZJ d S )Nz2003-01-01 12:01:01.123r   rR   r~  z%y %I:%M:%S (ms=%l us=%u ns=%n))date_formatr   z+03 12:01:01 (ms=123 us=123000 ns=123000000)rp   z+03 12:01:01 (ms=124 us=124000 ns=124000000)z2003-01-01 12:01:01.123456uz+03 12:01:01 (ms=123 us=123456 ns=123456000)z+03 12:01:01 (ms=123 us=123457 ns=123457000)ro  r   z+03 12:01:01 (ms=123 us=123456 ns=123456789)z+03 12:01:01 (ms=123 us=123456 ns=123456790))r~  r  r  rq  r   r   r   test_period_customo  s   z(TestPeriodIndexFormat.test_period_customc                 C   s   t jdgdd}tjtdd |jdd}W d    n1 s w   Y  | d d	ks/J |d
}tjtdd |jdd}W d    n1 sLw   Y  | d dks[J d S )Nz2013-01-01 00:00:00+01:00Tutczwill drop timezoner}   r  r  r   z2012-12-31 23:00zEurope/Parisz2013-01-01 00:00)r~  r  ri   r   UserWarning	to_periodr  
tz_convert)rl   r  rr  r   r   r   test_period_tz  s   
z$TestPeriodIndexFormat.test_period_tzN)rf  rg  rh  rt  rw  r}  r   r   r   r   rm  \  s    rm  c                   @   r  )
TestDatetimeIndexFormatc                 C   s@   t tddddtg }|d dksJ |d dksJ d S )Nrn  rp   r   r   z2003-01-01 12:00:00r   r~  r  r   r   r  rl   rs  r   r   r   test_datetime  s   z%TestDatetimeIndexFormat.test_datetimec                 C   s>   t tdddtg }|d dksJ |d dksJ d S )Nrn  rp   r   z
2003-01-01r   r  r  r   r   r   	test_date  s   z!TestDatetimeIndexFormat.test_datec                 C   s^   t jtdddgdd }|d dksJ t jtdddtgdd }|d dks-J d S )NrS  rp   Trx  r   r  )r~  r  r   r  r   r  r   r   r   test_date_tz  s   z$TestDatetimeIndexFormat.test_date_tzc                 C   sD   t tdddtgjddd}|d dksJ |d dks J d S )	Nrn  r   rp   z%m-%d-%YUT)ru  r  r   z
02-01-2003r  r  r   r   r   test_date_explicit_date_format  s
   z6TestDatetimeIndexFormat.test_date_explicit_date_formatN)rf  rg  rh  r  r  r  r  r   r   r   r   r~    s
    r~  c                   @   rf  )TestDatetimeIndexUnicodec                 C   s>   t ttdddtdddg}d|v sJ d|v sJ d S )NrS  rp     z['2013-01-01',z, '2014-01-01']r!   r~  r  r   rl   ru  r   r   r   rW    s   "z#TestDatetimeIndexUnicode.test_datesc              	   C   sJ   t ttdddtddddtdddg}d|v sJ d|v s#J d S )NrS  rp   r  r   z'2013-01-01 00:00:00',z'2014-01-01 00:00:00']r  r  r   r   r   rV    s   "z#TestDatetimeIndexUnicode.test_mixedN)rf  rg  rh  rW  rV  r   r   r   r   r    s    r  c                   @   r  )
TestStringRepTimestampc                 C   s   t ddd}t|tt|ksJ t dddddd}t|tt|ks'J t ddddddd}t|tt|ks=J td}t|dksIJ td	}t|d
ksUJ d S )NrS  rp   r   r   r   -   r  rX  i  z1970-01-01 00:00:00.000001200)r   r!   r   )rl   dt_datedt_datetimedt_datetime_usts_nanos_onlyts_nanos_microsr   r   r   
test_no_tz  s   z!TestStringRepTimestamp.test_no_tzc              
   C   s   t dddtjd}t|tt|ksJ t ddddddtjd}t|tt|ks-J t dddddddtjd}t|tt|ksFJ d S NrS  rp   r   )tzinfor   r   r  )r   pytzry  r!   r   )rl   r  r  r  r   r   r   test_tz_pytz  s   z#TestStringRepTimestamp.test_tz_pytzc              
   C   s   t j }tddd|d}t|tt|ksJ tdddddd|d}t|tt|ks0J tddddddd|d}t|tt|ksHJ d S r  )dateutilr  tzutcr   r!   r   )rl   ry  r  r  r  r   r   r   test_tz_dateutil  s   
z'TestStringRepTimestamp.test_tz_dateutilc                 C   s(   t ttdfD ]
}|tdksJ qd S )N	isoformatr   )r!   r<   r   r   )rl   r+   r   r   r   test_nat_representations  s   z/TestStringRepTimestamp.test_nat_representationsN)rf  rg  rh  r  r  r  r  r   r   r   r   r    s
    
r  c                  C   sB  t g d} g d}| |ksJ t g d} g d}| |ks"J d}tjt|d t dtjdg W d    n1 s?w   Y  tjt|d t g d	 W d    n1 s]w   Y  tjt|d t g d
 W d    n1 s{w   Y  tjt|d t g d W d    d S 1 sw   Y  d S )N)g0Bx?0_^}?r   F]kSU?r  )z1.999%z2.001%50%z66.667%99.99%)r   r   r  r   r  r  )0%r  z2.0%r  z66.67%r  z1percentiles should all be in the interval \[0,1\]r}   r   r   )gMbPr   r   )r   r   r   )r   r   r   )rg   format_percentilesr   r   r   rI   ry   )r,   r*   ra  r   r   r   test_format_percentiles  s&   "r  c                  C   s,   t tddd} g d}| |ksJ d S )Nr   rp   rc  )r  z10%z20%z30%z40%r  z60%z70%z80%z90%z100%)rg   r  rI   rI  )r,   r*   r   r   r   #test_format_percentiles_integer_idx  s   r  c                 C   s"   t d}| |}|jrJ d S )Nz    from pandas import DataFrame
    df = DataFrame({"A": [1, 2]})
    df._repr_html_()

    cfg = get_ipython().config
    cfg['IPKernelApp']['parent_appname']
    df._repr_html_()
    )textwrapdedentrun_cellerror_in_exec)ipcoder,   r   r   r   test_repr_html_ipython_config  s
   
r  z.ignore:In future versions `DataFrame.to_latex`method)r  to_htmlto_latexzencoding, data)r  )zutf-8r  )gbku   造成输出中文显示乱码)r   r  c           	   	   C   s"  t |g}|dvr0|d ur0tjtdd t|| ||d W d    d S 1 s)w   Y  d S |dkr|| dkr:tnd }t|1 tjtdd t|| ||d W d    n1 s]w   Y  W d    d S W d    d S 1 suw   Y  d S t||  }t|| ||d || d S )N)r   r   z1buf is not a file name and encoding is specified.r}   )r#   r%   r   r  zunknown encoding)	r	   r   r   r   getattrr   ri   r   LookupError)	r  r$   r/   r%   r   r   r>   expected_warningr*   r   r   r   test_filepath_or_buffer_arg%  s&   
""r  zignore::FutureWarningc                 C   sJ   d}t jt|d t| |t d W d    d S 1 sw   Y  d S )Nz1buf is not a file name and it has no write methodr}   r  )r   r   	TypeErrorr  r  )rm   r  ra  r   r   r   &test_filepath_or_buffer_bad_arg_raisesE  s   "r  c                   C   s>   t jtdd tdd W d    d S 1 sw   Y  d S )Nzcolumn_space isr}   zdisplay.column_spacerc  )ri   r   r   r   r   r   r   r   test_col_space_deprecatedM  s   "r  )W__doc__r   r  r   rK  operatorr   r1   pathlibr   rT   shutilr   r  r  r  numpyrI   r   r  pandas.compatr   r   pandas.util._test_decoratorsutil_test_decoratorsr  pandasr~  r	   r
   r   r   r   r   r   r   r   r   r   r   pandas._testing_testingri   pandas.io.formats.formatformatsr  rg   pandas.io.formats.printingr   use_32bit_reprfixturer   r$   r/   r8   rB   rG   rS   rX   r[   r]   ra   r  filterwarningsrb   r  r  r  r  r  r!  rB  rR  rg  rm  r~  r  r  r  r  check_file_leaksr  r  r  r  r  r   r   r   r   <module>   s    8


	
               !	     "9~A-Q;,


