
    ~b                     6    d dl mZmZ ddlmZ  G d de      Zy)   )	AutomatonNoTransition    )TestCasec                   .    e Zd ZdZd Zd Zd Zd Zd Zy)	CoreTestszN
    Tests for Automat's (currently private, implementation detail) core.
    c                 2   | j                  t              5  t                ddd       d}d}t        ||      }| j                  |j                  |       | j                  |t        |             | j                  |t        |             y# 1 sw Y   mxY w)zj
        A L{NoTransition} exception describes the state and input symbol
        that caused it.
        Nzcurrent-stateztransitionless-symbol)statesymbol)assertRaises	TypeErrorr   assertIsr   assertInstr)selfr
   r   noTransitionExceptions       9/usr/lib/python3/dist-packages/automat/_test/test_core.pytest_NoTransitionzCoreTests.test_NoTransition   s     y) 	N	  ( ,5 H+22F;eS!678fc"789	 	s   BBc                 \    t               }| j                  t        |j                  dd       y)zx
        L{Automaton.outputForInput} raises L{NoTransition} if no
        transition for that input is defined.
        zno-statez	no-symbolN)r   r   r   outputForInputr   as     r   test_noOutputForInputzCoreTests.test_noOutputForInput   s(    
 K,(8(8$k	3    c                 T   t               }|j                  ddddg       | j                  |j                         dh       | j                  |j	                         dh       | j                  |j                  dd      ddgf       | j                  |j                         ddh       y)a  
        L{Automaton.addTransition} adds its input symbol to
        L{Automaton.inputAlphabet}, all its outputs to
        L{Automaton.outputAlphabet}, and causes L{Automaton.outputForInput} to
        start returning the new state and output symbols.
        	beginningbeginendingendN)r   addTransitionassertEqualinputAlphabetoutputAlphabetr   statesr   s     r   test_oneTransitionzCoreTests.test_oneTransition(   s     K	Wh@*WI6))+eW5))+w?"UG,	.k8%<=r   c                 \   t               }d}| j                  t        |j                  ddd|       | j	                  |j                                | j	                  |j                                | j	                  |j                                | j	                  |j                                y)z
        L{Automaton.addTransition} raises a TypeError when given outputs
        that aren't iterable and doesn't add any transitions.
           	fromState	viaSymboltoStateN)	r   r   r   r    assertFalser"   r#   r$   allTransitions)r   r   nonIterableOutputss      r   %test_oneTransition_nonIterableOutputsz/CoreTests.test_oneTransition_nonIterableOutputs8   s    
 KOOi1C	E 	*+))+,$))+,r   c                     t               }d|_        | j                  |j                  d       | j                  t              5  d|_        ddd       y# 1 sw Y   yxY w)z
        L{Automaton.initialState} is a descriptor that sets the initial
        state if it's not yet set, and raises L{ValueError} if it is.

        za statezanother stateN)r   initialStater!   r   
ValueErrorr   s     r   test_initialStatezCoreTests.test_initialStateI   sP     K"3z* 	-,AN	- 	- 	-s   AAN)	__name__
__module____qualname____doc__r   r   r%   r.   r2    r   r   r   r      s     :&3> -"
-r   r   N)_corer   r   unittestr   r   r7   r   r   <module>r:      s    + M- M-r   