/
opt
/
alt
/
python27
/
lib64
/
python2.7
/
idlelib
/
idle_test
/
/opt/alt/python27/lib64/python2.7/idlelib/idle_test
mkdir
upload
Name
Size
Mode
Actions
htest.py
13779
0644
edit
dl
rm
htest.pyc
12652
0644
edit
dl
rm
htest.pyo
12652
0644
edit
dl
rm
mock_idle.py
1597
0644
edit
dl
rm
mock_idle.pyc
3009
0644
edit
dl
rm
mock_idle.pyo
3009
0644
edit
dl
rm
mock_tk.py
11574
0644
edit
dl
rm
mock_tk.pyc
12713
0644
edit
dl
rm
mock_tk.pyo
12713
0644
edit
dl
rm
README.txt
5492
0644
edit
dl
rm
test_autocomplete.py
4922
0644
edit
dl
rm
test_autocomplete.pyc
6120
0644
edit
dl
rm
test_autocomplete.pyo
6120
0644
edit
dl
rm
test_autoexpand.py
4122
0644
edit
dl
rm
test_autoexpand.pyc
4962
0644
edit
dl
rm
test_autoexpand.pyo
4962
0644
edit
dl
rm
test_calltips.py
7140
0644
edit
dl
rm
test_calltips.pyc
12768
0644
edit
dl
rm
test_calltips.pyo
12768
0644
edit
dl
rm
test_configdialog.py
782
0644
edit
dl
rm
test_configdialog.pyc
1720
0644
edit
dl
rm
test_configdialog.pyo
1720
0644
edit
dl
rm
test_config_name.py
2472
0644
edit
dl
rm
test_config_name.pyc
4181
0644
edit
dl
rm
test_config_name.pyo
4181
0644
edit
dl
rm
test_delegator.py
1294
0644
edit
dl
rm
test_delegator.pyc
1358
0644
edit
dl
rm
test_delegator.pyo
1358
0644
edit
dl
rm
test_editmenu.py
3167
0644
edit
dl
rm
test_editmenu.pyc
4569
0644
edit
dl
rm
test_editmenu.pyo
4569
0644
edit
dl
rm
test_formatparagraph.py
14344
0644
edit
dl
rm
test_formatparagraph.pyc
14708
0644
edit
dl
rm
test_formatparagraph.pyo
14708
0644
edit
dl
rm
test_grep.py
2762
0644
edit
dl
rm
test_grep.pyc
3903
0644
edit
dl
rm
test_grep.pyo
3903
0644
edit
dl
rm
test_helpabout.py
1611
0644
edit
dl
rm
test_helpabout.pyc
2441
0644
edit
dl
rm
test_helpabout.pyo
2441
0644
edit
dl
rm
test_hyperparser.py
5684
0644
edit
dl
rm
test_hyperparser.pyc
6942
0644
edit
dl
rm
test_hyperparser.pyo
6942
0644
edit
dl
rm
test_idlehistory.py
5495
0644
edit
dl
rm
test_idlehistory.pyc
8480
0644
edit
dl
rm
test_idlehistory.pyo
8480
0644
edit
dl
rm
test_io.py
9505
0644
edit
dl
rm
test_io.pyc
11949
0644
edit
dl
rm
test_io.pyo
11949
0644
edit
dl
rm
test_parenmatch.py
3822
0644
edit
dl
rm
test_parenmatch.pyc
5664
0644
edit
dl
rm
test_parenmatch.pyo
5664
0644
edit
dl
rm
test_pathbrowser.py
940
0644
edit
dl
rm
test_pathbrowser.pyc
1537
0644
edit
dl
rm
test_pathbrowser.pyo
1537
0644
edit
dl
rm
test_rstrip.py
1613
0644
edit
dl
rm
test_rstrip.pyc
1825
0644
edit
dl
rm
test_rstrip.pyo
1825
0644
edit
dl
rm
test_searchdialogbase.py
5863
0644
edit
dl
rm
test_searchdialogbase.pyc
7035
0644
edit
dl
rm
test_searchdialogbase.pyo
7035
0644
edit
dl
rm
test_searchengine.py
11487
0644
edit
dl
rm
test_searchengine.pyc
13117
0644
edit
dl
rm
test_searchengine.pyo
13117
0644
edit
dl
rm
test_text.py
6744
0644
edit
dl
rm
test_text.pyc
8395
0644
edit
dl
rm
test_text.pyo
8395
0644
edit
dl
rm
test_textview.py
2802
0644
edit
dl
rm
test_textview.pyc
4713
0644
edit
dl
rm
test_textview.pyo
4713
0644
edit
dl
rm
test_warning.py
2757
0644
edit
dl
rm
test_warning.pyc
3390
0644
edit
dl
rm
test_warning.pyo
3390
0644
edit
dl
rm
test_widgetredir.py
4177
0644
edit
dl
rm
test_widgetredir.pyc
6644
0644
edit
dl
rm
test_widgetredir.pyo
6644
0644
edit
dl
rm
__init__.py
650
0644
edit
dl
rm
__init__.pyc
941
0644
edit
dl
rm
__init__.pyo
941
0644
edit
dl
rm
Edit:
/opt/alt/python27/lib64/python2.7/idlelib/idle_test/test_textview.py
(2802B)
'''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)
Save
cmd:
run