B „ f�ã@s¤dZddlmZddlZddlmZddlZddlmZ ddl mZ ddl m Z dZdZGd d „d ejƒZGd d „d ƒZGd d„dejƒZedkr ejddd�dS)z Test history, coverage 100%.é)ÚHistoryN)Úrequires)ÚText)ÚidleConfza = 7zb = ac@sDeZdZdZedd„ƒZdd„Zdd„Zdd „Zd d „Z d d „Z dS)Ú StoreTestz7Tests History.__init__ and History.store with mock TextcCstƒ|_t|jƒ|_dS)N)ÚmkTextÚtextrÚhistory)Úcls©r úC/opt/alt/python37/lib64/python3.7/idlelib/idle_test/test_history.pyÚ setUpClassszStoreTest.setUpClasscCs|j dd¡g|j_dS)Nz1.0Úend)rÚdeleter )Úselfr r r ÚtearDownszStoreTest.tearDownc Cs`| |jj|j¡| |jjg¡| |jj¡| |jj¡| |jjt  ddddd¡¡dS)NÚmainrÚcyclicéÚbool) ZassertIsr rÚ assertEqualÚ assertIsNoneÚprefixÚpointerrrZ GetOption)rr r r Ú test_inits  zStoreTest.test_initcCs<|j d¡| |jjg¡|j d¡| |jjg¡dS)NÚaz a )r Ústorer)rr r r Útest_store_short$s  zStoreTest.test_store_shortcCsb|j t¡| |jjtg¡|j t¡| |jjttg¡|j t¡| |jjttg¡dS)N)r rÚline1rÚline2)rr r r Útest_store_dup*s    zStoreTest.test_store_dupcCs<t|j_d|j_|j t¡| |jj¡| |jj¡dS)Nr)rr rrrrr)rr r r Útest_store_reset2s  zStoreTest.test_store_resetN) Ú__name__Ú __module__Ú __qualname__Ú__doc__Ú classmethodr rrrr r!r r r r rs rc@s$eZdZdd„Zdd„Zdd„ZdS)Ú TextWrappercCst|d�|_d|_dS)N)ÚmasterF)ÚtkTextrÚ_bell)rr(r r r Ú__init__;s zTextWrapper.__init__cCs t|j|ƒS)N)Úgetattrr)rÚnamer r r Ú __getattr__>szTextWrapper.__getattr__cCs d|_dS)NT)r*)rr r r Úbell@szTextWrapper.bellN)r"r#r$r+r.r/r r r r r':sr'c@s†eZdZdZedd„ƒZdd„Zedd„ƒZdd œd d „Zd d „Z dd„Z dd„Z dd„Z dd„Z dd„Zdd„Zdd„Zdd„ZdS)Ú FetchTestz-Test History.fetch with wrapped tk.Text. cCs tdƒt ¡|_|j ¡dS)NZgui)rÚtkZTkÚrootZwithdraw)r r r r r Gs zFetchTest.setUpClasscCsNt|jƒ|_}| dd¡| dd¡| dd¡t|ƒ|_tt g|j_dS)Nz1.0z>>> Úiomarkz1.4Úleft) r'r2rÚinsertÚmark_setZ mark_gravityrr rr)rrr r r ÚsetUpMs     zFetchTest.setUpcCs|j ¡|`dS)N)r2Zdestroy)r r r r Ú tearDownClassUs zFetchTest.tearDownClassF)r/cCsv|j}| |¡|j}||j dd¡|ƒ||jj|ƒ|rDd|j_||j|ƒ||j|ƒ||j ddd¡dƒdS)Nr3zend-1cFr5z==r) r ÚfetchrrÚgetr*rrZcompare)rÚreverseÚlinerÚindexr/rZEqualr r r Ú fetch_testZs   zFetchTest.fetch_testcCs<d}|j}|dt|dƒ|dt|dƒ|d|dddd�dS)NÚTrr)r/)r>rr)rrÚtestr r r Útest_fetch_prev_cyclicjs z FetchTest.test_fetch_prev_cycliccCs<d}|j}|dt|dƒ|dt|dƒ|d|dddd�dS)Nr?FrrT)r/)r>rr)rrr@r r r Útest_fetch_next_cyclicqs z FetchTest.test_fetch_next_cycliccCs:d}|j d|¡| dt|d¡|jd|dddd�dS)Nrr3Tr)r/)rr5r>r)rrr r r Útest_fetch_prev_prefixysz FetchTest.test_fetch_prev_prefixcCs:d}|j d|¡| dt|d¡|jd|dddd�dS)Nrr3FrT)r/)rr5r>r)rrr r r Útest_fetch_next_prefixsz FetchTest.test_fetch_next_prefixcCsDd}d|j_|j}|dt|dƒ|dt|dƒ|dt|ddd�dS)Nr?FTrr)r/)r rr>rr)rrr@r r r Útest_fetch_prev_noncyclic…s z#FetchTest.test_fetch_prev_noncycliccCsZd}d|j_|j}|d|dddd�|dt|dƒ|d|dddd�|d|dddd�dS)Nr?FT)r/r)r rr>r)rrr@r r r Útest_fetch_next_noncyclic�sz#FetchTest.test_fetch_next_noncycliccCs4|jjdd�|j dd¡|jdtdddd�dS)NT)r;r5r3)r/)r r9rr6r>r)rr r r Útest_fetch_cursor_move–sz FetchTest.test_fetch_cursor_movecCs>|jjdd�|j dd¡|j dd¡| dtdd¡dS)NT)r;r3r5za =r)r r9rrr5r>r)rr r r Útest_fetch_editœszFetchTest.test_fetch_editcCs<|j d¡| |jjd¡|j d¡| |jjd¡dS)Nz dummy eventr)r Z history_prevrrZ history_next)rr r r Útest_history_prev_next£s  z FetchTest.test_history_prev_nextN)r"r#r$r%r&r r7r8r>rArBrCrDrErFrGrHrIr r r r r0Ds   r0Ú__main__é)Ú verbosityÚexit)r%Zidlelib.historyrZunittestZ test.supportrZtkinterr1rr)Zidlelib.idle_test.mock_tkrZidlelib.configrrrZTestCaserr'r0r"rr r r r Ús     * g