
VW              
   @   s  d  d l  m Z m Z m Z m Z d  d l m Z d  d l m Z d  d l	 m
 Z
 m Z d  d l m Z m Z d  d l m Z d  d l j Z d  d l Z e d d	    Z e d
 d    Z e d d g  d d    Z e d d    Z e d d g  d d    Z e d d g d d d g d d d1 d d i  d d     Z e d! d"    Z d# d$   Z e d% d&    Z e d' d(    Z d) d*   Z  e! d+ k rd  d l" Z" e" j# d, d- d. g d/ d0  d S)2    )absolute_importdivisionprint_functionunicode_literals)six)xrange)assert_equalassert_true)image_comparisoncleanup)AxesNc               C   s  t  j d  t  j d  t  j d  t  j d  t  j   t  j d  t  j d  t  j d  t t  j   d d d d d g  t t  j   d	 d d	 d d	 g  t  j d
  t  j   t  j d  t  j d  t t  j   d d g  t t  j   d	 d g  d  S)Nalltoday   tomorrowr             
   )pltclosefigurer   Zget_fignumsZget_figlabels r   r   W/s/python-3.5.2/amd64_ubu14/lib/python3.5/site-packages/matplotlib/tests/test_figure.pytest_figure_label   s     
""
r   c               C   s   t  j d  t  j d  t  j d  t  j   t t  j d  d  t t  j d  d  t t  j d  d  t t  j d  d  t  j d  t  j d  t t  j d  d  t t  j d  d  d  S)None   ZthreeTr   F)r   r   r   Zfignum_existsr   r   r   r   r   test_fignum_exists$   s    
r   baseline_imagesZfigure_todayc              C   s   t  j d  }  |  j d  } | j |  j    | j t t d    t  j d  t  j d d g d d g d  t  j d  t  j d  d  S)Nr   o   r   r   r   r   r)	r   r   add_subplot	set_titleZ	get_labelZplotlistr   r   )figaxr   r   r   test_figure5   s    r'   c              C   sY  t  j   }  |  j d d d d g  } t |  j d d  | k  t |  j   | k  |  j d d d } t |  j   | k  t |  j d d  | k  |  j d  } t |  j   | k  t |  j d d  | k	  t |  j d d  | k	  t |  j   j   d	  |  j |  t |  j d d  | k  t |  j   | k  d  S)
Nr   r   
projectionZrectilineary   ZpolarTz   )r   r   r   )	r   r   Zadd_axesr	   Zgcar"   r   Zget_geometryZsca)r%   Zax1Zax2Zax3r   r   r   test_gcaD   s    r+   Zfigure_suptitlec              C   sQ   t  j   }  |  j d d d  } |  j d d d |  j d d d d d d  S)	Nr   ZhelloZcolorr!   titlegZrotationZ30)r   r   r"   Zsuptitle)r%   r&   r   r   r   test_suptitle^   s    r.   Zalpha_background
extensionspngsvgZsavefig_kwarg	facecolorr   皙?Z	edgecolornonec           	   C   sy   t  j d d d g  }  |  j d  |  j j d  d d  l j } |  j j | j d d g d d d	 d
 d d  d  S)NZfigsizer   r   r   皙?   Zradius   alphag333333?r2   Zred)r   r   r5   )	r   r   Zset_facecolorpatchZ	set_alphaZmatplotlib.patchesZpatchesappendZCirclePolygon)r%   Zmpatchesr   r   r   
test_alphaf   s    	r;   c           	   C   sg   d d  l  }  |  j d d  * } x  t d  D] } t j   } q. WWd  QRXt |  d k sc t  d  S)Nr   recordT   r   )warningscatch_warningsranger   r   lenAssertionError)r>   wir%   r   r   r   test_too_many_figuresz   s
    rE   c                 sm   Gd d   d t     G  f d d   d t  }  t j   } | j d d d d |    } t j |  d  S)Nc               @   s   e  Z d  Z d d   Z d S)z.test_iterability_axes_argument.<locals>.MyAxesc             _   s#   | j  d d   t j |  | |  S)Nmyclass)popr   __init__)selfargskwargsr   r   r   rH      s    z7test_iterability_axes_argument.<locals>.MyAxes.__init__N)__name__
__module____qualname__rH   r   r   r   r   MyAxes   s   rO   c                   s.   e  Z d  Z d d   Z   f d d   Z d S)z/test_iterability_axes_argument.<locals>.MyClassc             S   s   | d k r t  d   d  S)Nazitem should be a)
ValueError)rI   itemr   r   r   __getitem__   s    z;test_iterability_axes_argument.<locals>.MyClass.__getitem__c                s     d |  i f S)NrF   r   )rI   )rO   r   r   _as_mpl_axes   s    z<test_iterability_axes_argument.<locals>.MyClass._as_mpl_axesN)rL   rM   rN   rS   rT   r   )rO   r   r   MyClass   s   rU   r   r(   )r   objectr   r   r"   r   )rU   r%   r&   r   )rO   r   test_iterability_axes_argument   s
    	rW   c              C   s   t  j   }  |  j d  t |  j   d  |  j d  t |  j   d  |  j d d  t |  j   d  t |  j   d  |  j d  t |  j   d  t |  j   d  d  S)Nr   r   r   r   r   )r   r   )r   r   Zset_figwidthr   Zget_figwidthZset_figheightZget_figheightZset_size_inches)r%   r   r   r   test_set_fig_size   s    rX   c              C   s   t  j d d  \ }  } | d j   x3 | j   d  d  D] } | |  j k s= t  q= W| d
 |  j k su t  t t |  j  d  d  S)Nr   r   r   rY   )rY   rY   rY   rY   rY   )rY   rY   )r   ZsubplotsremoveravelaxesrB   r   rA   )r%   r\   r&   r   r   r   test_axes_remove   s    r]   c              C   s   t  j t j d  t j d   \ }  } | |  d k sA t  t  j d  \ }  } | |  d k sl t  t  j t j d   \ }  } | |  d k s t  t  j t j d   \ }  } | |  d k s t  d  S)Nr   r   g      ?)r   r   )r   r   )r   Z	figaspectnpfloat64rB   zeros)rC   hr   r   r   test_figaspect   s    +rb   __main__argvz-sz--with-doctestexitF)r   r   r3   )$
__future__r   r   r   r   Zmatplotlib.externalsr   Zmatplotlib.externals.six.movesr   
nose.toolsr   r	   Zmatplotlib.testing.decoratorsr
   r   Zmatplotlib.axesr   Zmatplotlib.pyplotZpyplotr   numpyr^   r   r   r'   r+   r.   r;   rE   rW   rX   r]   rb   rL   nose	runmoduler   r   r   r   <module>   s0   "

