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º=ãc@sœdZddlZddlZddlmZddlmmZddl    m
Z ddl m Z mZej ddddd    iifd
ddd iifd ddd    iifd ddd    iifddddiifdddd iifddddiifddddiifddddiifdddddœifdddddœifdddddœifdddddœifd dddiifd!dddiifd"ddd#dœifd$ddd%dœifd&dd'd(iifd)dd'd*iifd+dd'd,iifd-dd'd.iifd/dd'd(iifd0dd'd1iifd2dd'd3iifd4dd'd5iifd6dd'd*iifd7dd8d9iifd:dd8d9iifd;dd8d9iifd<dd8d9iifd=dd8d9iifd>dd8d9iifd?dd8d@iifdAdd8d@iifdBdd8d@iifdCdd8d@iifdDdd8d@iifdEddFd@iifdGddFd@iifdHddIdJiifdKifdLifdMddNd@iifdOdd@dJdPœifdQddNd@iifdRddSdTiifdUddSdTiifdVddSdWiifdXddYd9iifdZddYd9iifd[ddYd9iifd\ddYd9iifd]ddYd@iifd^ddYd@iifd_ddYd@iifd`ddYd@iifdaddYd@iifdbdcdTdddeœifdfdcdTdddeœifdgdcdWdddeœifdhdidjdkidjdkidjdkidjdkidlœifdmdidjdnidjdnidjdnidjdnidlœifdodidpdjdniiifdqdidpdjdniiifdrdidpdjdkiiifdsdidpdjdkiiifdtdidpdjdkiiifdudidpdjdviiifdwdidpdjdviiifdxdidpdjdyiiifdzdidpdjd{iiifd|didpdjd}iiifd~didpdjdiiifd€didpdjdiiifd‚didkdƒd„œdkdƒd„œdkdƒd„œdkdƒd„œd…œifd†didpddƒd„œiifd‡didpdkdˆd„œiifd‰didpdƒdŠd‹œiifdŒddŽdiifdddŽd‘iifd’ddŽd“iifd”ddŽd•iifd–dd—dpiifd˜dd—dpiifd™dd—diifdšdd—d›iifdœdd—d›iifdddžd9iifdŸddžd9iifd ddžd9iifd¡ddžd@iifd¢d£d¤d¥iifd¦d£d¤d§iifg]¡d¨d©„ƒZdªd«„Zej d¬d?d­dd8d@iifd­d?dd8d@iifd?dEdd@d@d®œifd¯dEddFd9iifd°d­ifd±dEddFd@iifg¡d²d³„ƒZej d´eej ¡ƒdµd¶„ej ¡Dƒd·d¸g¡d¹dº„ƒZej d»dd¼g¡d½d¾„ƒZd¿dÀ„ZejdÁd„ƒZej dÃdÄdÅgdÆfdÇdÈgdÉfdÊdËgdÌfg¡dÍd΄ƒZej dÏdÄdÅdÄggddfdÇgdÈdÇggddfdÊgdÐggddfdÇdÊgdÇdÑggddfdÇdÊgdÇdÑgdÇdÊggddfg¡dÒdӄƒZdS)ÔzmTests formatting as writer-agnostic ExcelCells
 
