Skip to content

gh-153513: Remove redundant conversions in tkinter tests#153520

Merged
serhiy-storchaka merged 1 commit into
python:mainfrom
serhiy-storchaka:tkinter-fromobj-types-test-cleanup
Jul 10, 2026
Merged

gh-153513: Remove redundant conversions in tkinter tests#153520
serhiy-storchaka merged 1 commit into
python:mainfrom
serhiy-storchaka:tkinter-fromobj-types-test-cleanup

Conversation

@serhiy-storchaka

@serhiy-storchaka serhiy-storchaka commented Jul 10, 2026

Copy link
Copy Markdown
Member

Test-only follow-up to gh-153513 (#153514).

Now that index, window and parsedVarName options are returned as str and unitless pixel options as int/float, this drops the str()/int()/float()/getint() wrappers that only worked around the previous Tcl_Obj results. Where the value crosses wantobjects modes (an int/float with objects enabled, a string with objects disabled), the bare wrapper is replaced with a mode-aware exact comparison rather than dropped, so the returned type is verified instead of masked.

The generated test_configure_* tests also gain a check that an int- or float-valued option is returned as a number (not a Tcl_Obj), and that an int-valued option is not returned as a float.

Wrappers are kept where the returned type is not uniform: resource types (color, bitmap, font, cursor), screen distances with a unit suffix, canvas item options and OptionMenu -width (which Tk returns as strings), and plain-string options.

Tested with Tk 8.6, 9.0 and 9.1, with objects enabled and disabled.

🤖 Generated with Claude Code

Now that index, window, parsedVarName and pixel options are returned as
str, int or float, drop the str()/int()/float() wrappers that only
worked around Tcl_Obj results.  The generated test_configure_* tests now
also check that int- and float-valued options are returned as numbers.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@serhiy-storchaka serhiy-storchaka added tests Tests in the Lib/test dir skip news labels Jul 10, 2026
@serhiy-storchaka serhiy-storchaka merged commit f96c427 into python:main Jul 10, 2026
54 checks passed
@serhiy-storchaka serhiy-storchaka deleted the tkinter-fromobj-types-test-cleanup branch July 10, 2026 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip news tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant