zmc
2023-08-08 e792e9a60d958b93aef96050644f369feb25d61b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
U
­ý°dã@s~ddlZddlZddlmmZddlZddl    m
Z
ddl m m mZdd„Zdd„ZGdd„dƒZGd    d
„d
ƒZdS) éN)ÚprintingcCs>dddgdddgddd    gg}d
}tjd |žŽ}||ks:t‚dS© NÚaÚbÚcÚddÚeeÚffÚgggÚhhhZiiiz a  dd  ggg
b  ee  hhh
c  ff  iiié)r ©rÚadjoinÚAssertionError)ÚdataÚexpectedÚadjoined©rú\d:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\pandas/tests/io/formats/test_printing.pyÚ test_adjoin srcCs„tj}zt|t d¡d}Wntk
r8t|ƒ}YnXt| d¡ƒ}tj    |dd}|t
|ƒksft ‚tj    |dd}||ks€t ‚dS)Nzdisplay.encoding)Úencodingzutf-8T)Z quote_stringsF) ÚstringÚ ascii_lettersÚbytesÚcfÚ
get_optionÚ    TypeErrorÚstrÚdecoderZ pprint_thingÚreprr)ÚlettersÚrawrÚresrrrÚtest_repr_binary_typesr#c@s4eZdZdd„Zdd„Zdd„Zdd„Zd    d
„Zd S) ÚTestFormattBasecCs>dddgdddgddd    gg}d
}tjd |žŽ}||ks:t‚dSrr )Úselfrrrrrrr$szTestFormattBase.test_adjoincCsdddgdddgddd    gg}d
}tjd|žŽ}||ks:t‚t ¡}d }|jd|žŽ}||ks`t‚| d ¡}| |d¡dks€t‚| |d¡dks–t‚| |d ¡dks¬t‚d}|jd|žŽ}||ksÊt‚| d ¡}| |d¡dksêt‚| |d¡dkst‚| |d ¡dkst‚dS)Nõあrrrõええr    r
r õ    ã„いいu,あ  dd  ggg
b  ãˆãˆ  hhh
c  ff  ã„いいr u2あ  dd    ggg
b   ãˆãˆ  hhh
c   ff    ã„いいÚ
ré ééuPあ       dd         ggg
b        ãˆãˆ       hhh
c        ff         ã„いいééé)r )r )r-)rrrÚfmtÚEastAsianTextAdjustmentÚsplitÚlen)r%rrrÚadjÚcolsrrrÚtest_adjoin_unicode,s&  
 
z#TestFormattBase.test_adjoin_unicodecs$t ¡‰‡fdd„}|dddddks*t‚|ddddd    ks@t‚|ddd
dd ksVt‚|dddddkslt‚|ddddd    ks‚t‚|ddd
dd ks˜t‚|d dddd ks®t‚|d dddd ksÄt‚|d dd
dd ksÚt‚|d d dddksðt‚|d d dddkst‚|d d d
ddks t‚dS)Ncsˆj|gf|ž|ŽdS)Nr)Zjustify)ÚxÚargsÚkwargs©r4rrÚjustMsz*TestFormattBase.test_justify.<locals>.justÚabcéÚleft)Úmodezabc  Úcenterz abc Úrightz  abcõ    ãƒ‘ンダé
u パンダ    u   ãƒ‘ンダ  u     ãƒ‘ンダ)r0r1r)r%r;rr:rÚ test_justifyJs zTestFormattBase.test_justifycCsxt ¡}| d¡dkst‚| d¡dks,t‚| d¡dks>t‚| d¡dksPt‚| d¡dksbt‚| d    ¡d
kstt‚dS) Nr<érBéuパンダr=uパンダpandaé uパンダpandarC)r0r1r3r)r%r4rrrÚtest_east_asian_len`sz#TestFormattBase.test_east_asian_lenc    CsŠt ¡}| d¡dkst‚t dd¡ t ¡}| d¡dksBt‚W5QRXdddgd    d
d gd dd gg}d}|jd|žŽ}||ks†t‚dS)Nu¡¡abéz!display.unicode.ambiguous_as_wideTrFr&rrrr'r    r
r(u6あ  dd    ggg 
b   ãˆãˆ  Â¡Â¡ab
c   ff    ã„いいr )r )r0r1r3rrÚoption_contextr)r%r4rrrrrrÚtest_ambiguous_widthksz$TestFormattBase.test_ambiguous_widthN)Ú__name__Ú
__module__Ú __qualname__rr6rDrHrKrrrrr$#s
 r$c@s4eZdZdd„Zdd„Zdd„Zdd„Zd    d
„Zd S) ÚTestTableSchemaReprc
Csú|j|jd}t dddgi¡}|d|g}ddhdddhg}t dd    ¡}d}t||ƒD]@\}}    |}||j |¡}
W5QRXt|
d
     ¡ƒ|    ksXt
‚qXt d d ¡} |"| |j |¡}
W5QRXW5QRXddd dh}    t|
d
     ¡ƒ|    ksöt
‚dS)N©ÚconfigÚAr+r ú
text/plainú!application/vnd.dataresource+jsonú    text/htmlúdisplay.html.table_schemaTrzstyler.render.reprZlatexz
text/latex) ÚinstancerQÚpdÚ    DataFramerJÚzipÚdisplay_formatterÚformatÚsetÚkeysr) r%ÚipZipythonÚdfZobjectsZ expected_keysÚoptZlast_objÚobjrÚ    formattedZ
with_latexrrrÚtest_publisheszs, þ    üz"TestTableSchemaRepr.test_publishesc    CsŒtj ddgdddgg¡}tjtj dt|ƒ¡|d}t dd    ¡}||j    |j
d
j   |¡}W5QRXd d h}t |d  ¡ƒ|ksˆt‚dS)NrRÚBrrrr=)ÚcolumnsrVTrPrSrUr)rXZ
MultiIndexZ from_productrYÚnpÚrandomZrandnr3rJrWrQr[r\r]r^r)r%r_Zmidxr`rarcrrrrÚtest_publishes_not_implemented˜s  z2TestTableSchemaRepr.test_publishes_not_implementedc    CsBt dddgi¡}t dd¡| ¡}W5QRX|dk    s>t‚dS)NrRr+r rVT©rXrYrJZ_repr_data_resource_r©r%r`ÚresultrrrÚtest_config_on¦sz"TestTableSchemaRepr.test_config_onc    CsBt dddgi¡}t dd¡| ¡}W5QRX|dks>t‚dS)NrRr+r rVFrjrkrrrÚtest_config_default_off­sz+TestTableSchemaRepr.test_config_default_offc    Cs®|j|jdjj}d}t dd¡ d|ks0t‚||js>t‚W5QRXd|ksTt‚||jrbt‚t dd¡6d|ks|t‚||jsŠt‚|j|jdj t    ¡W5QRXdS)NrPrTrVT)
rWrQr[Ú
formattersrXrJrZenabledr\r)r%r_roÚmimetyperrrÚ#test_enable_data_resource_formatter´s   z7TestTableSchemaRepr.test_enable_data_resource_formatterN)rLrMrNrdrirmrnrqrrrrrOys
rO)rÚnumpyrgZpandas._config.configÚ_configrQrZpandasrXZpandas.io.formatsrZpandas.io.formats.formatÚioÚformatsr\r0rr#r$rOrrrrÚ<module>s      V