summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/idle_test/test_text.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/idlelib/idle_test/test_text.py')
-rw-r--r--Lib/idlelib/idle_test/test_text.py25
1 files changed, 8 insertions, 17 deletions
diff --git a/Lib/idlelib/idle_test/test_text.py b/Lib/idlelib/idle_test/test_text.py
index 0f31179..50d3fac 100644
--- a/Lib/idlelib/idle_test/test_text.py
+++ b/Lib/idlelib/idle_test/test_text.py
@@ -1,19 +1,17 @@
-''' Test mock_tk.Text class against tkinter.Text class
-
-Run same tests with both by creating a mixin class.
-'''
+# Test mock_tk.Text class against tkinter.Text class by running same tests with both.
import unittest
-from test.support import requires
+from test.test_support import requires
+
from _tkinter import TclError
class TextTest(object):
- "Define items common to both sets of tests."
- hw = 'hello\nworld' # Several tests insert this after initialization.
+ hw = 'hello\nworld' # usual initial insert after initialization
hwn = hw+'\n' # \n present at initialization, before insert
- # setUpClass defines cls.Text and maybe cls.root.
- # setUp defines self.text from Text and maybe root.
+ Text = None
+ def setUp(self):
+ self.text = self.Text()
def test_init(self):
self.assertEqual(self.text.get('1.0'), '\n')
@@ -198,10 +196,6 @@ 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
@@ -219,7 +213,7 @@ class TkTextTest(TextTest, unittest.TestCase):
@classmethod
def setUpClass(cls):
requires('gui')
- from tkinter import Tk, Text
+ from Tkinter import Tk, Text
cls.Text = Text
cls.root = Tk()
@@ -228,9 +222,6 @@ 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)