https://github.com/python/cpython/commit/974a978631bfbfa6f617e927d5eaa82b06694ae5
commit: 974a978631bfbfa6f617e927d5eaa82b06694ae5
branch: main
author: Serhiy Storchaka <[email protected]>
committer: serhiy-storchaka <[email protected]>
date: 2024-06-22T11:18:04Z
summary:
gh-120873: Add test for "state" option in ttk.Scale (GH-120874)
Also refactor the "state" option tests for other ttk widgets.
files:
M Lib/test/test_ttk/test_widgets.py
diff --git a/Lib/test/test_ttk/test_widgets.py
b/Lib/test/test_ttk/test_widgets.py
index 2eb2c446366517..0c8931b384c6c9 100644
--- a/Lib/test/test_ttk/test_widgets.py
+++ b/Lib/test/test_ttk/test_widgets.py
@@ -5,8 +5,9 @@
import sys
from test.test_ttk_textonly import MockTclObj
-from test.test_tkinter.support import (AbstractTkTest, tk_version,
get_tk_patchlevel,
- simulate_mouse_click,
AbstractDefaultRootTest)
+from test.test_tkinter.support import (
+ AbstractTkTest, requires_tk, tk_version, get_tk_patchlevel,
+ simulate_mouse_click, AbstractDefaultRootTest)
from test.test_tkinter.widget_tests import (add_standard_options,
AbstractWidgetTest, StandardOptionsTests, IntegerSizeTests, PixelSizeTests)
@@ -44,6 +45,10 @@ def padding_conv(value):
self.checkParam(widget, 'padding', ('5p', '6p', '7p', '8p'))
self.checkParam(widget, 'padding', (), expected='')
+ def test_configure_state(self):
+ widget = self.create()
+ self.checkParams(widget, 'state', 'active', 'disabled', 'readonly')
+
def test_configure_style(self):
widget = self.create()
self.assertEqual(widget['style'], '')
@@ -183,10 +188,6 @@ def test_configure_compound(self):
widget = self.create()
self.checkEnumParam(widget, 'compound', *values, allow_empty=True)
- def test_configure_state(self):
- widget = self.create()
- self.checkParams(widget, 'state', 'active', 'disabled', 'normal')
-
def test_configure_width(self):
widget = self.create()
self.checkParams(widget, 'width', 402, -402, 0)
@@ -359,11 +360,6 @@ def test_configure_show(self):
self.checkParam(widget, 'show', '')
self.checkParam(widget, 'show', ' ')
- def test_configure_state(self):
- widget = self.create()
- self.checkParams(widget, 'state',
- 'disabled', 'normal', 'readonly')
-
def test_configure_validate(self):
widget = self.create()
self.checkEnumParam(widget, 'validate',
@@ -803,7 +799,7 @@ def test_configure_menu(self):
class ScaleTest(AbstractWidgetTest, unittest.TestCase):
OPTIONS = (
'class', 'command', 'cursor', 'from', 'length',
- 'orient', 'style', 'takefocus', 'to', 'value', 'variable',
+ 'orient', 'state', 'style', 'takefocus', 'to', 'value', 'variable',
)
_conv_pixels = False
default_orient = 'horizontal'
@@ -825,6 +821,8 @@ def test_configure_length(self):
widget = self.create()
self.checkPixelsParam(widget, 'length', 130, 131.2, 135.6, '5i')
+ test_configure_state = requires_tk(8, 6,
9)(StandardTtkOptionsTests.test_configure_state)
+
def test_configure_to(self):
widget = self.create()
self.checkFloatParam(widget, 'to', 300, 14.9, 15.1, -10, conv=False)
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]