• File: decorators.pyc
  • Full Path: /home3/farmfre2/public_html/ALFA_DATA/alfasymlink/root/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/testing/decorators.pyc
  • Date Modified: 07/22/2015 11:41 PM
  • File size: 6.13 KB
  • MIME-type: text/x-bytecode.python
  • Charset: 8 bit

_3Lc@sddlmZmZmZddlZddlZddlZddlZddlZddl	Zddl
Zddlm
Z
mZdddZddddZdZdS(i(tKnownFailureTesttKnownFailureDidNotFailTesttImageComparisonFailureN(tcomparable_formatstcompare_imagescs.dkrdnfd}|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(Nicsy||}WnOtk
rd}r^dk	rOt|sOqOntqenXrdkrtn|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
	gMbP?csRdkrtdndkr9dddgnfd}|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	3sxD]gD]#}tjj|d^q}gD]'}tjjd|d^qDx-t|D]\}}tj||qWgD]#}tjj|d^qgD]}tjj|^q}tj|}t	k}|s'd}n|s:d}nd}|oI|}	t
|	|dtfd}
|
fVqWdS(Nt.s	expected-s&Cannot compare %s files on this systemsDo not have baseline images %ssNo failure expectedRcstjddtj}tjz
}Wdtj|XxstD]b\}}tjj|std|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_dirRtactualtexpectedR(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	CsV|j}|dkrddl}|jdtjd}tjjtjj|}tjj	tjj
|dd}no|j
d}|jddkst|jdd	ksttjj
|}tjjtjj}tjj
|d
|}tjjtjj
d|}tjj|sLtj|n||fS(s
    Compute the baseline and result image directories for testing *func*.
    Create the result directory if it doesn't exist.
    t__main__iNs<test module run as script. guessing baseline image locationsiiRRttestsR?t
result_images(t
__module__twarningstwarntsystargvR R$tabspathtdirnametsplitexttsplittpoptAssertionErrorR0RRGt__file__R%tmakedirs(	R,tmodule_nameRJtscript_nametbasedirtsubdirtmodsR>R-((sP/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/testing/decorators.pyRBs"	

)!(tmatplotlib.testing.noseclassesRRRR RLR1RRtmatplotlib.teststnumpyR3tmatplotlib.testing.compareRRRRRERB(((sP/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/testing/decorators.pyt<module>s$'S