
    }e	                     f    d Z ddlZddlmZ ddlmZ  G d de      Z G d de      Zd	 Z	d
 Z
d Zy)z!Tests for CommandChainDispatcher.    N)TryNext)CommandChainDispatcherc                       e Zd Zd Zd Zy)Okayc                      || _         d| _        y NFmessagecalledselfr
   s     ?/usr/lib/python3/dist-packages/IPython/core/tests/test_hooks.py__init__zOkay.__init__           c                 (    d| _         | j                  S NT)r   r
   r   s    r   __call__zOkay.__call__   s    ||r   N__name__
__module____qualname__r   r    r   r   r   r      s    r   r   c                       e Zd Zd Zd Zy)Failc                      || _         d| _        y r   r	   r   s     r   r   zFail.__init__   r   r   c                 :    d| _         t        | j                        r   )r   r   r
   r   s    r   r   zFail.__call__   s    dll##r   Nr   r   r   r   r   r      s    $r   r   c                  0   t        d      } t        d      }t        d| fd|fg      }t        j                  t              5 } |        ddd       t        j                        dk(  sJ | j                  du sJ |j                  du sJ y# 1 sw Y   DxY w)zTest two failing hooksfail1fail2r   
   NT)r   r   pytestraisesr   strvaluer   )r    r!   dpes       r    test_command_chain_dispatcher_ffr)   '   s    MEME	!Ub%[ 9	:B	w	 1
qww<7"""<<4<<4 s   BBc                  @   t        d      } t        d      }t        d      }t        d      }t        d| fd|fd|fg      }|j                  |d        |       dk(  sJ | j                  d	u sJ |j                  d	u sJ |j                  d
u sJ |j                  d
u sJ y)z/Test a mixture of failing and succeeding hooks.r    r!   okay1okay2r   r"         TFN)r   r   r   addr   )r    r!   r+   r,   r'   s        r   "test_command_chain_dispatcher_fofor0   4   s    MEMEMEME	!U"$e"$e!. 
/B FF5!47??<<4<<4<<5   <<5   r   c                  p    t        d      } t        d      }t        d| fg      }|j                  |d       y )Nr+   r,      )r   r   r/   )r+   r,   r'   s      r   )test_command_chain_dispatcher_eq_priorityr3   H   s2    NENE	!U	-BFF5!r   )__doc__r#   IPython.core.errorr   IPython.core.hooksr   objectr   r   r)   r0   r3   r   r   r   <module>r8      s:    '  & 56 $6 $ !(r   