B � f��@s>dZddlmZGdd�d�ZGdd�d�ZGdd�d�Zd S) zqMock classes that imitate idlelib modules or classes. Attributes and methods will be added as needed for tests. �)�Textc@s"eZdZdZddd�Zdd�ZdS) �FuncaZRecord 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. NFcCs"d|_||_||_d|_d|_dS)Nr)�called�result� return_self�args�kwds)�selfrr�r �@/opt/alt/python37/lib64/python3.7/idlelib/idle_test/mock_idle.py�__init__s z Func.__init__cOsB|jd7_||_||_t|jt�r.|j�n|jr8|S|jSdS)N�)rrr� isinstancer� BaseExceptionr)r rrr r r �__call__s z Func.__call__)NF)�__name__� __module__� __qualname__�__doc__r rr r r r rs  rc@s"eZdZdZddd�Zdd�ZdS)�Editorz1Minimally imitate editor.EditorWindow class. NcCs|pt�|_t�|_dS)N)r�text� UndoDelegatorZundo)r Zflist�filename�key�rootrr r r r +s zEditor.__init__cCs |j�d�}|j�d�}||fS)Nz1.0�end)r�index)r �firstZlastr r r �get_selection_indices0s  zEditor.get_selection_indices)NNNNN)rrrrr rr r r r r(s rc@s eZdZdZdd�Zdd�ZdS)rz0Minimally imitate undo.UndoDelegator class. cGsdS)Nr )rr r r �undo_block_start:szUndoDelegator.undo_block_startcGsdS)Nr )rr r r �undo_block_stop<szUndoDelegator.undo_block_stopN)rrrrrr r r r r r6srN)rZidlelib.idle_test.mock_tkrrrrr r r r �s