ExcelFormatter is tested implicitly in pandas/tests/io/excel
éN)Ú
CSSWarning)Ú CssExcelCellÚCSSToExcelConverterz css,expectedzfont-family: foo,barÚfontÚnameZfoozfont-family: "foo bar",bazzfoo barzfont-family: foo,
barzfont-family: foo, bar,    bazzfont-family: bar, fooÚbarzfont-family: 'foo bar', bazzfont-family: 'foo \'bar', bazzfoo 'barzfont-family: "foo \"bar", bazzfoo "barzfont-family: "foo ,bar", bazzfoo ,barzfont-family: serifZserifé)rÚfamilyzfont-family: Serifzfont-family: roman, serifZromanzfont-family: roman, sans-serifézfont-family: roman, sans serifzfont-family: roman, sansserifzfont-family: roman, cursiveézfont-family: roman, fantasyézfont-size: 1emÚsizeé zfont-size: xx-smallézfont-size: x-smallg@zfont-size: smallg333333#@zfont-size: mediumzfont-size: largeg+@zfont-size: x-largeézfont-size: xx-largeézfont-size: 50%zfont-weight: 100ÚboldFzfont-weight: 200zfont-weight: 300zfont-weight: 400zfont-weight: normalzfont-weight: lighterzfont-weight: boldTzfont-weight: bolderzfont-weight: 700zfont-weight: 800zfont-weight: 900zfont-style: italicÚitaliczfont-style: obliqueztext-decoration: underlineÚ    underlineÚsingleztext-decoration: overlineztext-decoration: noneztext-decoration: line-throughÚstrikez'text-decoration: underline line-through)rrz9text-decoration: underline; text-decoration: line-throughz
color: redÚcolorÚFF0000zcolor: #ff0000z color: #f0aZFF00AAztext-shadow: noneZshadowztext-shadow: 0px -0em 0px #CCCztext-shadow: 0px -0em 0px #999ztext-shadow: 0px -0em 0pxztext-shadow: 2px -0em 0px #CCCztext-shadow: 0px -2em 0px #CCCztext-shadow: 0px -0em 2px #CCCztext-shadow: 0px -0em 2pxztext-shadow: 0px -2emzbackground-color: redÚfillÚsolid)ÚfgColorÚ patternTypezbackground-color: #ff0000zbackground-color: #f0azborder-style: solidÚborderÚstyleZmedium)ÚtopÚbottomÚleftÚrightz'border-style: solid; border-width: thinÚthinz/border-top-style: solid; border-top-width: thinrz.border-top-style: solid; border-top-width: 1ptzborder-top-style: solidz1border-top-style: solid; border-top-width: mediumz.border-top-style: solid; border-top-width: 2ptz0border-top-style: solid; border-top-width: thickZthickz.border-top-style: solid; border-top-width: 4ptzborder-top-style: dottedZmediumDashDotDotz0border-top-style: dotted; border-top-width: thinZdottedzborder-top-style: dashedZ mediumDashedz0border-top-style: dashed; border-top-width: thinZdashedzborder-top-style: doubleÚdoublez*border-style: solid; border-color: #0000ffZ0000FF)rr©rr"r r!z0border-top-style: double; border-top-color: bluez/border-top-style: solid; border-top-color: #06cZ0066CCzborder-top-color: blueÚnone©rrztext-align: centerÚ    alignmentÚ
horizontalÚcenterztext-align: leftr!ztext-align: rightr"ztext-align: justifyZjustifyzvertical-align: topÚverticalzvertical-align: text-topzvertical-align: middlezvertical-align: bottomr zvertical-align: text-bottomzwhite-space: nowrapÚ    wrap_textzwhite-space: prezwhite-space: pre-linezwhite-space: normalznumber-format: 0%Z number_formatZ format_codez0%u!number-format: 0§[Red](0)§-§@;z0;[red](0);-;@cCstƒ}|||ƒkst‚dS©N©rÚAssertionError)ÚcssÚexpectedÚconvert©r3ú\d:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\pandas/tests/io/formats/test_to_excel.pyÚtest_css_to_excelsLr5cCsNtƒ}|dƒ}ddddœddiddiddiddidœd    d
d œd œ|ksJt‚dS) NzÈ
        font-weight: bold;
        text-decoration: underline;
        color: red;
        border-width: thin;
        text-align: center;
        vertical-align: top;
        unused: something;
    Trr)rrrrr#r%r*r)r)r+)rrr(r.)r2Úactualr3r3r4Útest_css_to_excel_multipleãsÿ
