
    ;e                     d    d Z ddlmZ  G d d          Z G d d          Z G d d          Zd	S )
zqMock classes that imitate idlelib modules or classes.

Attributes and methods will be added as needed for tests.
    )Textc                        e Zd ZdZddZd ZdS )FuncaZ  Record call, capture args, return/raise result set by test.

    When mock function is called, set or use attributes:
    self.called - increment call number even if no args, kwds passed.
    self.args - capture positional arguments.
    self.kwds - capture keyword arguments.
    self.result - return or raise value set in __init__.
    self.return_self - return self instead, to mock query class return.

    Most common use will probably be to mock instance methods.
    Given class instance, can set and delete as instance attribute.
    Mock_tk.Var and Mbox_func are special variants of this.
    NFc                 L    d| _         || _        || _        d | _        d | _        d S )Nr   )calledresultreturn_selfargskwds)selfr   r	   s      2/usr/lib/python3.11/idlelib/idle_test/mock_idle.py__init__zFunc.__init__   s*    &				    c                     | xj         dz  c_         || _        || _        t          | j        t
                    r| j        | j        r| S | j        S )N   )r   r
   r   
isinstancer   BaseExceptionr	   )r   r
   r   s      r   __call__zFunc.__call__   sT    q		dk=11 	+ 	K;r   )NF)__name__
__module____qualname____doc__r   r    r   r   r   r      sA            	 	 	 	 	r   r   c                   $    e Zd ZdZ	 	 ddZd ZdS )Editorz1Minimally imitate editor.EditorWindow class.
    Nc                 V    |pt                      | _        t                      | _        d S N)r   textUndoDelegatorundo)r   flistfilenamekeyrootr   s         r   r   zEditor.__init__+   s     NDFF	!OO			r   c                 r    | j                             d          }| j                             d          }||fS )Nz1.0end)r   index)r   firstlasts      r   get_selection_indiceszEditor.get_selection_indices0   s2    	&&yu%%d{r   )NNNNN)r   r   r   r   r   r*   r   r   r   r   r   (   sG         AE$ $ $ $
    r   r   c                       e Zd ZdZd Zd ZdS )r   z0Minimally imitate undo.UndoDelegator class.
    c                      d S r   r   r
   s    r   undo_block_startzUndoDelegator.undo_block_start:       r   c                      d S r   r   r-   s    r   undo_block_stopzUndoDelegator.undo_block_stop<   r/   r   N)r   r   r   r   r.   r1   r   r   r   r   r   6   s<               r   r   N)r   idlelib.idle_test.mock_tkr   r   r   r   r   r   r   <module>r3      s    
 + * * * * *       @                r   