ó
î&]\c           @` sÄ   d  Z  d d l m Z m Z m Z d d l Z d d l m Z m	 Z	 d d l
 Z
 d d l j Z d d l m Z i  Z i  Z d „  Z e ƒ  \ Z Z e
 j j d e d e ƒd	 „  ƒ Z d
 „  Z d S(   s3   Test how the ufuncs in special handle nan inputs.

i    (   t   divisiont   print_functiont   absolute_importN(   t   assert_array_equalt   assert_(   t   suppress_warningsc          C` sÑ   g  }  g  } x¸ t  t j ƒ D]§ } t j | } t | t j ƒ sG q n  t j | ƒ } | d  k r |  j	 | ƒ | j	 | ƒ q t
 j j d t d | ƒ } |  j	 t
 j | d | ƒƒ | j	 | ƒ q W|  | f S(   Nt   runt   reasont   marks(   t   sortedt   sct   __dict__t
   isinstancet   npt   ufunct   KNOWNFAILURESt   gett   Nonet   appendt   pytestt   markt   xfailt   Falset   param(   t   ufuncst   ufunc_namest   namet   objt   msgt   fail(    (    sB   lib/python2.7/site-packages/scipy/special/tests/test_nan_inputs.pyt   _get_ufuncs   s    t   funct   idsc      	   C` s¨   t  j f |  j } t ƒ  < } | j t d ƒ y |  | Œ  } Wn t k
 rS d  SXWd  QX|  t k ry t |  | Œ  } n  d j | ƒ } t	 t  j
 | ƒ t d | ƒd  S(   Ns-   floating point number truncated to an integers   got {} instead of nant   err_msg(   R   t   nant   ninR   t   filtert   RuntimeWarningt	   TypeErrort   POSTPROCESSINGt   formatR   t   isnant   True(   R   t   argst   supt   resR   (    (    sB   lib/python2.7/site-packages/scipy/special/tests/test_nan_inputs.pyt   test_nan_inputs(   s    	c          C` sQ   t  ƒ  B }  |  j t d ƒ t j t j d d ƒ } t t j | ƒ ƒ Wd  QXd  S(   Ns-   floating point number truncated to an integeri   g      à?(	   R   R$   R%   R
   t   bdtrcR   R"   R   R)   (   R,   R-   (    (    sB   lib/python2.7/site-packages/scipy/special/tests/test_nan_inputs.pyt   test_legacy_cast;   s
    	(   t   __doc__t
   __future__R    R   R   t   numpyR   t   numpy.testingR   R   R   t   scipy.specialt   specialR
   t   scipy._lib._numpy_compatR   R   R'   R   t   UFUNCSt   UFUNC_NAMESR   t   parametrizeR.   R0   (    (    (    sB   lib/python2.7/site-packages/scipy/special/tests/test_nan_inputs.pyt   <module>   s   	$