PATH:
lib64
/
python2.7
/
idlelib
/
idle_test
'''Test the functions and main class method of textView.py.''' import unittest import os from test.test_support import requires from Tkinter import Tk from idlelib import textView as tv from idlelib.idle_test.mock_idle import Func from idlelib.idle_test.mock_tk import Mbox class TV(tv.TextViewer): # Use in TextViewTest transient = Func() grab_set = Func() wait_window = Func() class textviewClassTest(unittest.TestCase): @classmethod def setUpClass(cls): requires('gui') cls.root = Tk() cls.root.withdraw() @classmethod def tearDownClass(cls): cls.root.destroy() del cls.root def setUp(self): TV.transient.__init__() TV.grab_set.__init__() TV.wait_window.__init__() def test_init_modal(self): view = TV(self.root, 'Title', 'test text') self.assertTrue(TV.transient.called) self.assertTrue(TV.grab_set.called) self.assertTrue(TV.wait_window.called) view.Ok() def test_init_nonmodal(self): view = TV(self.root, 'Title', 'test text', modal=False) self.assertFalse(TV.transient.called) self.assertFalse(TV.grab_set.called) self.assertFalse(TV.wait_window.called) view.Ok() def test_ok(self): view = TV(self.root, 'Title', 'test text', modal=False) view.destroy = Func() view.Ok() self.assertTrue(view.destroy.called) del view.destroy # Unmask the real function. view.destroy() class ViewFunctionTest(unittest.TestCase): @classmethod def setUpClass(cls): requires('gui') cls.root = Tk() cls.root.withdraw() cls.orig_mbox = tv.tkMessageBox tv.tkMessageBox = Mbox @classmethod def tearDownClass(cls): cls.root.destroy() del cls.root tv.tkMessageBox = cls.orig_mbox del cls.orig_mbox def test_view_text(self): # If modal True, get tkinter error 'can't invoke "event" command'. view = tv.view_text(self.root, 'Title', 'test text', modal=False) self.assertIsInstance(view, tv.TextViewer) view.Ok() def test_view_file(self): test_dir = os.path.dirname(__file__) testfile = os.path.join(test_dir, 'test_textview.py') view = tv.view_file(self.root, 'Title', testfile, modal=False) self.assertIsInstance(view, tv.TextViewer) self.assertIn('Test', view.textView.get('1.0', '1.end')) view.Ok() # Mock messagebox will be used; view_file will return None. testfile = os.path.join(test_dir, '../notthere.py') view = tv.view_file(self.root, 'Title', testfile, modal=False) self.assertIsNone(view) if __name__ == '__main__': unittest.main(verbosity=2)
[+]
..
[-] test_delegator.pyo
[edit]
[-] test_text.pyc
[edit]
[-] test_parenmatch.pyo
[edit]
[-] __init__.pyo
[edit]
[-] test_parenmatch.py
[edit]
[-] test_pathbrowser.pyc
[edit]
[-] test_warning.py
[edit]
[-] test_calltips.pyc
[edit]
[-] test_config_name.pyo
[edit]
[-] test_searchengine.pyo
[edit]
[-] mock_idle.pyc
[edit]
[-] htest.pyc
[edit]
[-] test_delegator.pyc
[edit]
[-] test_formatparagraph.py
[edit]
[-] mock_tk.pyc
[edit]
[-] mock_idle.pyo
[edit]
[-] test_searchdialogbase.pyc
[edit]
[-] test_searchdialogbase.pyo
[edit]
[-] test_hyperparser.py
[edit]
[-] test_searchengine.py
[edit]
[-] test_io.py
[edit]
[-] test_io.pyc
[edit]
[-] test_configdialog.pyc
[edit]
[-] test_textview.py
[edit]
[-] test_editmenu.py
[edit]
[-] test_helpabout.py
[edit]
[-] __init__.pyc
[edit]
[-] test_calltips.py
[edit]
[-] test_idlehistory.py
[edit]
[-] test_widgetredir.pyc
[edit]
[-] test_config_name.py
[edit]
[-] test_delegator.py
[edit]
[-] test_rstrip.pyc
[edit]
[-] __init__.py
[edit]
[-] test_searchengine.pyc
[edit]
[-] test_editmenu.pyc
[edit]
[-] test_configdialog.pyo
[edit]
[-] test_hyperparser.pyo
[edit]
[-] htest.py
[edit]
[-] test_warning.pyc
[edit]
[-] test_helpabout.pyc
[edit]
[-] test_grep.pyc
[edit]
[-] test_rstrip.py
[edit]
[-] mock_tk.pyo
[edit]
[-] test_pathbrowser.py
[edit]
[-] test_autoexpand.pyc
[edit]
[-] test_widgetredir.pyo
[edit]
[-] test_autocomplete.pyo
[edit]
[-] test_autoexpand.py
[edit]
[-] README.txt
[edit]
[-] test_formatparagraph.pyc
[edit]
[-] test_idlehistory.pyo
[edit]
[-] test_pathbrowser.pyo
[edit]
[-] test_autocomplete.py
[edit]
[-] test_warning.pyo
[edit]
[-] test_text.pyo
[edit]
[-] test_io.pyo
[edit]
[-] test_helpabout.pyo
[edit]
[-] test_textview.pyo
[edit]
[-] test_formatparagraph.pyo
[edit]
[-] htest.pyo
[edit]
[-] test_editmenu.pyo
[edit]
[-] test_idlehistory.pyc
[edit]
[-] test_grep.pyo
[edit]
[-] test_calltips.pyo
[edit]
[-] test_widgetredir.py
[edit]
[-] test_hyperparser.pyc
[edit]
[-] test_autoexpand.pyo
[edit]
[-] test_config_name.pyc
[edit]
[-] test_autocomplete.pyc
[edit]
[-] test_parenmatch.pyc
[edit]
[-] test_rstrip.pyo
[edit]
[-] mock_idle.py
[edit]
[-] test_text.py
[edit]
[-] test_grep.py
[edit]
[-] test_searchdialogbase.py
[edit]
[-] test_configdialog.py
[edit]
[-] mock_tk.py
[edit]
[-] test_textview.pyc
[edit]