/opt/alt/python27/lib64/python2.7/idlelib/idle_test
NameSizeModeActions
htest.py137790644editdlrm
htest.pyc126520644editdlrm
htest.pyo126520644editdlrm
mock_idle.py15970644editdlrm
mock_idle.pyc30090644editdlrm
mock_idle.pyo30090644editdlrm
mock_tk.py115740644editdlrm
mock_tk.pyc127130644editdlrm
mock_tk.pyo127130644editdlrm
README.txt54920644editdlrm
test_autocomplete.py49220644editdlrm
test_autocomplete.pyc61200644editdlrm
test_autocomplete.pyo61200644editdlrm
test_autoexpand.py41220644editdlrm
test_autoexpand.pyc49620644editdlrm
test_autoexpand.pyo49620644editdlrm
test_calltips.py71400644editdlrm
test_calltips.pyc127680644editdlrm
test_calltips.pyo127680644editdlrm
test_configdialog.py7820644editdlrm
test_configdialog.pyc17200644editdlrm
test_configdialog.pyo17200644editdlrm
test_config_name.py24720644editdlrm
test_config_name.pyc41810644editdlrm
test_config_name.pyo41810644editdlrm
test_delegator.py12940644editdlrm
test_delegator.pyc13580644editdlrm
test_delegator.pyo13580644editdlrm
test_editmenu.py31670644editdlrm
test_editmenu.pyc45690644editdlrm
test_editmenu.pyo45690644editdlrm
test_formatparagraph.py143440644editdlrm
test_formatparagraph.pyc147080644editdlrm
test_formatparagraph.pyo147080644editdlrm
test_grep.py27620644editdlrm
test_grep.pyc39030644editdlrm
test_grep.pyo39030644editdlrm
test_helpabout.py16110644editdlrm
test_helpabout.pyc24410644editdlrm
test_helpabout.pyo24410644editdlrm
test_hyperparser.py56840644editdlrm
test_hyperparser.pyc69420644editdlrm
test_hyperparser.pyo69420644editdlrm
test_idlehistory.py54950644editdlrm
test_idlehistory.pyc84800644editdlrm
test_idlehistory.pyo84800644editdlrm
test_io.py95050644editdlrm
test_io.pyc119490644editdlrm
test_io.pyo119490644editdlrm
test_parenmatch.py38220644editdlrm
test_parenmatch.pyc56640644editdlrm
test_parenmatch.pyo56640644editdlrm
test_pathbrowser.py9400644editdlrm
test_pathbrowser.pyc15370644editdlrm
test_pathbrowser.pyo15370644editdlrm
test_rstrip.py16130644editdlrm
test_rstrip.pyc18250644editdlrm
test_rstrip.pyo18250644editdlrm
test_searchdialogbase.py58630644editdlrm
test_searchdialogbase.pyc70350644editdlrm
test_searchdialogbase.pyo70350644editdlrm
test_searchengine.py114870644editdlrm
test_searchengine.pyc131170644editdlrm
test_searchengine.pyo131170644editdlrm
test_text.py67440644editdlrm
test_text.pyc83950644editdlrm
test_text.pyo83950644editdlrm
test_textview.py28020644editdlrm
test_textview.pyc47130644editdlrm
test_textview.pyo47130644editdlrm
test_warning.py27570644editdlrm
test_warning.pyc33900644editdlrm
test_warning.pyo33900644editdlrm
test_widgetredir.py41770644editdlrm
test_widgetredir.pyc66440644editdlrm
test_widgetredir.pyo66440644editdlrm
__init__.py6500644editdlrm
__init__.pyc9410644editdlrm
__init__.pyo9410644editdlrm
Edit: /opt/alt/python27/lib64/python2.7/idlelib/idle_test/test_parenmatch.py (3822B)
"""Test idlelib.ParenMatch.""" # This must currently be a gui test because ParenMatch methods use # several text methods not defined on idlelib.idle_test.mock_tk.Text. import unittest from test.test_support import requires from Tkinter import Tk, Text from idlelib.ParenMatch import ParenMatch class Mock: # 2.7 does not have unittest.mock def __init__(self, *args, **kwargs): self.called = False def __call__(self, *args, **kwargs): self.called = True def reset_mock(self, *args, **kwargs): self.called = False def after(self, *args, **kwargs): pass class DummyEditwin: def __init__(self, text): self.text = text self.indentwidth = 8 self.tabwidth = 8 self.context_use_ps1 = True class ParenMatchTest(unittest.TestCase): @classmethod def setUpClass(cls): requires('gui') cls.root = Tk() cls.text = Text(cls.root) cls.editwin = DummyEditwin(cls.text) cls.editwin.text_frame = Mock() @classmethod def tearDownClass(cls): del cls.text, cls.editwin cls.root.destroy() del cls.root def tearDown(self): self.text.delete('1.0', 'end') def test_paren_expression(self): """ Test ParenMatch with 'expression' style. """ text = self.text pm = ParenMatch(self.editwin) pm.set_style('expression') text.insert('insert', 'def foobar(a, b') pm.flash_paren_event('event') self.assertIn('<>', text.event_info()) self.assertTupleEqual(text.tag_prevrange('paren', 'end'), ('1.10', '1.15')) text.insert('insert', ')') pm.restore_event() self.assertNotIn('<>', text.event_info()) self.assertEqual(text.tag_prevrange('paren', 'end'), ()) # paren_closed_event can only be tested as below pm.paren_closed_event('event') self.assertTupleEqual(text.tag_prevrange('paren', 'end'), ('1.10', '1.16')) def test_paren_default(self): """ Test ParenMatch with 'default' style. """ text = self.text pm = ParenMatch(self.editwin) pm.set_style('default') text.insert('insert', 'def foobar(a, b') pm.flash_paren_event('event') self.assertIn('<>', text.event_info()) self.assertTupleEqual(text.tag_prevrange('paren', 'end'), ('1.10', '1.11')) text.insert('insert', ')') pm.restore_event() self.assertNotIn('<>', text.event_info()) self.assertEqual(text.tag_prevrange('paren', 'end'), ()) def test_paren_corner(self): """ Test corner cases in flash_paren_event and paren_closed_event. These cases force conditional expression and alternate paths. """ text = self.text pm = ParenMatch(self.editwin) text.insert('insert', '# this is a commen)') self.assertIsNone(pm.paren_closed_event('event')) text.insert('insert', '\ndef') self.assertIsNone(pm.flash_paren_event('event')) self.assertIsNone(pm.paren_closed_event('event')) text.insert('insert', ' a, *arg)') self.assertIsNone(pm.paren_closed_event('event')) def test_handle_restore_timer(self): pm = ParenMatch(self.editwin) pm.restore_event = Mock() pm.handle_restore_timer(0) self.assertTrue(pm.restore_event.called) pm.restore_event.reset_mock() pm.handle_restore_timer(1) self.assertFalse(pm.restore_event.called) if __name__ == '__main__': unittest.main(verbosity=2)