diff options
Diffstat (limited to 'Lib/tkinter/test')
| -rw-r--r-- | Lib/tkinter/test/runtktests.py | 2 | ||||
| -rw-r--r-- | Lib/tkinter/test/test_tkinter/test_misc.py | 5 | ||||
| -rw-r--r-- | Lib/tkinter/test/test_tkinter/test_variables.py | 6 | ||||
| -rw-r--r-- | Lib/tkinter/test/test_tkinter/test_widgets.py | 7 | ||||
| -rw-r--r-- | Lib/tkinter/test/test_ttk/test_extensions.py | 6 |
5 files changed, 15 insertions, 11 deletions
diff --git a/Lib/tkinter/test/runtktests.py b/Lib/tkinter/test/runtktests.py index ccb3755..dbe5e88 100644 --- a/Lib/tkinter/test/runtktests.py +++ b/Lib/tkinter/test/runtktests.py @@ -16,7 +16,7 @@ this_dir_path = os.path.abspath(os.path.dirname(__file__)) def is_package(path): for name in os.listdir(path): - if name in ('__init__.py', '__init__.pyc', '__init.pyo'): + if name in ('__init__.py', '__init__.pyc'): return True return False diff --git a/Lib/tkinter/test/test_tkinter/test_misc.py b/Lib/tkinter/test/test_tkinter/test_misc.py index d8de949..85ee2c7 100644 --- a/Lib/tkinter/test/test_tkinter/test_misc.py +++ b/Lib/tkinter/test/test_tkinter/test_misc.py @@ -7,6 +7,11 @@ support.requires('gui') class MiscTest(AbstractTkTest, unittest.TestCase): + def test_repr(self): + t = tkinter.Toplevel(self.root, name='top') + f = tkinter.Frame(t, name='child') + self.assertEqual(repr(f), '<tkinter.Frame object .top.child>') + def test_tk_setPalette(self): root = self.root root.tk_setPalette('black') diff --git a/Lib/tkinter/test/test_tkinter/test_variables.py b/Lib/tkinter/test/test_tkinter/test_variables.py index 4b72943..abdce96 100644 --- a/Lib/tkinter/test/test_tkinter/test_variables.py +++ b/Lib/tkinter/test/test_tkinter/test_variables.py @@ -122,10 +122,10 @@ class TestIntVar(TestBase): def test_invalid_value(self): v = IntVar(self.root, name="name") self.root.globalsetvar("name", "value") - with self.assertRaises(ValueError): + with self.assertRaises((ValueError, TclError)): v.get() self.root.globalsetvar("name", "345.0") - with self.assertRaises(ValueError): + with self.assertRaises((ValueError, TclError)): v.get() @@ -152,7 +152,7 @@ class TestDoubleVar(TestBase): def test_invalid_value(self): v = DoubleVar(self.root, name="name") self.root.globalsetvar("name", "value") - with self.assertRaises(ValueError): + with self.assertRaises((ValueError, TclError)): v.get() diff --git a/Lib/tkinter/test/test_tkinter/test_widgets.py b/Lib/tkinter/test/test_tkinter/test_widgets.py index 8be0371..7171667 100644 --- a/Lib/tkinter/test/test_tkinter/test_widgets.py +++ b/Lib/tkinter/test/test_tkinter/test_widgets.py @@ -920,8 +920,9 @@ class ScrollbarTest(AbstractWidgetTest, unittest.TestCase): sb = self.create() for e in ('arrow1', 'slider', 'arrow2'): sb.activate(e) + self.assertEqual(sb.activate(), e) sb.activate('') - self.assertRaises(TypeError, sb.activate) + self.assertIsNone(sb.activate()) self.assertRaises(TypeError, sb.activate, 'arrow1', 'arrow2') def test_set(self): @@ -931,8 +932,8 @@ class ScrollbarTest(AbstractWidgetTest, unittest.TestCase): self.assertRaises(TclError, sb.set, 'abc', 'def') self.assertRaises(TclError, sb.set, 0.6, 'def') self.assertRaises(TclError, sb.set, 0.6, None) - self.assertRaises(TclError, sb.set, 0.6) - self.assertRaises(TclError, sb.set, 0.6, 0.7, 0.8) + self.assertRaises(TypeError, sb.set, 0.6) + self.assertRaises(TypeError, sb.set, 0.6, 0.7, 0.8) @add_standard_options(StandardOptionsTests) diff --git a/Lib/tkinter/test/test_ttk/test_extensions.py b/Lib/tkinter/test/test_ttk/test_extensions.py index c3af06c..f33945c 100644 --- a/Lib/tkinter/test/test_ttk/test_extensions.py +++ b/Lib/tkinter/test/test_ttk/test_extensions.py @@ -70,17 +70,15 @@ class LabeledScaleTest(AbstractTkTest, unittest.TestCase): # variable initialization/passing passed_expected = (('0', 0), (0, 0), (10, 10), (-1, -1), (sys.maxsize + 1, sys.maxsize + 1)) - if self.wantobjects: - passed_expected += ((2.5, 2),) for pair in passed_expected: x = ttk.LabeledScale(self.root, from_=pair[0]) self.assertEqual(x.value, pair[1]) x.destroy() x = ttk.LabeledScale(self.root, from_='2.5') - self.assertRaises(ValueError, x._variable.get) + self.assertRaises((ValueError, tkinter.TclError), x._variable.get) x.destroy() x = ttk.LabeledScale(self.root, from_=None) - self.assertRaises(ValueError, x._variable.get) + self.assertRaises((ValueError, tkinter.TclError), x._variable.get) x.destroy() # variable should have its default value set to the from_ value myvar = tkinter.DoubleVar(self.root, value=20) |
