
    Vh                     :    d dl mZ ddlmZmZmZ  G d de      Zy)    )TestCase   )	AutomatonNoTransitionTransitionerc                   6    e Zd ZdZd Zd	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       G/home/dcms/DCMS/lib/python3.12/site-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Nc                    t        d      }|j                  dddt        dg             |j                  ddg       t	        |d      }| j                  |j                  d      t        dg      df       | j                  |j                  d      dgdf       | j                  |j                  d      t        dg      df       y)z
        Automaton.unhandledTransition sets the outputs and end-state to be used
        for all unhandled transitions.
        startz
oops-statecheckcheckedzoops-outN)r   addTransitiontupleunhandledTransitionr   assertEqual
transition)r   ats      r   test_unhandledTransitionz"CoreTests.test_unhandledTransition   s    
 '0&8	gwyk8JK	lZL9G$g.
|1Dd0KLg.)d0CDg.
|1Dd0KL    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   r   s     r   test_noOutputForInputzCoreTests.test_noOutputForInput*   s%    
 K,(8(8*kRr"   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   r   r   inputAlphabetoutputAlphabetr$   statesr%   s     r   test_oneTransitionzCoreTests.test_oneTransition2   s     K	Wh@*WI6))+eW5))+w?(UGATU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_nonIterableOutputs@   s    
 KOO	
 	*+))+,$))+,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_initialStateT   sP     K"3z* 	-,AN	- 	- 	-s   AA)returnN)
__name__
__module____qualname____doc__r   r!   r&   r/   r8   r<    r"   r   r	   r	      s'    :$MS>-(
-r"   r	   N)unittestr   _corer   r   r   r	   rB   r"   r   <module>rE      s     9 9X- X-r"   