8000 gh-107262: update Tkinter tests for 8.6.14 by DBJim · Pull Request #119322 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-107262: update Tkinter tests for 8.6.14 #119322

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix tkinter widget tests for tk 8.6.14
  • Loading branch information
DBJim committed May 21, 2024
commit 22c90ca609eb22d87d432581918879a4028b1d96
15 changes: 8 additions & 7 deletions Lib/test/test_tkinter/test_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ def test_configure_tabs(self):
widget = self.create()
self.checkParam(widget, 'tabs', (10.2, 20.7, '1i', '2i'))
self.checkParam(widget, 'tabs', '10.2 20.7 1i 2i',
expected=('10.2', '20.7', '1i', '2i'))
expected=((10.2, 20.7, '1i', '2i') or ('10.2', '20.7', '1i', '2i')))
self.checkParam(widget, 'tabs', '2c left 4c 6c center',
expected=('2c', 'left', '4c', '6c', 'center'))
self.checkInvalidParam(widget, 'tabs', 'spam',
Expand Down Expand Up @@ -999,12 +999,13 @@ def test_itemconfigure(self):
widget.itemconfigure()
with self.assertRaisesRegex(TclError, 'bad listbox index "red"'):
widget.itemconfigure('red')
self.assertEqual(widget.itemconfigure(0, 'background'),
('background', 'background', 'Background', '', 'red'))
self.assertEqual(widget.itemconfigure('end', 'background'),
('background', 'background', 'Background', '', 'violet'))
self.assertEqual(widget.itemconfigure('@0,0', 'background'),
('background', 'background', 'Background', '', 'red'))
if get_tk_patchlevel(self.root) >= (8, 6, 14):
self.assertEqual(widget.itemconfigure(0, 'background'),
('background', '', '', '', 'red'))
self.assertEqual(widget.itemconfigure('end', 'background'),
('background', '', '', '', 'violet'))
self.assertEqual(widget.itemconfigure('@0,0', 'background'),
('background', '', '', '', 'red'))

d = widget.itemconfigure(0)
self.assertIsInstance(d, dict)
Expand Down
23 changes: 16 additions & 7 deletions Lib/test/test_ttk/test_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,14 @@ def test_configure_class(self):

def test_configure_padding(self):
widget = self.create()
self.checkParam(widget, 'padding', 0, expected=('0',))
self.checkParam(widget, 'padding', 5, expected=('5',))
self.checkParam(widget, 'padding', (5, 6), expected=('5', '6'))
self.checkParam(widget, 'padding', (5, 6, 7),
expected=('5', '6', '7'))
self.checkParam(widget, 'padding', (5, 6, 7, 8),
expected=('5', '6', '7', '8'))
if get_tk_patchlevel(self.root) >= (8, 6, 14):
self.checkParam(widget, 'padding', 0, expected=(0,))
self.checkParam(widget, 'padding', 5, expected=(5,))
self.checkParam(widget, 'padding', (5, 6), expected=(5, 6))
self.checkParam(widget, 'padding', (5, 6, 7),
expected=(5, 6, 7))
self.checkParam(widget, 'padding', (5, 6, 7, 8),
expected=(5, 6, 7, 8))
self.checkParam(widget, 'padding', ('5p', '6p', '7p', '8p'))
self.checkParam(widget, 'padding', (), expected='')

Expand Down Expand Up @@ -1879,5 +1880,13 @@ def test_label(self):
self._test_widget(ttk.Label)


tests_gui = (
ButtonTest, CheckbuttonTest, ComboboxTest, EntryTest,
FrameTest, LabelFrameTest, LabelTest, MenubuttonTest,
NotebookTest, PanedWindowTest, ProgressbarTest,
RadiobuttonTest, ScaleTest, ScrollbarTest, SeparatorTest,
SizegripTest, SpinboxTest, TreeviewTest, WidgetTest, DefaultRootTest,
)

if __name__ == "__main__":
unittest.main()
0