σ
P'^c           @@  s  d  d l  m Z d  d l Z d  d l Z d  d l m Z d  d l m Z d  d l m	 Z	 d  d l
 m Z d  d l m Z d  d l m Z m Z m Z d	 e f d
     YZ d e f d     YZ d e f d     YZ d e f d     YZ d e f d     YZ d S(   i    (   t   absolute_importN(   t   uuid(   t   TaskSetResult(   t   Task(   t	   Signature(   t   make_mock_group(   t   AppCaset   Mockt   patcht   SetsCasec           B@  s   e  Z d    Z RS(   c         @  ss   t  j d t  6 d d l m } |   _ | j   _ | j   _ Wd  QXd t f   f d     Y} |   _ d  S(   Nt   recordi    (   t   setst   MockTaskc           @  s>   e  Z   j Z d  Z d   Z e d    Z e d    Z RS(   s	   tasks.addc         [@  s   | | S(   N(    (   t   selft   xt   yt   kwargs(    (    sG   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/compat_modules/test_sets.pyt   run   s    c         [@  s   | | | f S(   N(    (   t   clst   argsR   t   options(    (    sG   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/compat_modules/test_sets.pyt   apply_async   s    c         [@  s   | | | f S(   N(    (   R   R   R   R   (    (    sG   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/compat_modules/test_sets.pyt   apply#   s    (   t   __name__t
   __module__t   appt   nameR   t   classmethodR   R   (    (   R   (    sG   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/compat_modules/test_sets.pyR      s
   		(	   t   warningst   catch_warningst   Truet   celery.taskR   t   subtaskt   TaskSetR   R   (   R   R   R   (    (   R   sG   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/compat_modules/test_sets.pyt   setup   s    	(   R   R   R"   (    (    (    sG   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/compat_modules/test_sets.pyR	      s   t   test_TaskSetResultc           B@  s5   e  Z d    Z d   Z d   Z d   Z d   Z RS(   c         C@  s1   d |  _  t t   t |  j |  j    |  _ d  S(   Ni
   (   t   sizeR   R   R   R   t   ts(   R   (    (    sG   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/compat_modules/test_sets.pyR"   +   s    	c         C@  s   |  j  |  j j |  j  d  S(   N(   t   assertEqualR%   t   totalR$   (   R   (    (    sG   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/compat_modules/test_sets.pyt
   test_total/   s    c         C@  sB   |  j  |  j j |  j j  d |  j _ |  j  |  j j d  d  S(   Nt   foo(   R&   R%   t
   taskset_idt   id(   R   (    (    sG   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/compat_modules/test_sets.pyt   test_compat_properties2   s    c         C@  s>   t  t   d d d d g } |  j | j d d d g  d  S(   Nt   subtasksi   i   i   (   R   R   R&   t   results(   R   R   (    (    sG   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/compat_modules/test_sets.pyt   test_compat_subtasks_kwarg7   s    c         C@  sF   |  j  j   } x0 t |  D]" \ } } |  j | j   |  q Wd  S(   N(   R%   t   itersubtaskst	   enumerateR&   t   get(   R   t   itt   it   t(    (    sG   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/compat_modules/test_sets.pyt   test_itersubtasks;   s    (   R   R   R"   R(   R,   R/   R6   (    (    (    sG   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/compat_modules/test_sets.pyR#   )   s
   				t   test_Appc           B@  s   e  Z d    Z RS(   c         C@  sU   t  j d t  = |  j j   } |  j | j g   |  j | j |  j  Wd  QXd  S(   NR
   (   R   R   R   R   R!   t   assertListEqualt   taskst   assertIs(   R   R%   (    (    sG   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/compat_modules/test_sets.pyt   test_TaskSetD   s    (   R   R   R;   (    (    (    sG   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/compat_modules/test_sets.pyR7   B   s   t   test_subtaskc           B@  sY   e  Z d    Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 RS(	   c         C@  sC   |  j  d d i t d 6i d d 6 } |  j |  j  |  |  d  S(   Ns	   tasks.addi   t   caches	   CPU-boundt   routing_key(   i   i   (   R    R   t   assertDictEqual(   R   t   s(    (    sG   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/compat_modules/test_sets.pyt   test_behaves_like_typeM   s    c         C@  s2   |  j  |  j d  } |  j | j |  j j  d  S(   Ni   (   i   i   (   R    R   R&   t   taskR   (   R   R@   (    (    sG   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/compat_modules/test_sets.pyt"   test_task_argument_can_be_task_clsR   s    c         C@  s}   |  j  j d i t d 6i d d 6 } | j   \ } } } |  j | d  |  j | i t d 6 |  j | i d d 6 d  S(   Ni   R=   s	   CPU-boundR>   (   i   i   (   i   i   (   R   R    R   R   t   assertTupleEqualR?   (   R   R@   R   R   R   (    (    sG   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/compat_modules/test_sets.pyt   test_apply_asyncV   s    	c         C@  s   |  j  j d i t d 6i d d 6 } | j d d t d d \ } } } |  j | d	  |  j | i t d 6d d 6 |  j | i d d 6 d  S(
   Ni   R=   s	   CPU-boundR>   i
   t   otherR)   (   i   (   i
   i   (   R   R    R   t   delayt   FalseRD   R?   (   R   R@   R   R   R   (    (    sG   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/compat_modules/test_sets.pyt   test_delay_argmerge_   s    	$c         C@  s«   |  j  j d i t d 6i d d 6 } | j d i t d 6d d 6d d d	 d
 \ } } } |  j | d  |  j | i t d 6d d 6 |  j | i d d 6d
 d	 6 d  S(   Ni   R=   s	   CPU-boundR>   i
   R)   RF   s   IO-boundt   exchanget   fast(   i   (   i
   (   i
   i   (   R   R    R   R   RH   RD   R?   (   R   R@   R   R   R   (    (    sG   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/compat_modules/test_sets.pyt   test_apply_async_argmergeh   s    		c         C@  s«   |  j  j d i t d 6i d d 6 } | j d i t d 6d d 6d d d	 d
 \ } } } |  j | d  |  j | i t d 6d d 6 |  j | i d d 6d
 d	 6 d  S(   Ni   R=   s	   CPU-boundR>   i
   R)   RF   s   IO-boundRJ   RK   (   i   (   i
   (   i
   i   (   R   R    R   R   RH   RD   R?   (   R   R@   R   R   R   (    (    sG   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/compat_modules/test_sets.pyt   test_apply_argmergev   s    		c         C@  sg   |  j  j d i t d 6i d d 6 } t | j  | _ |  j | |  j t j t j |     d  S(   Ni   R=   s	   CPU-boundR>   (   i   (	   R   R    R   t   listR   R&   t   anyjsont   loadst   dumps(   R   R@   (    (    sG   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/compat_modules/test_sets.pyt   test_is_JSON_serializable   s    	c         C@  sL   |  j  j d i t d 6 } |  j d t |   |  j d t |   d  S(   Ni   R=   t   2s
   cache=True(   i   (   R   R    R   t   assertInt   repr(   R   R@   (    (    sG   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/compat_modules/test_sets.pyt	   test_repr   s    c         C@  sT   |  j  j d i t d 6 } | j   \ } } |  j t | |    t |   d  S(   Ni   R=   (   i   (   R   R    R   t
   __reduce__R?   t   dict(   R   R@   R   R   (    (    sG   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/compat_modules/test_sets.pyt   test_reduce   s    (   R   R   RA   RC   RE   RI   RL   RM   RR   RV   RY   (    (    (    sG   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/compat_modules/test_sets.pyR<   K   s   										R;   c           B@  sG   e  Z d    Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   c         C@  sW   |  j  g  d D] } |  j j | | f  ^ q d |  j } |  j t |  d  d  S(   Ni   i   i   R   i   (   i   i   i   (   R!   R   R    R   R&   t   len(   R   R4   R%   (    (    sG   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/compat_modules/test_sets.pyt%   test_task_arg_can_be_iterable__compat   s    	4c         C@  sΧ   |  j  } d |  j f d     Y} | g  d	 D] } |  j j | | f  ^ q, d |  j  } t | j _ | j   |  j | j	 d  t
 | j _ t d  4 } t   } | _ | j   |  j | j j  Wd  QXd  S(
   Nt   MockTaskSetc           B@  s   e  Z d  Z d   Z RS(   i    c         _@  s   |  j  d 7_  d  S(   Ni   (   t   applied(   R   R   R   (    (    sG   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/compat_modules/test_sets.pyR   ₯   s    (   R   R   R]   R   (    (    (    sG   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/compat_modules/test_sets.pyR\   ’   s   i   i   i   R   i   s(   celery.task.sets.get_current_worker_task(   i   i   i   (   R   R!   R   R    R   t   conft   CELERY_ALWAYS_EAGERR   R&   R]   RH   R   R   t   return_valuet
   assertTruet	   add_trailt   called(   R   R   R\   R4   R%   t   gwtt   parent(    (    sG   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/compat_modules/test_sets.pyt   test_respects_ALWAYS_EAGER   s    	+

c         @  s!  d g   d t  f   f d     Y} |  j g  d D] } | |  j | | f  ^ q2 d |  j } | j   |  j   d d  d	 t f d
     Y} | j d |    |  j j d t  d    } d d l	 m
 } | j   | j |  z | j d |    Wd  | j   | j   Xd  S(   Ni    t   mocksubtaskc           @  s   e  Z   f d    Z RS(   c         @  s     d c d 7<d  S(   Ni    i   (    (   R   R   R   (   R]   (    sG   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/compat_modules/test_sets.pyR   »   s    (   R   R   R   (    (   R]   (    sG   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/compat_modules/test_sets.pyRg   Ή   s   i   i   i   R   i   t	   Publisherc           B@  s   e  Z d    Z RS(   c         _@  s   d  S(   N(    (   R   R   R   (    (    sG   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/compat_modules/test_sets.pyt   sendΕ   s    (   R   R   Ri   (    (    (    sG   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/compat_modules/test_sets.pyRh   Γ   s   t	   publishert   sharedc           S@  s   d  S(   N(    (    (    (    sG   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/compat_modules/test_sets.pyt   xyzΜ   s    (   t   _task_stack(   i   i   i   (   R   R!   R   R   R   R&   t   objectRB   RH   t   celery._stateRm   t   push_requestt   pusht   popt   pop_request(   R   Rg   R4   R%   Rh   Rl   Rm   (    (   R]   sG   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/compat_modules/test_sets.pyRE   Ά   s     		4


c         @  s   d g   d t  f   f d     Y} |  j g  d	 D] } | |  j | | f  ^ q2 d |  j } | j   |  j   d d  d  S(
   Ni    Rg   c           @  s   e  Z   f d    Z RS(   c         @  s     d c d 7<d  S(   Ni    i   (    (   R   R   R   (   R]   (    sG   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/compat_modules/test_sets.pyR   ί   s    (   R   R   R   (    (   R]   (    sG   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/compat_modules/test_sets.pyRg   έ   s   i   i   i   R   i   (   i   i   i   (   R   R!   R   R   R   R&   (   R   Rg   R4   R%   (    (   R]   sG   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/compat_modules/test_sets.pyt
   test_applyΩ   s    		4
c         C@  s8   |  j  g  d |  j } d | _ |  j | j d  d  S(   NR   i*   (   R!   R   R&   (   R   R%   (    (    sG   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/compat_modules/test_sets.pyt   test_set_appη   s    	c         C@  sG   |  j  g  d |  j } d d d g | _ |  j | d d d g  d  S(   NR   i   i   i   (   R!   R   R9   R&   (   R   R%   (    (    sG   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/compat_modules/test_sets.pyt   test_set_tasksμ   s    c         C@  s8   |  j  g  d |  j } d | _ |  j | j d  d  S(   NR   i*   (   R!   R   Rh   R&   (   R   R%   (    (    sG   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/compat_modules/test_sets.pyt   test_set_Publisherρ   s    	(	   R   R   R[   Rf   RE   Rt   Ru   Rv   Rw   (    (    (    sG   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/compat_modules/test_sets.pyR;      s   			#			(   t
   __future__R    RO   R   t   celeryR   t   celery.resultR   R   R   t   celery.canvasR   t   celery.tests.tasks.test_resultR   t   celery.tests.caseR   R   R   R	   R#   R7   R<   R;   (    (    (    sG   /tmp/pip-unpacked-wheel-gV1wwp/celery/tests/compat_modules/test_sets.pyt   <module>   s   	M