rL i&dZddlZddlZddlmZddlZddlZddlmZddl Z e jddddZ d Z d Z e jjd dd gd Ze jjd dd gdZdZy)z2Tests for tinypages build using sphinx extensions.N)Path)subprocess_run_for_testingsphinxz4.1.3) minversionc |gn|}tjdddddt|t|t|g |}t|dditj ddi }|j }|j}|jd k(sJd |d |d |rtjd||jsJy)N-msphinx-W-bhtml-dT MPLBACKENDcapture_outputtextenvrz!sphinx build failed with stdout: z stderr:  z-sphinx build emitted the following warnings: ) sys executablestrrosenvironstdoutstderr returncodepytestfailis_dir) source_dir doctree_dirhtml_dir extra_argscmdprocouterrs e/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/matplotlib/tests/test_sphinxext.pybuild_sphinx_htmlr(s!)zJ >>:tT6 [!3z?CM PDN PC % Dt ,rzz ,< , .D ++C ++C ??a E ,SESEDE   DSEJK ??  c btjttjdz |d|dz dz }|dz |dz t j dd d dd ttttjdz t|g }t|dditjd tjd }|j}|j}t||fdfd}fdtddD\}}} t!j"|dsJt!j"| dsJt!j"|dsJt!j"|dsJt!j"|dsJt!j"| dsJ|dz j%d} d| vsJt!j"| dz sJt!j"|dz sJd | vsJd!| vsJd"| vsJd#| vsJd$| vsJ| j'd%d&k(sJt!j"|d'sJt!j"|d(z sJ|d)z j)} | j+d*d+} |d)z j-| d,D cgc]"} || j/j0$} } t||t!j"| d'sJ|dj/j0| d-k(sJ|d&j/j0| dk(sJ|d.j/j0| d&k(sJt!j"|dsJt!j"|d&sJt!j"| d.sJ|dj/j0| d.kDsJt!j"|dsJycc} w)/N tinypagesT dirs_exist_ok_buildr _imagesdoctreesrr r r r)r GCOV_ERROR_FILErcd|dz SN some_plots-.png)numimg_dirs r' plot_filez!test_tinypages..plot_file:s;se4000r)c0jdz d|dz S)Nplot_directiver4r5)parent)r7r s r'plot_directive_filez+test_tinypages..plot_directive_file=s#!!$44SE7NNNr)c3.K|] }|ywNr6).0ir9s r' z!test_tinypages..As!D1)A,!Ds 12_0012_01 some_plots.htmlutf-8encodingz# Only a commentz range4.pngzrange6_range6.pngz This is the caption for plot 15.z7Plot 17 uses the caption option, with multi-line input.z3Plot 17 uses the alt option, with multi-line input.z This is the caption for plot 18.z&plot-directive my-class my-other-classz#This caption applies to both plots.zrange6_range10.pngzincluded_plot_21.rstsplt.plot(range(6))splt.plot(range(4)))rCrOrErrQ)shutilcopytreer__file__r<rrrrrrdevnullrrr(rangefilecmpcmp read_textcount read_bytesreplace write_bytesstatst_mtime)tmp_pathr!r#r$r%r&r=range_10range_6range_4 html_contentscontentsrAmodification_timesr r8r9s @@@r'test_tinypagesrg#s OODN))K7"&(("V+H"GZ'K >>:tT6 [! tH~$${2 3S] DC & Dt Krzz K K D ++C ++Ch X61O"Ea !DHgw ;;w ! -- - ;;w ! -- - ;;x2 // / ;;x7!3 44 4 ;;w ' 2 33 3 ;;w " .. . 11<> > - >> > F VV V @M QQ Q - >> > 3} DD D   D E JJ J ;;w " .. . ;;x+?!? @@ @11==?H 57LMH &&33H=$01.a0557@@11h X6 ;;w " .. . q ! & & ( 1 15G5J JJ J q ! & & ( 1 15G5J JJ J q ! & & ( 1 15G5J JJ J ;;x1 .. . ;;w ! -- - ;;w ! -- - q ! & & ( 1 14Fq4I II I ;;w ! -- -!1s?'P,cttj}tj|dz |dz tj |dz |dz |dz }|dz j d|dz d z }t|||tt|jd d k(sJ|dz d z }t|||d dgtt|jd dk(sJy)Ntinypages/conf.pyconf.pytinypages/_static_staticr0 index.rstz# .. plot:: plt.plot(range(2)) r.html1 **/index-1.pyrChtml2-Dzplot_html_show_source_link=0r"r rrTr<rRcopyfilerS write_textr(lenlistglob)r`r<r html_dir1 html_dir2s r'test_plot_html_show_source_linkr{s (^ " "F OOF00(Y2FG OOF00(Y2FGZ'K '') 8#g-Ih Y7 tINN?34 5 :: :8#g-Ih Y"&(F!GI tINN?34 5 :: :r)plot_html_show_source_linkrCc`ttj}tj|dz |dz tj |dz |dz |dz }|dz j d|dz d z }t|||d d |g tt|jd dk(sJy)Nrirjrkrlr0rmz? .. plot:: :show-source-link: true plt.plot(range(2)) r.r rqplot_html_show_source_link=rrrorCrsr`r|r<r r!s r'test_show_source_link_truer(^ " "F OOF00(Y2FG OOF00(Y2FGZ'K '') ("V+Hh X +,F+GHCJK tHMM/23 4 99 9r)c`ttj}tj|dz |dz tj |dz |dz |dz }|dz j d|dz d z }t|||d d |g tt|jd dk(sJy)Nrirjrkrlr0rmz@ .. plot:: :show-source-link: false plt.plot(range(2)) r.r rqr~rrrorrsrs r'test_show_source_link_falserrr)ctjttjdz |d|dz dz }|dz |dz }t |||dd g dfd }d D]4}||j sJ||d j r4Jdz j sJdz j sJdz j sJdz j sJdz j sJdz j sJdz j sJdz j sJd|dz jdvsJd}||dz jdvsJd}||dz jdvsJy) Nr+Tr,r.r r/r0rqzplot_srcset=2xrrcd||dz Sr3r6)r7suffr8s r'r9z&test_srcset_version..plot_files;seD6666r)) rCrOrQrErFrGrJrPz.2x)rznestedpage-index-1.pngznestedpage-index-1.2x.pngznestedpage-index-2.pngznestedpage-index-2.2x.pngznestedpage2-index-1.pngznestedpage2-index-1.2x.pngznestedpage2-index-2.pngznestedpage2-index-2.2x.pngzDsrcset="_images/some_plots-1.png, _images/some_plots-1.2x.png 2.00x"rKrLrMzVsrcset="../_images/nestedpage-index-1.png, ../_images/nestedpage-index-1.2x.png 2.00x"znestedpage/index.htmlzXsrcset="../_images/nestedpage2-index-2.png, ../_images/nestedpage2-index-2.2x.png 2.00x"znestedpage2/index.html)r)rRrSrrTr<r(existsrY)r`r!r r9indstr8s @r'test_srcset_versionrs OODN))K7"&(("V+H"GZ'Kh X C !7/3~$$&&&5)002223 . . 6 6 88 8 1 1 9 9 ;; ; . . 6 6 88 8 1 1 9 9 ;; ; / / 7 7 99 9 2 2 : : << < / / 7 7 99 9 2 2 : : << < S,,777I JK J 8B (44???Q QQ Q 9B (55@@'@R RR Rr)r?)__doc__rWrpathlibrrRrmatplotlib.testingrr importorskipr(rgr{mark parametrizerrrr6r)r'rs8  9 H1&Y.x;,51v>:?:&51v>:?:&&Sr)