3  f@sdZddlmZddlZddlmZddlZddlmZ ddl mZ ddl m Z dZdZGd d d ejZGd d d ZGd ddejZedkrejddddS)z Test history, coverage 100%.)HistoryN)requires)Text)idleConfza = 7zb = ac@sDeZdZdZeddZddZddZdd Zd d Z d d Z dS) StoreTestz7Tests History.__init__ and History.store with mock TextcCst|_t|j|_dS)N)mkTexttextrhistory)clsr C/opt/alt/python36/lib64/python3.6/idlelib/idle_test/test_history.py setUpClassszStoreTest.setUpClasscCs|jjddg|j_dS)Nz1.0end)rdeleter )selfr r r tearDownszStoreTest.tearDowncCs`|j|jj|j|j|jjg|j|jj|j|jj|j|jjtj ddddddS)Nmainrcyclicbool) ZassertIsr r assertEqual assertIsNoneprefixpointerrrZ GetOption)rr r r test_inits  zStoreTest.test_initcCs<|jjd|j|jjg|jjd|j|jjgdS)Naz a )r storer)rr r r test_store_short$s  zStoreTest.test_store_shortcCsb|jjt|j|jjtg|jjt|j|jjttg|jjt|j|jjttgdS)N)r rline1rline2)rr r r test_store_dup*s    zStoreTest.test_store_dupcCs<t|j_d|j_|jjt|j|jj|j|jjdS)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$eZdZddZddZddZdS) TextWrappercCst|d|_d|_dS)N)masterF)tkTextr_bell)rr(r r r __init__;s zTextWrapper.__init__cCs t|j|S)N)getattrr)rnamer 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@seZdZdZeddZddZeddZdd d d Zd d Z ddZ ddZ ddZ ddZ ddZddZddZddZdS) FetchTestz-Test History.fetch with wrapped tk.Text. cCs tdtj|_|jjdS)NZgui)rtkZTkrootZwithdraw)r r r r r Gs zFetchTest.setUpClasscCsNt|j|_}|jdd|jdd|jddt||_tt g|j_dS)Nz1.0z>>> iomarkz1.4left) r'r2rinsertmark_setZ mark_gravityrr rr)rrr r r setUpMs     zFetchTest.setUpcCs|jj|`dS)N)r2Zdestroy)r r r r tearDownClassUs zFetchTest.tearDownClassF)r/cCsv|j}|j||j}||jjdd|||jj||rDd|j_||j|||j|||jjdddddS)Nr3zend-1cFr5z==r) r fetchrrgetr*rrZcompare)rreverselinerindexr/rZEqualr r r fetch_testZs   zFetchTest.fetch_testcCs<d}|j}|dt|d|dt|d|d|dddddS)NTrr)r/)r>rr)rrtestr r r test_fetch_prev_cyclicjs z FetchTest.test_fetch_prev_cycliccCs<d}|j}|dt|d|dt|d|d|dddddS)Nr?FrrT)r/)r>rr)rrr@r r r test_fetch_next_cyclicqs z FetchTest.test_fetch_next_cycliccCs:d}|jjd||jdt|d|jd|dddddS)Nrr3Tr)r/)rr5r>r)rrr r r test_fetch_prev_prefixysz FetchTest.test_fetch_prev_prefixcCs:d}|jjd||jdt|d|jd|dddddS)Nrr3FrT)r/)rr5r>r)rrr r r test_fetch_next_prefixsz FetchTest.test_fetch_next_prefixcCsDd}d|j_|j}|dt|d|dt|d|dt|ddddS)Nr?FTrr)r/)r rr>rr)rrr@r r r test_fetch_prev_noncyclics z#FetchTest.test_fetch_prev_noncycliccCsZd}d|j_|j}|d|dddd|dt|d|d|dddd|d|dddddS)Nr?FT)r/r)r rr>r)rrr@r r r test_fetch_next_noncyclicsz#FetchTest.test_fetch_next_noncycliccCs4|jjdd|jjdd|jdtdddddS)NT)r;r5r3)r/)r r9rr6r>r)rr r r test_fetch_cursor_movesz FetchTest.test_fetch_cursor_movecCs>|jjdd|jjdd|jjdd|jdtdddS)NT)r;r3r5za =r)r r9rrr5r>r)rr r r test_fetch_editszFetchTest.test_fetch_editcCs<|jjd|j|jjd|jjd|j|jjddS)Nz dummy eventr)r Z history_prevrrZ history_next)rr r r test_history_prev_nexts  z FetchTest.test_history_prev_nextN)r"r#r$r%r&r r7r8r>rArBrCrDrErFrGrHrIr r r r r0Ds   r0__main__) verbosityexit)r%Zidlelib.historyrZunittestZ test.supportrZtkinterr1rr)Zidlelib.idle_test.mock_tkrZidlelib.configrrrZTestCaserr'r0r"rr r r r s     * g