diff options
| author | Terry Jan Reedy <tjreedy@udel.edu> | 2016-06-21 18:41:38 -0400 |
|---|---|---|
| committer | Terry Jan Reedy <tjreedy@udel.edu> | 2016-06-21 18:41:38 -0400 |
| commit | b60adc54d4f248d71d831d14e11cc77fe72c281e (patch) | |
| tree | 40991b8eacb5eea9cfe04e7dbb2cb20149b868f2 /Lib/idlelib/idle_test/test_text.py | |
| parent | aacd53f6cb96fe8c4fe9ce894f22e25f356a97c3 (diff) | |
| download | cpython-git-b60adc54d4f248d71d831d14e11cc77fe72c281e.tar.gz | |
Issue #24137: Run IDLE, test_idle, and htest with tkinter default root disabled.
Fix code and tests that fail with this restriction.
Fix htests to not create a second and redundant root and mainloop.
Diffstat (limited to 'Lib/idlelib/idle_test/test_text.py')
| -rw-r--r-- | Lib/idlelib/idle_test/test_text.py | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/Lib/idlelib/idle_test/test_text.py b/Lib/idlelib/idle_test/test_text.py index 7e823df3db..a5ba7bb213 100644 --- a/Lib/idlelib/idle_test/test_text.py +++ b/Lib/idlelib/idle_test/test_text.py @@ -1,17 +1,19 @@ -# Test mock_tk.Text class against tkinter.Text class by running same tests with both. +''' Test mock_tk.Text class against tkinter.Text class + +Run same tests with both by creating a mixin class. +''' import unittest from test.support import requires - from _tkinter import TclError class TextTest(object): + "Define items common to both sets of tests." - hw = 'hello\nworld' # usual initial insert after initialization + hw = 'hello\nworld' # Several tests insert this after after initialization. hwn = hw+'\n' # \n present at initialization, before insert - Text = None - def setUp(self): - self.text = self.Text() + # setUpClass defines cls.Text and maybe cls.root. + # setUp defines self.text from Text and maybe root. def test_init(self): self.assertEqual(self.text.get('1.0'), '\n') @@ -196,6 +198,10 @@ class MockTextTest(TextTest, unittest.TestCase): from idlelib.idle_test.mock_tk import Text cls.Text = Text + def setUp(self): + self.text = self.Text() + + def test_decode(self): # test endflags (-1, 0) not tested by test_index (which uses +1) decode = self.text._decode @@ -222,6 +228,9 @@ class TkTextTest(TextTest, unittest.TestCase): cls.root.destroy() del cls.root + def setUp(self): + self.text = self.Text(self.root) + if __name__ == '__main__': unittest.main(verbosity=2, exit=False) |
