rL i<ddlZddlmZmZddlmZddlmZdZdZ dZ ejjdd d id fd d ddfdd idfdd idfd d ggdddfd d ggdddffdZ ejjddd idfddgddd fd!d id"fd!d id#fd$dd%d&fd'dd%d(fd)dd%d*fd+dd,dgd gd-d.fd+dd,dgd gd/d0ff d1Zd2Zed3g4d5Zy)6N)assert_allcloseassert_array_equal)Sankey)check_figures_equalc8t}|jy)N)radd)sankeys b/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/matplotlib/tests/test_sankey.py test_sankeyr s XF JJLctdgdgdg}|jdjdjdk(sJy)N?First)flowslabels orientationsrz First 0.25rdiagramstextsget_text)ss r test_labelrs@dVWIRDAA ::a=  q ! * * , == =r cd}tdgdgdg|}|jdjdjdk(sJy)Nc |dS)Nz.3f)values r show_three_decimal_placesz=test_format_using_callable..show_three_decimal_placess r rrr)rrrformatrz First 0.250r)rrs r test_format_using_callabler sN dVWIRD/ 1A ::a=  q ! * * , >> >r z kwargs, msggaprz'gap' is negative)r!radiusz'radius' is greater than 'gap' head_anglez'head_angle' is negative tolerancez'tolerance' is negative)rrr"rrz/The shapes of 'flows' \(2,\) and 'orientations')abc)rrz)The shapes of 'flows' \(2,\) and 'labels'cztjt|5tdi|dddy#1swYyxYw)Nmatchr)pytestraises ValueErrorr)kwargsmsgs r test_sankey_errorsr3s2 z -s 1: trunklengthz'trunklength' is negative皙?g333333?)rpriorzThe scaled sum of the connectedr6z*The index of the prior diagram is negativez#The index of the prior diagram is 1)rr")connectr6zAt least one of the connection)r#r"z"The connection index to the source)r"z The connection index to this dia)r"r"皙ɿ)r7r6rrzThe value of orientations)r7r6r pathlengthszThe lengths of 'flows'ct}tjt|5|j ddg|jdi|dddy#1swYyxYw)Nr,r5r9)rr)rr.r/r0r)r1r2r s r test_sankey_add_errorsr<.sQXF z - #t % Vs 'AActgddgdgd}|j}t|djgd|djgdk(sJt |dj Dcgc]}|jdddk(c}sJt |dj Dcgc]}|jd ddk(c}sJ|djjd k(sJt|djgd tgd dgdgd}|j}t|djgd |djgd k(sJt|djgdycc}wcc}w)N)rп?FoorBar)rrrunitr)r"r8r"r8r8)gg=ä࿩g?g6 t)迩ggՁA ڿg?gqXu)rr>rr?r@)r"r8Nr"r8)rFrG)rrrHrI) rfinishrranglesallrrtextrtips)rsfrMs r test_sankey2rPBsY-ugDu .A Br!u{{$<= a5<<< '' ' "Q%++F$ !$-F GG G "Q%++F$ $-F GG G a5::   B && &BqEJJ)* 0%Du .A Br!u{{$?@ a5<<- -- -BqEJJ)*GFs +E:'E?png) extensionsc|j}t|gdgd}|j|j}t|}|jgdgd|jy)N)rr>r>rr?r@)r"rr"rrr)axrr)rTr')gcarrJr)fig_testfig_refax_tests_testax_refs_refs r test_sankey3r\^s]llnG w&K!57F MMO [[]F f E II9/1 LLNr )r. numpy.testingrrmatplotlib.sankeyrmatplotlib.testing.decoratorsrr rr mark parametrizer3r<rPr\rr r rbs =$= > ? R[%& !>?B342122w 3792w/213 )   R56SzA&(IJ r]@A q\891%'GH!$&JK!$&HI!tSkc79!tSkS35 )  *8( ) r