3 2a-@s"ddlmZddlZddlmZddlmZddlZddlmZddl m Z Gdddej Z Gd d d ej Z Gd d d ej ZejZGd ddej ZGdddej ZGdddej ZGdddej ZGdddej ZGdddej ZGdddej ZedkrejddddS))queryN)requires)Tk)mock)Varc@sBeZdZGdddZddZddZddZd d Zd d Zd S) QueryTestc@sFeZdZejjZejjZejjZeZ iZ ddZ ddZ ddZ dS)zQueryTest.Dummy_QuerycCs&|jj|d|jd<d|_d|_dS)NtextF)entryset entry_errorresult destroyed)self dummy_entryr//opt/alt/python36/lib64/python3.6/test_query.py__init__#s  zQueryTest.Dummy_Query.__init__cCs||jd<dS)Nr )r )rmessagerrr showerror(szQueryTest.Dummy_Query.showerrorcCs d|_dS)NT)r)rrrrdestroy*szQueryTest.Dummy_Query.destroyN)__name__ __module__ __qualname__rQueryentry_okokcancelrr r rrrrrrr Dummy_QuerysrcCsD|jd}|j|jd|j|j|jfd|jd|jddS)N Fz blank liner )NF)r assertEqualrr rassertInr )rdialogrrrtest_entry_ok_blank-s zQueryTest.test_entry_ok_blankcCsD|jd}|j}||jd||j|jfd||jdddS)Nz good goodFr r)NF)rr rr rr )rr"Equalrrrtest_entry_ok_good3s  zQueryTest.test_entry_ok_goodcCsT|jd}tj|j_|j|jd|j|jjj|j`|j|j |j fddS)NrF)NF) rrMockr Z focus_setr r assertTruecalledr r)rr"rrr test_ok_blank:s   zQueryTest.test_ok_blankcCs2|jd}|j|jd|j|j|jfddS)Nr$T)r$T)rr rr r)rr"rrr test_ok_goodBs zQueryTest.test_ok_goodcCs2|jd}|j|jd|j|j|jfddS)Nzdoes not matterT)NT)rr rr r)rr"rrr test_cancelGs zQueryTest.test_cancelN) rrrrr#r&r*r+r,rrrrrs rc@s:eZdZGdddZddZddZddZd d Zd S) SectionNameTestc@s4eZdZejjZdgZeZiZ ddZ ddZ dS)z!SectionNameTest.Dummy_SectionNameusedcCs|jj|d|jd<dS)Nrr )r r r )rrrrrrUs z*SectionNameTest.Dummy_SectionName.__init__cCs||jd<dS)Nr )r )rrrrrrXsz+SectionNameTest.Dummy_SectionName.showerrorN) rrrr SectionNamer used_namesrr r rrrrrrDummy_SectionNamePs r1cCs0|jd}|j|jd|jd|jddS)Nrzno namer )r1r rr!r )rr"rrrtest_blank_section_name[s z'SectionNameTest.test_blank_section_namecCs0|jd}|j|jd|jd|jddS)Nr.Zuser )r1r rr!r )rr"rrrtest_used_section_name`s z&SectionNameTest.test_used_section_namecCs4|jdd}|j|jd|jd|jddS)Nr$zlonger than 30r )r1r rr!r )rr"rrrtest_long_section_nameesz&SectionNameTest.test_long_section_namecCs0|jd}|j|jd|j|jdddS)Nz good r$r r)r1r rr )rr"rrrtest_good_section_namejs z&SectionNameTest.test_good_section_nameN)rrrr1r2r3r5r6rrrrr-Ms  r-c@s:eZdZGdddZddZddZddZd d Zd S) ModuleNameTestc@s2eZdZejjZdZeZiZ ddZ ddZ dS)zModuleNameTest.Dummy_ModuleNamercCs|jj|d|jd<dS)Nrr )r r r )rrrrrrxs z(ModuleNameTest.Dummy_ModuleName.__init__cCs||jd<dS)Nr )r )rrrrrr{sz)ModuleNameTest.Dummy_ModuleName.showerrorN) rrrr ModuleNamertext0rr r rrrrrrDummy_ModuleNamess r:cCs0|jd}|j|jd|jd|jddS)Nrzno namer )r:r rr!r )rr"rrrtest_blank_module_name~s z%ModuleNameTest.test_blank_module_namecCs0|jd}|j|jd|jd|jddS)NZ __name_xyz123_should_not_exist__z not foundr )r:r rr!r )rr"rrrtest_bogus_module_names z%ModuleNameTest.test_bogus_module_namecCs0|jd}|j|jd|jd|jddS)N itertoolsz source-basedr )r:r rr!r )rr"rrrtest_c_source_names z!ModuleNameTest.test_c_source_namecCs4|jd}|j|jjd|j|jdddS)Nidlelibz __init__.pyr r)r:r(rendswithr r )rr"rrrtest_good_module_names z$ModuleNameTest.test_good_module_nameN)rrrr:r;r<r>rArrrrr7ps  r7c@s"eZdZGdddZddZdS)HelpsourceBrowsefileTestc@seZdZejjZeZdS)z)HelpsourceBrowsefileTest.Dummy_HelpSourceN)rrrr HelpSource browse_filerpathvarrrrrDummy_HelpSourcesrFc Cs|j}xddddfdddtfddddfdddtffD]J\}}}|j2|jj|||_|j|j|jj|WdQRXq>WdS)NrcSsdS)Nrr)abcrrrszBHelpsourceBrowsefileTest.test_file_replaces_path..cSstS)N)__file__)rGrHrIrrrrJsZhtestcSsdS)Nrr)rGrHrIrrrrJscSstS)N)rK)rGrHrIrrrrJs) rFrKsubTestrEr Z askfilenamerDr get)rr"pathfuncr rrrtest_file_replaces_paths     z0HelpsourceBrowsefileTest.test_file_replaces_pathN)rrrrFrPrrrrrBsrBc@sFeZdZGdddZeddZddZddZd d Zd d Z d S)HelpsourcePathokTestc@s0eZdZejjZeZiZddZ dddZ dS)z%HelpsourcePathokTest.Dummy_HelpSourcecCs|jj|d|jd<dS)Nrr )rNr path_error)rZ dummy_pathrrrrs z.HelpsourcePathokTest.Dummy_HelpSource.__init__NcCs||jd<dS)Nr )rR)rrZwidgetrrrrsz/HelpsourcePathokTest.Dummy_HelpSource.showerror)N) rrrrrCpath_okrrNrRrrrrrrrFs rFcCs tt_dS)N) orig_platformrplatform)clsrrr tearDownClasssz"HelpsourcePathokTest.tearDownClasscCs0|jd}|j|jd|jd|jddS)Nrz no help filer )rFr rSr!rR)rr"rrrtest_path_ok_blanks z'HelpsourcePathokTest.test_path_ok_blankcCs4|jtd}|j|jd|jd|jddS)Nz bad-bad-badz not existr )rFrKr rSr!rR)rr"rrrtest_path_ok_badsz%HelpsourcePathokTest.test_path_ok_badc Csd|jd}|j}xNdD]F}|j4|jj||j|j||j|jddWdQRXqWdS)Nr www.py.org http://py.orgr )rZr[)rFr rLrNr rSrR)rr"r%Zurlrrrtest_path_ok_webs    z%HelpsourcePathokTest.test_path_ok_webc Csl|jd}x\dD]T\}}|j>|t_|jjt|j|j|t|j|j ddWdQRXqWdS) Nrdarwinfile://otherr r]r^r_r)r`ra) rFrLrrUrNr rKr rSrR)rr"rUprefixrrrtest_path_ok_files   z&HelpsourcePathokTest.test_path_ok_fileN) rrrrF classmethodrWrXrYr\rcrrrrrQs   rQc@s"eZdZGdddZddZdS)HelpsourceEntryokTestc@s,eZdZejjZiZiZddZddZ dS)z&HelpsourceEntryokTest.Dummy_HelpSourcecCs|jS)N)name)rrrritem_oksz.HelpsourceEntryokTest.Dummy_HelpSource.item_okcCs|jS)N)rN)rrrrrSsz.HelpsourceEntryokTest.Dummy_HelpSource.path_okN) rrrrrCrr rRrgrSrrrrrFs rFc CsR|j}xDdD]<\}}}|j$|||_|_|j|j|WdQRXqWdS) Ndoc.txtdocNNNNrhNriNNrirhrirhrm)rjrkrlrn)rFrLrfrNr r)rr"rfrNr rrrtest_entry_ok_helpsources z.HelpsourceEntryokTest.test_entry_ok_helpsourceN)rrrrFrorrrrres rec@sDeZdZeddZeddZddZddZd d Zd d Z d S) QueryGuiTestcCsBtdt|_}|jjtj|dddd|_tj|j_ dS)NguiZTESTZtestT)_utest) rrrootwithdrawrrr"rr'r)rVrsrrr setUpClasss   zQueryGuiTest.setUpClasscCs|j`|`|jj|`dS)N)r"rrs)rVrrrrWs zQueryGuiTest.tearDownClasscCs(|jjjddd|j_|jjjdS)Nrend)r"r deleter rZ reset_mock)rrrrsetUpszQueryGuiTest.setUpcCs>|j}|jjdd|jj|j|jd|j|jj dS)Nrabc) r"r insert button_okinvoker r r(rr))rr"rrr test_click_ok s  zQueryGuiTest.test_click_okcCs0|j}|jj|j|jd|j|jjdS)N)r"r{r|r r Z assertFalserr))rr"rrrtest_click_blanks zQueryGuiTest.test_click_blankcCs>|j}|jjdd|jj|j|jd|j|jj dS)Nrry) r"r rzZ button_cancelr|r r r(rr))rr"rrrtest_click_cancels  zQueryGuiTest.test_click_cancelN) rrrrdrurWrxr}r~rrrrrrps   rpc@s eZdZeddZddZdS)SectionnameGuiTestcCs tddS)Nrq)r)rVrrrru$szSectionnameGuiTest.setUpClasscCspt}|jtj|dddhdd}|j}|j|jdh|jjdd|jj |j|j d~|j ~dS)NTtryT)rrrZokay) rrtrr/r r0r rzr{r|r r)rrsr"r%rrrtest_click_section_name(s z*SectionnameGuiTest.test_click_section_nameN)rrrrdrurrrrrr"s rc@s eZdZeddZddZdS)ModulenameGuiTestcCs tddS)Nrq)r)rVrrrru8szModulenameGuiTest.setUpClasscCsnt}|jtj|ddddd}|j|jd|j|jjd|jj |j |j j d~|j ~dS)Nrrr?T)rrz __init__.py)rrtrr8r r9r rMr{r|r(r r@r)rrsr"rrrtest_click_module_name<s z(ModulenameGuiTest.test_click_module_nameN)rrrrdrurrrrrr6s rc@s eZdZeddZddZdS)HelpsourceGuiTestcCs tddS)Nrq)r)rVrrrruKszHelpsourceGuiTest.setUpClasscCst}|jtj|ddtdd}|j}||jjd||jjt|j j t j dkr`dnd}||j d|tf~|j~dS)NrZ__test__T)Zmenuitemfilepathrrr]zfile://r)rrtrrCrKr r rMrNr{r|sysrUr r)rrsr"r%rbrrrtest_click_help_sourceOs   z(HelpsourceGuiTest.test_click_help_sourceN)rrrrdrurrrrrrIs r__main__F) verbosityexit)r?rZunittestZ test.supportrZtkinterrrrZidlelib.idle_test.mock_tkrZTestCaserr-r7rUrTrBrQrerprrrrmainrrrr s&     5#%.+