/opt/alt/python37/lib64/python3.7/idlelib/idle_test
"Test search, coverage 69%." from idlelib import search import unittest from test.support import requires requires('gui') from tkinter import Tk, Text, BooleanVar from idlelib import searchengine # Does not currently test the event handler wrappers. # A usage test should simulate clicks and check highlighting. # Tests need to be coordinated with SearchDialogBase tests # to avoid duplication. class SearchDialogTest(unittest.TestCase): @classmethod def setUpClass(cls): cls.root = Tk() @classmethod def tearDownClass(cls): cls.root.destroy() del cls.root def setUp(self): self.engine = searchengine.SearchEngine(self.root) self.dialog = search.SearchDialog(self.root, self.engine) self.dialog.bell = lambda: None self.text = Text(self.root) self.text.insert('1.0', 'Hello World!') def test_find_again(self): # Search for various expressions text = self.text self.engine.setpat('') self.assertFalse(self.dialog.find_again(text)) self.dialog.bell = lambda: None self.engine.setpat('Hello') self.assertTrue(self.dialog.find_again(text)) self.engine.setpat('Goodbye') self.assertFalse(self.dialog.find_again(text)) self.engine.setpat('World!') self.assertTrue(self.dialog.find_again(text)) self.engine.setpat('Hello World!') self.assertTrue(self.dialog.find_again(text)) # Regular expression self.engine.revar = BooleanVar(self.root, True) self.engine.setpat('W[aeiouy]r') self.assertTrue(self.dialog.find_again(text)) def test_find_selection(self): # Select some text and make sure it's found text = self.text # Add additional line to find self.text.insert('2.0', 'Hello World!') text.tag_add('sel', '1.0', '1.4') # Select 'Hello' self.assertTrue(self.dialog.find_selection(text)) text.tag_remove('sel', '1.0', 'end') text.tag_add('sel', '1.6', '1.11') # Select 'World!' self.assertTrue(self.dialog.find_selection(text)) text.tag_remove('sel', '1.0', 'end') text.tag_add('sel', '1.0', '1.11') # Select 'Hello World!' self.assertTrue(self.dialog.find_selection(text)) # Remove additional line text.delete('2.0', 'end') if __name__ == '__main__': unittest.main(verbosity=2, exit=2)
.
Edit
..
Edit
README.txt
Edit
__init__.py
Edit
__pycache__
Edit
htest.py
Edit
mock_idle.py
Edit
mock_tk.py
Edit
template.py
Edit
test_autocomplete.py
Edit
test_autocomplete_w.py
Edit
test_autoexpand.py
Edit
test_browser.py
Edit
test_calltip.py
Edit
test_calltip_w.py
Edit
test_codecontext.py
Edit
test_colorizer.py
Edit
test_config.py
Edit
test_config_key.py
Edit
test_configdialog.py
Edit
test_debugger.py
Edit
test_debugger_r.py
Edit
test_debugobj.py
Edit
test_debugobj_r.py
Edit
test_delegator.py
Edit
test_editmenu.py
Edit
test_editor.py
Edit
test_filelist.py
Edit
test_format.py
Edit
test_grep.py
Edit
test_help.py
Edit
test_help_about.py
Edit
test_history.py
Edit
test_hyperparser.py
Edit
test_iomenu.py
Edit
test_macosx.py
Edit
test_mainmenu.py
Edit
test_multicall.py
Edit
test_outwin.py
Edit
test_parenmatch.py
Edit
test_pathbrowser.py
Edit
test_percolator.py
Edit
test_pyparse.py
Edit
test_pyshell.py
Edit
test_query.py
Edit
test_redirector.py
Edit
test_replace.py
Edit
test_rpc.py
Edit
test_run.py
Edit
test_runscript.py
Edit
test_scrolledlist.py
Edit
test_search.py
Edit
test_searchbase.py
Edit
test_searchengine.py
Edit
test_sidebar.py
Edit
test_squeezer.py
Edit
test_stackviewer.py
Edit
test_statusbar.py
Edit
test_text.py
Edit
test_textview.py
Edit
test_tooltip.py
Edit
test_tree.py
Edit
test_undo.py
Edit
test_warning.py
Edit
test_window.py
Edit
test_zoomheight.py
Edit