ó
\K]c           @` sj  d  Z  d d l m Z m Z m Z d d l m Z m Z d d l m Z m	 Z	 m
 Z
 d d l m Z d d l m Z m Z e d e ƒ d	 „  ƒ Z d
 „  Z e d e ƒ d d d „ ƒ Z d „  Z e d e ƒ d d „ ƒ Z d „  Z d „  Z e d e ƒ d „  ƒ Z d „  Z e	 d e ƒ d d d „ ƒ Z d „  Z d e f d „  ƒ  YZ e d k rfe j ƒ  n  d S(   sd   
Test problems in nested calls.
Usually due to invalid type conversion between function boundaries.
i    (   t   print_functiont   divisiont   absolute_import(   t   int32t   int64(   t   jitt   generated_jitt   types(   t   unittest_supporti   (   t   TestCaset   tagt   nopythonc         C` s   |  | | f S(   N(    (   t   at   bt   c(    (    s<   lib/python2.7/site-packages/numba/tests/test_nested_calls.pyt   f_inner   s    c         C` s   t  |  d | d | ƒS(   NR   R   (   R   (   t   xt   yt   z(    (    s<   lib/python2.7/site-packages/numba/tests/test_nested_calls.pyt   f   s    i   i   c         C` s   |  | | f S(   N(    (   R   R   R   (    (    s<   lib/python2.7/site-packages/numba/tests/test_nested_calls.pyt   g_inner   s    c         C` s%   t  |  d | ƒt  d | d |  ƒ f S(   NR   R   R   (   R   (   R   R   R   (    (    s<   lib/python2.7/site-packages/numba/tests/test_nested_calls.pyt   g   s    i   c         G` s
   |  | f S(   N(    (   R   R   (    (    s<   lib/python2.7/site-packages/numba/tests/test_nested_calls.pyt
   star_inner   s    c         C` s   t  d |  ƒ t  |  | | ƒ f S(   NR   (   R   (   R   R   R   (    (    s<   lib/python2.7/site-packages/numba/tests/test_nested_calls.pyt   star    s    c         C` s   t  |  | Œ t  | Œ  f S(   N(   R   (   R   R   R   (    (    s<   lib/python2.7/site-packages/numba/tests/test_nested_calls.pyt	   star_call#   s    c         C` s   | r t  d ƒ }  n  |  S(   Ni    (   R   (   R   R   (    (    s<   lib/python2.7/site-packages/numba/tests/test_nested_calls.pyt   argcast_inner&   s    c         C` s   t  t |  ƒ | ƒ S(   N(   R   R   (   R   R   (    (    s<   lib/python2.7/site-packages/numba/tests/test_nested_calls.pyt   argcast-   s    i   c         C` s+   t  |  t j ƒ r d „  } n	 d „  } | S(   Nc         S` s   |  | | f S(   N(    (   R   R   R   (    (    s<   lib/python2.7/site-packages/numba/tests/test_nested_calls.pyt   impl3   s    c         S` s   |  | | f S(   N(    (   R   R   R   (    (    s<   lib/python2.7/site-packages/numba/tests/test_nested_calls.pyR   6   s    (   t
   isinstanceR   t   Complex(   R   R   R   R   (    (    s<   lib/python2.7/site-packages/numba/tests/test_nested_calls.pyt   generated_inner0   s    	c         C` s   t  |  d | ƒS(   NR   (   R   (   R   R   (    (    s<   lib/python2.7/site-packages/numba/tests/test_nested_calls.pyt   call_generated:   s    t   TestNestedCallc           B` s³   e  Z e d  „ Z d „  Z e d ƒ e d „ ƒ Z d „  Z e d ƒ e d „ ƒ Z d „  Z	 e d ƒ d „  ƒ Z
 e d ƒ e d „ ƒ Z d	 „  Z d
 „  Z e d ƒ d „  ƒ Z RS(   c         ` sU   ‡  ‡ ‡ f d †  } | r* t  d t ƒ n t  d t ƒ } t |   ˆ ƒ ‰  ˆ  | f S(   Nc          ` s2   ˆ |  | Ž  } ˆ  |  | Ž  } ˆ j  | | ƒ d  S(   N(   t   assertPreciseEqual(   t   argst   kwargst   expectedt   result(   R   t   pyfunct   self(    s<   lib/python2.7/site-packages/numba/tests/test_nested_calls.pyt   checkA   s    t   forceobjR   (   t   dictt   TrueR   (   R'   R&   t   objmodeR(   t   flags(    (   R   R&   R'   s<   lib/python2.7/site-packages/numba/tests/test_nested_calls.pyt   compile_func@   s    $c         ` s`   t  d t ƒ d „  ƒ ‰  t  d t ƒ ‡  f d †  ƒ } |  j | t ƒ ƒ |  j | t ƒ ƒ d  S(   NR   c         S` s   |  S(   N(    (   R   (    (    s<   lib/python2.7/site-packages/numba/tests/test_nested_calls.pyt   innerJ   s    c         ` s   ˆ  |  ƒ r t  St Sd  S(   N(   R+   t   False(   R   (   R/   (    s<   lib/python2.7/site-packages/numba/tests/test_nested_calls.pyt   outerN   s    (   R   R+   t   assertFalset
   assertTrueR0   (   R'   R1   (    (   R/   s<   lib/python2.7/site-packages/numba/tests/test_nested_calls.pyt   test_boolean_returnI   s    t	   importantc         C` sB   |  j  t | ƒ \ } } | d d d ƒ | d d d d d ƒd S(   sM   
        Test a nested function call with named (keyword) arguments.
        i   i   i   R   R   N(   R.   R   (   R'   R,   t   cfuncR(   (    (    s<   lib/python2.7/site-packages/numba/tests/test_nested_calls.pyt   test_named_argsX   s    c         C` s   |  j  d t ƒ d  S(   NR,   (   R7   R+   (   R'   (    (    s<   lib/python2.7/site-packages/numba/tests/test_nested_calls.pyt   test_named_args_objmodea   s    c         C` sB   |  j  t | ƒ \ } } | d d d ƒ | d d d d d ƒd S(   sL   
        Test a nested function call using default argument values.
        i   i   i   R   R   N(   R.   R   (   R'   R,   R6   R(   (    (    s<   lib/python2.7/site-packages/numba/tests/test_nested_calls.pyt   test_default_argsd   s    c         C` s   |  j  d t ƒ d  S(   NR,   (   R9   R+   (   R'   (    (    s<   lib/python2.7/site-packages/numba/tests/test_nested_calls.pyt   test_default_args_objmodem   s    c         C` s)   |  j  t ƒ \ } } | d d d ƒ d S(   sX   
        Test a nested function call to a function with *args in its signature.
        i   i   i   N(   R.   R   (   R'   R6   R(   (    (    s<   lib/python2.7/site-packages/numba/tests/test_nested_calls.pyt   test_star_argsp   s    c         C` s,   |  j  t | ƒ \ } } | d d d ƒ d S(   s4   
        Test a function call with a *args.
        i   i   i   N(   i   (   i   (   R.   R   (   R'   R,   R6   R(   (    (    s<   lib/python2.7/site-packages/numba/tests/test_nested_calls.pyt   test_star_callx   s    c         C` s   |  j  d t ƒ d  S(   NR,   (   R<   R+   (   R'   (    (    s<   lib/python2.7/site-packages/numba/tests/test_nested_calls.pyt   test_star_call_objmode€   s    c         C` s3   |  j  t ƒ \ } } | d d ƒ | d d ƒ d S(   sm   
        Issue #1488: implicitly casting an argument variable should not
        break nested calls.
        i   i    N(   R.   R   (   R'   R6   R(   (    (    s<   lib/python2.7/site-packages/numba/tests/test_nested_calls.pyt   test_argcastƒ   s    c         C` sK   t  d t ƒ t ƒ } |  j | d d ƒ d ƒ |  j | d d ƒ d
 ƒ d S(   sJ   
        Test a nested function call to a generated jit function.
        R   i   i   iüÿÿÿy              ð?i   N(   iüÿÿÿi   y      @      ð?(   y      @      ð?i   (   R   R+   R   R!   (   R'   R6   (    (    s<   lib/python2.7/site-packages/numba/tests/test_nested_calls.pyt   test_call_generatedŒ   s    (   t   __name__t
   __module__R0   R.   R4   R
   R7   R8   R9   R:   R;   R<   R=   R>   R?   (    (    (    s<   lib/python2.7/site-packages/numba/tests/test_nested_calls.pyR    >   s   										t   __main__N(   t   __doc__t
   __future__R    R   R   t   numbaR   R   R   R   R   R   t   unittestt   supportR	   R
   R+   R   R   R   R   R   R   R   R   R   R   R   R    R@   t   main(    (    (    s<   lib/python2.7/site-packages/numba/tests/test_nested_calls.pyt   <module>   s,   							X