ó
î%![c           @   s+  d  d l  Z  d  d l Z y d  d l Z e Z Wn e k
 rG e Z n Xd  d l m Z d  d l m	 Z	 d e  j
 f d „  ƒ  YZ e j d d „ ƒ Z e  j e d ƒ d e f d	 „  ƒ  Yƒ Z e  j e d ƒ d
 e f d „  ƒ  Yƒ Z e  j e d ƒ d e f d „  ƒ  Yƒ Z e d k r'e  j ƒ  n  d S(   iÿÿÿÿN(   t   builder(   t   nodest   SubTestWrapperc           B   s   e  Z d  Z d d „ Z RS(   sX   
    A class for supporting all unittest version wether or not subTest is available
    c         K   s<   y t  t |  ƒ j | |  SWn t k
 r7 t | ƒ SXd  S(   N(   t   superR   t   subTestt   AttributeErrort   subTestMock(   t   selft   msgt   params(    (    sA   lib/python2.7/site-packages/astroid/tests/unittest_brain_numpy.pyR      s    N(   t   __name__t
   __module__t   __doc__t   NoneR   (    (    (    sA   lib/python2.7/site-packages/astroid/tests/unittest_brain_numpy.pyR      s   c         c   s	   |  Vd S(   s-   
    A mock for subTest which do nothing
    N(    (   R   (    (    sA   lib/python2.7/site-packages/astroid/tests/unittest_brain_numpy.pyR       s    s%   This test requires the numpy library.t   NumpyBrainCoreUmathTestc        #   B   s   e  Z d  Z dO Z dP Z dQ Z dR Z e e e e Z dS Z dF „  Z	 dG „  Z
 dH „  Z dI „  Z dJ „  Z dK „  Z dL „  Z dM „  Z dN „  Z RS(T   s8   
    Test of all members of numpy.core.umath module
    t	   geterrobjt	   seterrobjt   arccost   arccosht   arcsint   arcsinht   arctant   arctanht   cbrtt   conjt	   conjugatet   cosht   deg2radt   degreest   exp2t   expm1t   fabst   frexpt   isfinitet   isinft   logt   log1pt   log2t   logical_nott   modft   negativet   rad2degt   radianst
   reciprocalt   rintt   signt   signbitt   spacingt   squaret   tant   tanht   trunct   bitwise_andt
   bitwise_ort   bitwise_xort   copysignt   dividet   equalt   float_powert   floor_dividet   fmaxt   fmint   fmodt   greatert   hypott   ldexpt
   left_shiftt   lesst	   logaddexpt
   logaddexp2t   logical_andt
   logical_ort   logical_xort   maximumt   minimumt	   nextaftert	   not_equalt   powert	   remaindert   right_shiftt   subtractt   true_dividet   et   euler_gammac         C   s(   t  j d j | ƒ ƒ } t | j ƒ  ƒ S(   Ns`   
        import numpy.core.umath as tested_module
        func = tested_module.{:s}
        func(   R    t   extract_nodet   formatt   nextt   infer(   R   t	   func_namet   node(    (    sA   lib/python2.7/site-packages/astroid/tests/unittest_brain_numpy.pyt   _inferred_numpy_attributeG   s    c         C   sS   xL |  j  D]A } |  j d | ƒ ' |  j | ƒ } |  j | t j ƒ Wd QXq
 Wd S(   s6   
        Test that constants have Const type.
        t   constN(   t	   constantsR   RZ   t   assertIsInstanceR   t   Const(   R   R[   t   inferred(    (    sA   lib/python2.7/site-packages/astroid/tests/unittest_brain_numpy.pyt   test_numpy_core_umath_constantsN   s    c      	   C   sk   i d d 6d d 6} xP |  j  D]E } |  j d | ƒ + |  j | ƒ } |  j | j | | ƒ Wd QXq Wd S(   s3   
        Test the values of the constants.
        giW‹
¿@RR   g¶oüŒxâ?RS   R[   N(   R\   R   RZ   t   assertEqualt   value(   R   t   exact_valuesR[   R_   (    (    sA   lib/python2.7/site-packages/astroid/tests/unittest_brain_numpy.pyt&   test_numpy_core_umath_constants_valuesW   s    

c         C   sS   xL |  j  D]A } |  j d | ƒ ' |  j | ƒ } |  j | t j ƒ Wd QXq
 Wd S(   s<   
        Test that functions have FunctionDef type.
        t   funcN(   t	   all_ufuncR   RZ   R]   R   t   FunctionDef(   R   Re   R_   (    (    sA   lib/python2.7/site-packages/astroid/tests/unittest_brain_numpy.pyt   test_numpy_core_umath_functionsb   s    c         C   sS   xL |  j  D]A } |  j d | ƒ ' |  j | ƒ } |  j | j ƒ  ƒ Wd QXq
 Wd S(   sQ   
        Test that functions with no arguments have really no arguments.
        Re   N(   t   no_arg_ufuncR   RZ   t   assertFalset   argnames(   R   Re   R_   (    (    sA   lib/python2.7/site-packages/astroid/tests/unittest_brain_numpy.pyt&   test_numpy_core_umath_functions_no_argk   s    c         C   s_   d g } xO |  j  D]D } |  j d | ƒ * |  j | ƒ } |  j | j ƒ  | ƒ Wd QXq Wd S(   s8   
        Test the arguments names of functions.
        t   errobjRe   N(   t   one_arg_ufunc_specR   RZ   Ra   Rk   (   R   t   exact_arg_namesRe   R_   (    (    sA   lib/python2.7/site-packages/astroid/tests/unittest_brain_numpy.pyt,   test_numpy_core_umath_functions_one_arg_spect   s
    	c         C   sq   d d d d d d d g } xO |  j  D]D } |  j d | ƒ * |  j | ƒ } |  j | j ƒ  | ƒ Wd	 QXq% Wd	 S(
   s8   
        Test the arguments names of functions.
        t   xt   outt   wheret   castingt   ordert   dtypet   subokRe   N(   t   one_arg_ufuncR   RZ   Ra   Rk   (   R   Ro   Re   R_   (    (    sA   lib/python2.7/site-packages/astroid/tests/unittest_brain_numpy.pyt'   test_numpy_core_umath_functions_one_arg~   s
    c         C   st   d d d d d d d d g } xO |  j  D]D } |  j d	 | ƒ * |  j | ƒ } |  j | j ƒ  | ƒ Wd
 QXq( Wd
 S(   s8   
        Test the arguments names of functions.
        t   x1t   x2Rr   Rs   Rt   Ru   Rv   Rw   Re   N(   t   two_args_ufuncR   RZ   Ra   Rk   (   R   Ro   Re   R_   (    (    sA   lib/python2.7/site-packages/astroid/tests/unittest_brain_numpy.pyt(   test_numpy_core_umath_functions_two_argsˆ   s
    c         C   s‘   d t d d d t g } xr |  j |  j D]` } |  j d | ƒ F |  j | ƒ } g  | j j D] } | j ^ q^ } |  j	 | | ƒ Wd QXq) Wd S(   s@   
        Test the default values for keyword arguments.
        t	   same_kindt   KRe   N(
   R   t   TrueRx   R|   R   RZ   t   argst   defaultsRb   Ra   (   R   t   exact_kwargs_default_valuesRe   R_   t   defaultt   default_args_values(    (    sA   lib/python2.7/site-packages/astroid/tests/unittest_brain_numpy.pyt5   test_numpy_core_umath_functions_kwargs_default_values’   s    "(   R   (   R   (#   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R    R!   R"   R#   R$   R%   R&   R'   R(   R)   R*   R+   R,   R-   R.   R/   R0   R1   R2   R3   (   R4   R5   R6   R7   R8   R9   R:   R;   R<   R=   R>   R?   R@   RA   RB   RC   RD   RE   RF   RG   RH   RI   RJ   RK   RL   RM   RN   RO   RP   RQ   (   RR   RS   (   R
   R   R   Ri   Rn   Rx   R|   Rf   R\   RZ   R`   Rd   Rh   Rl   Rp   Ry   R}   R†   (    (    (    sA   lib/python2.7/site-packages/astroid/tests/unittest_brain_numpy.pyR   (   s8               									
	
	
t   NumpyBrainRandomMtrandTestc           B   s  e  Z d  Z i/ d d d g dX g f d 6d d d g dX g f d 6d g g  f d	 6d
 d g dX g f d 6d d d d g dX e dX g f d 6d d g dX g f d 6d d g d dX g f d 6d d d g dX g f d 6d d d g d dX g f d 6d d g dX g f d 6g  g  f d 6d d d g d d dX g f d 6d d d d g dX g f d  6d d d g d d dX g f d! 6d d d g d d dX g f d" 6d# d$ d g d d dX g f d% 6d d g dX g f d& 6d d' d g dX g f d( 6d# d) d g dX g f d* 6d d d g dX g f d+ 6d
 d, d g dX g f d- 6d d d, d g dX g f d. 6d d d g d d dX g f d/ 6d d g dX g f d0 6d1 g g  f d2 6d3 d g d dX g f d4 6d d g dX g f d5 6d6 g g  f d7 6d8 d9 d d: g dX dX d; g f d< 6d6 g g  f d= 6d8 d9 d g dX dX g f d> 6d g dX g f d? 6d d g d dX g f d@ 6dA g dX g f dA 6dB g g  f dC 6d1 g g  f dD 6d g dX g f dE 6d g dX g f dF 6d d g dX g f dG 6d g dX g f dH 6d
 d g dX g f dI 6dJ dK dL d g dX g f dM 6d8 d9 d g d d dX g f dN 6dO dP d g dX g f dQ 6d# d d g dX g f dR 6d d g dX g f dS 6d d g dX g f dT 6Z dU „  Z dV „  Z dW „  Z RS(Y   sB   
    Test of all the functions of numpy.random.mtrand module.
    t   at   bt   sizet   betat   nt   pt   binomialt   lengtht   bytest   dft	   chisquaret   replacet   choicet   alphat	   dirichlett   scaleg      ð?t   exponentialt   dfnumt   dfdent   ft   shapet   gammat	   geometrict	   get_statet   locg        t   gumbelt   ngoodt   nbadt   nsamplet   hypergeometrict   laplacet   logistict   meant   sigmat	   lognormalt	   logseriest   pvalst   multinomialt   covt   multivariate_normalt   negative_binomialt   nonct   noncentral_chisquaret   noncentral_ft   normalt   paretoRq   t   permutationt   lamt   poissonRM   R   t   randt   lowt   highRv   t   lt   randintt   randnt   random_integerst   random_samplet   rayleight   seedt   statet	   set_statet   shufflet   standard_cauchyt   standard_exponentialt   standard_gammat   standard_normalt
   standard_tt   leftt   modet   rightt
   triangulart   uniformt   mut   kappat   vonmisest   waldt   weibullt   zipfc         C   s(   t  j d j | ƒ ƒ } t | j ƒ  ƒ S(   Nsc   
        import numpy.random.mtrand as tested_module
        func = tested_module.{:s}
        func(   R    RT   RU   RV   RW   (   R   RX   RY   (    (    sA   lib/python2.7/site-packages/astroid/tests/unittest_brain_numpy.pyRZ   Õ   s    c         C   sS   xL |  j  D]A } |  j d | ƒ ' |  j | ƒ } |  j | t j ƒ Wd QXq
 Wd S(   s@   
        Test that all functions have FunctionDef type.
        Re   N(   t
   all_mtrandR   RZ   R]   R   Rg   (   R   Re   R_   (    (    sA   lib/python2.7/site-packages/astroid/tests/unittest_brain_numpy.pyt"   test_numpy_random_mtrand_functionsÜ   s    c         C   sš   x“ |  j  j ƒ  D]‚ \ } \ } } |  j d | ƒ \ |  j | ƒ } |  j | j ƒ  | ƒ g  | j j D] } | j ^ qg } |  j | | ƒ Wd QXq Wd S(   s>   
        Test the arguments names and default values.
        Re   N(	   RÖ   t   itemsR   RZ   Ra   Rk   R   R‚   Rb   (   R   Re   Ro   Rƒ   R_   R„   R…   (    (    sA   lib/python2.7/site-packages/astroid/tests/unittest_brain_numpy.pyt,   test_numpy_random_mtrand_functions_signatureå   s    ""N(	   R
   R   R   R   R€   RÖ   RZ   R×   RÙ   (    (    (    sA   lib/python2.7/site-packages/astroid/tests/unittest_brain_numpy.pyR‡   ž   sh   ""			t   NumpyBrainCoreNumericTypesTestc           B   sn   e  Z d  Z d d d d d d d d d	 d
 d d d d d d d d d d d d d d g Z d „  Z d „  Z RS(   sG   
    Test of all the missing types defined in numerictypes module.
    t   uint16t   uint32t   uint64t   int128t   uint128t   float16t   float32t   float64t   float80t   float96t   float128t   float256t	   complex32t	   complex64t
   complex128t
   complex160t
   complex192t
   complex256t
   complex512t   timedelta64t
   datetime64t   unicode_t   string_t   object_c         C   s+   t  j d j | ƒ ƒ } t | j j ƒ  ƒ S(   Nsb   
        import numpy.core.numerictypes as tested_module
        missing_type = tested_module.{:s}(   R    RT   RU   RV   Rb   RW   (   R   t   attribRY   (    (    sA   lib/python2.7/site-packages/astroid/tests/unittest_brain_numpy.pyRZ   ü   s    c         C   sS   xL |  j  D]A } |  j d | ƒ ' |  j | ƒ } |  j | t j ƒ Wd QXq
 Wd S(   sA   
        Test that all defined types have ClassDef type.
        t   typN(   t	   all_typesR   RZ   R]   R   t   ClassDef(   R   Rô   R_   (    (    sA   lib/python2.7/site-packages/astroid/tests/unittest_brain_numpy.pyt   test_numpy_core_types  s    (   R
   R   R   Rõ   RZ   R÷   (    (    (    sA   lib/python2.7/site-packages/astroid/tests/unittest_brain_numpy.pyRÚ   ñ   s   	t   __main__(   t   unittestt
   contextlibt   numpyR€   t	   HAS_NUMPYt   ImportErrort   Falset   astroidR    R   t   TestCaseR   t   contextmanagerR   R   t
   skipUnlessR   R‡   RÚ   R
   t   main(    (    (    sA   lib/python2.7/site-packages/astroid/tests/unittest_brain_numpy.pyt   <module>   s&   

uR