üø    ÷r7zcss,inherited,expectedÚ)rrzfont-style: normalzfont-style: inheritz'font-style: normal; font-style: inheritcCst|ƒ}|||ƒkst‚dSr-r.)r0Z    inheritedr1r2r3r3r4Útest_css_to_excel_inheritedüsr9zinput_color,output_colorcCsg|]}d||f‘qS)ú#r3)Ú.0Zrgbr3r3r4Ú
<listcomp>sr<)z#F0FZFF00FF)z#ABCZAABBCCc sŒd|›d|›d|›d|›d|›d|› }i}dˆdœ|d    <d
ˆi|d <‡fd d „dDƒ|d<t d¡tƒ}|||ƒks~t‚W5QRXdS)Núborder-top-color: ú; border-right-color: ú; border-bottom-color: ú; border-left-color: ú; background-color: ú    ; color: r)rrrrrcsi|]}|ˆddœ“qS)r&r'r3)r;Úk©Ú output_colorr3r4Ú
<dictcomp>-sÿz1test_css_to_excel_good_colors.<locals>.<dictcomp>r%r)ÚtmÚassert_produces_warningrr/)Ú input_colorrEr0r1r2r3rDr4Útest_css_to_excel_good_colorss &ÿ     
þ
 rJrIz not-a-colorc Cspd|›d|›d|›d|›d|›d|› }i}|dk    r@ddi|d    <t t¡tƒ}|||ƒksbt‚W5QRXdS)
Nr=r>r?r@rArBrrr)rGrHrrr/)rIr0r1r2r3r3r4Útest_css_to_excel_bad_colors7s&ÿ      rKcsLtttjtjƒƒ‰tj ¡D]*}t    |ƒdkrBt
‡fdd„|Dƒƒst ‚qdS)Nrc3s|]}|ˆkVqdSr-r3)r;Úc©Z
upper_hexsr3r4Ú    <genexpr>Psz/tests_css_named_colors_valid.<locals>.<genexpr>) ÚsetÚmapÚstrÚupperÚstringÚ    hexdigitsrÚ NAMED_COLORSÚvaluesÚlenÚallr/)rr3rMr4Útests_css_named_colors_validMsrYcCsHddlm}tj}| ¡D](\}}||kr>|||dd…kst‚qdS)Nr)Ú CSS4_COLORSr)Zmatplotlib.colorsrZrrUÚitemsr/)Z
mpl_colorsZ    pd_colorsrrr3r3r4Ú&test_css_named_colors_from_mpl_presentSs r\zstyles,expected)rÚgreen)rÚredz color: red;)ú font-weightr)r_Únormalzfont-weight: normal;)ú
text-alignr*)ú
TEXT-ALIGNr"ztext-align: right;c
CsPtƒ}|j ¡d|i}tdddd|dd|d}|j ¡|j||ƒksLt‚dS)z>It applies favors latter declarations over former declarations)rrrr8N©ÚrowÚcolÚvalrÚ
css_stylesÚcss_rowÚcss_colZ css_converter)rÚ _call_cachedÚ cache_clearrrr/)Ústylesr1Ú    converterrgÚcellr3r3r4Útest_css_excel_cell_precedence\s 
ø
 
rozstyles,cache_hits,cache_misses)rbr*)rar!c Cs|tƒ}|j ¡dd„t|ƒDƒ}|D] \}}tdddd||||dq&|j ¡}|j ¡|j|ksjt‚|j|ksxt‚dS)zIt caches unique cell stylescSsi|]\}}d|f|“qS)rr3)r;ÚiÚ_styler3r3r4rFŸsz-test_css_excel_cell_cache.<locals>.<dictcomp>rr8Nrc)    rrjrkÚ    enumeraterÚ
cache_infoÚhitsr/Úmisses)rlZ
cache_hitsZ cache_missesrmrgrhrirsr3r3r4Útest_css_excel_cell_cacheys$#
 ø
 
 
rv)Ú__doc__rSZpytestZ pandas.errorsrZpandas.util._test_decoratorsÚutilZ_test_decoratorsÚtdZpandas._testingZ_testingrGZpandas.io.formats.excelrrÚmarkZ parametrizer5r7r9ÚlistrUr[rVrJrKrYZskip_if_no_mplr\rorvr3r3r3r4Ú<module>sÐ   þ
þ þ þ þüÿþ üÿþ þþþþþþþþþüÿþ þþþ
þ€¾þK
 ý
ýöþ
 ÿþý
 
 
 
 
 
ýþ
þúþú
ýùíþ