diff options
Diffstat (limited to 'Lib/tkinter/test/test_ttk/test_style.py')
-rw-r--r-- | Lib/tkinter/test/test_ttk/test_style.py | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/Lib/tkinter/test/test_ttk/test_style.py b/Lib/tkinter/test/test_ttk/test_style.py index 3eebb64..e9a1eb4 100644 --- a/Lib/tkinter/test/test_ttk/test_style.py +++ b/Lib/tkinter/test/test_ttk/test_style.py @@ -16,17 +16,17 @@ class StyleTest(unittest.TestCase): def test_configure(self): style = self.style style.configure('TButton', background='yellow') - self.failUnlessEqual(style.configure('TButton', 'background'), + self.assertEqual(style.configure('TButton', 'background'), 'yellow') - self.failUnless(isinstance(style.configure('TButton'), dict)) + self.assertTrue(isinstance(style.configure('TButton'), dict)) def test_map(self): style = self.style style.map('TButton', background=[('active', 'background', 'blue')]) - self.failUnlessEqual(style.map('TButton', 'background'), + self.assertEqual(style.map('TButton', 'background'), [('active', 'background', 'blue')]) - self.failUnless(isinstance(style.map('TButton'), dict)) + self.assertTrue(isinstance(style.map('TButton'), dict)) def test_lookup(self): @@ -34,38 +34,38 @@ class StyleTest(unittest.TestCase): style.configure('TButton', background='yellow') style.map('TButton', background=[('active', 'background', 'blue')]) - self.failUnlessEqual(style.lookup('TButton', 'background'), 'yellow') - self.failUnlessEqual(style.lookup('TButton', 'background', + self.assertEqual(style.lookup('TButton', 'background'), 'yellow') + self.assertEqual(style.lookup('TButton', 'background', ['active', 'background']), 'blue') - self.failUnlessEqual(style.lookup('TButton', 'optionnotdefined', + self.assertEqual(style.lookup('TButton', 'optionnotdefined', default='iknewit'), 'iknewit') def test_layout(self): style = self.style - self.failUnlessRaises(tkinter.TclError, style.layout, 'NotALayout') + self.assertRaises(tkinter.TclError, style.layout, 'NotALayout') tv_style = style.layout('Treeview') # "erase" Treeview layout style.layout('Treeview', '') - self.failUnlessEqual(style.layout('Treeview'), + self.assertEqual(style.layout('Treeview'), [('null', {'sticky': 'nswe'})] ) # restore layout style.layout('Treeview', tv_style) - self.failUnlessEqual(style.layout('Treeview'), tv_style) + self.assertEqual(style.layout('Treeview'), tv_style) # should return a list - self.failUnless(isinstance(style.layout('TButton'), list)) + self.assertTrue(isinstance(style.layout('TButton'), list)) # correct layout, but "option" doesn't exist as option - self.failUnlessRaises(tkinter.TclError, style.layout, 'Treeview', + self.assertRaises(tkinter.TclError, style.layout, 'Treeview', [('name', {'option': 'inexistent'})]) def test_theme_use(self): - self.failUnlessRaises(tkinter.TclError, self.style.theme_use, + self.assertRaises(tkinter.TclError, self.style.theme_use, 'nonexistingname') curr_theme = self.style.theme_use() @@ -79,8 +79,8 @@ class StyleTest(unittest.TestCase): # just one theme available, can't go on with tests return - self.failIf(curr_theme == new_theme) - self.failIf(new_theme != self.style.theme_use()) + self.assertFalse(curr_theme == new_theme) + self.assertFalse(new_theme != self.style.theme_use()) self.style.theme_use(curr_theme) |