3 § fNã@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/python36/lib64/python3.6/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. NcCstƒ|_tƒ|_dS)N)rÚtextÚ UndoDelegatorZundo)r ZflistÚfilenameÚkeyÚrootr r r r +szEditor.__init__cCs |jjdƒ}|jjdƒ}||fS)Nz1.0Úend)rÚindex)r ÚfirstZlastr r r Úget_selection_indices/s  zEditor.get_selection_indices)NNNN)rrrrr rr r r r r(s rc@s eZdZdZdd„Zdd„ZdS)rz0Minimally imitate undo.UndoDelegator class. cGsdS)Nr )rr r r Úundo_block_start9szUndoDelegator.undo_block_startcGsdS)Nr )rr r r Úundo_block_stop;szUndoDelegator.undo_block_stopN)rrrrrr r r r r r5srN)rZidlelib.idle_test.mock_tkrrrrr r r r Ús