ó _Û3Lc@s´ddlmZmZmZddlZddlZddlZddlZddlZddl Zddl Z ddl m Z mZddd„Zdddd„Zd„ZdS(iÿÿÿÿ(tKnownFailureTesttKnownFailureDidNotFailTesttImageComparisonFailureN(tcomparable_formatstcompare_imagescs.ˆdkrd‰n‡‡‡fd†}|S(sD Assume a will fail if *fail_condition* is True. *fail_condition* may also be False or the string 'indeterminate'. *msg* is the error message displayed for the test. If *known_exception_class* is not None, the failure is only known if the exception is an instance of this class. (Default = None) sTest known to failcs:ddl}‡‡‡‡fd†}|jjˆƒ|ƒS(NiÿÿÿÿcsŠyˆ||Ž}WnOtk rd}ˆr^ˆdk rOt|ˆƒsO‚qOntˆƒ‚qe‚nXˆr†ˆdkr†tˆƒ‚n|S(Nt indeterminate(t ExceptiontNonet isinstanceRR(targstkwargstresultterr(tftfail_conditiontknown_exception_classtmsg(sP/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/testing/decorators.pytfailers  (tnosettoolstmake_decorator(R RR(RRR(R sP/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/testing/decorators.pytknown_fail_decorators N(R(RRRR((RRRsP/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/testing/decorators.pytknownfailureif s  gü©ñÒMbP?csRˆdkrtdƒ‚nˆdkr9dddg‰n‡‡‡fd†}|S(sn call signature:: image_comparison(baseline_images=['my_figure'], extensions=None) Compare images generated by the test with those specified in *baseline_images*, which must correspond else an ImageComparisonFailure exception will be raised. Keyword arguments: *baseline_images*: list A list of strings specifying the names of the images generated by calls to :meth:`matplotlib.figure.savefig`. *extensions*: [ None | list ] If *None*, default to all supported extensions. Otherwise, a list of extensions to test. For example ['png','pdf']. s!baseline_images must be specifiedtpngtpdftsvgcsFtˆƒ\‰‰‡‡‡‡‡‡fd†}tjjˆƒ|ƒS(Nc 3sx‰ˆD]‰gˆD]#}tjjˆ|ƒdˆ^q}gˆD]'}tjjˆd|ƒdˆ^qD‰x-t|ˆƒD]\}}tj||ƒqWgˆD]#}tjjˆ|ƒdˆ^q¨‰gˆD]}tjj|ƒ^qØ}tj|ƒ}ˆt ƒk}|s'dˆ}n|s:dˆ}nd}|oI| } t | |dt ƒ‡‡‡‡‡‡fd†ƒ} | fVqWdS(Nt.s expected-s&Cannot compare %s files on this systemsDo not have baseline images %ssNo failure expectedRcsÄtjddˆƒtjƒ}tjˆƒz ˆƒ}Wdtj|ƒXxstˆˆƒD]b\}}tjj|ƒs‹td|ƒ‚nt ||ˆdt ƒ}|rZtd|ƒ‚qZqZW|S(Ntsavefigt extensionsimage does not exist: %st in_decorators=images not close: %(actual)s vs. %(expected)s (RMS %(rms).3f)( t matplotlibtrctostgetcwdtchdirtziptpathtexistsRRtTrue(told_dirR tactualtexpectedR (t actual_fnamestexpected_fnamesRtfunct result_dirttol(sP/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/testing/decorators.pytdecorated_compare_imagesgs"    ( R R$tjoinR#tshutiltcopyfileR%tnptallRRR( tfnametorig_expected_fnamestsrctdstR)thave_baseline_imagesthave_baseline_imaget is_comparabletfail_msgt will_failR/(t baseline_dirtbaseline_imagest extensionsR,R-R.(R*R+RsP/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/testing/decorators.pytcompare_images_generatorVs$ 040%    '(t_image_directoriesRRR(R,RA(R?R@R.(R>R,R-sP/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/testing/decorators.pytcompare_images_decoratorSs+N(Rt ValueError(R?R@R.RC((R?R@R.sP/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/testing/decorators.pytimage_comparison1s   /c Cs |j}|dkr‚ddl}|jdƒtjd}tjjtjj|ƒƒ}tjj tjj |ƒdƒd}n9|j dƒ}tjj |Œ}tjjt j jƒ}tjj |d|ƒ}tjjtjj d |ƒƒ}tjj|ƒstj|ƒn||fS( s„ Compute the baseline and result image directories for testing *func*. Create the result directory if it doesn't exist. t__main__iÿÿÿÿNs<test module run as script. guessing baseline image locationsiiRR?t result_images(t __module__twarningstwarntsystargvR R$tabspathtdirnametsplitexttsplitR0Rttestst__file__R%tmakedirs( R,t module_nameRIt script_nametbasedirtsubdirtmodsR>R-((sP/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/testing/decorators.pyRB„s     )!(tmatplotlib.testing.noseclassesRRRR RKR1RRtmatplotlib.teststnumpyR3tmatplotlib.testing.compareRRRRRERB(((sP/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/testing/decorators.pyts$    'S