8000 bpo-41306: Allow scale value to not be rounded by E-Paine · Pull Request #21715 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-41306: Allow scale value to not be rounded #21715

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 9 commits into from
Oct 8, 2020
Next Next commit
Allow scale value to not be rounded
  • Loading branch information
E-Paine committed Aug 3, 2020
commit 1c8759c2c07869adf96e12b5ba1c86d16f5253e4
2 changes: 1 addition & 1 deletion Lib/tkinter/test/test_tkinter/test_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -936,7 +936,7 @@ def test_digits(self):

def test_from(self):
widget = self.create()
self.checkFloatParam(widget, 'from', 100, 14.9, 15.1, conv=float_round)
self.checkFloatParam(widget, 'from', 100, 14.9, 15.1, conv=float_round, allow_not_rounded=True)

def test_label(self):
widget = self.create()
Expand Down
10 changes: 8 additions & 2 deletions Lib/tkinter/test/widget_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,15 @@ def checkIntegerParam(self, widget, name, *values, **kwargs):
self.checkInvalidParam(widget, name, 3.2,
errmsg='expected integer but got "3.2"')

def checkFloatParam(self, widget, name, *values, conv=float, **kwargs):
def checkFloatParam(self, widget, name, *values, conv=float, allow_not_rounded=False, **kwargs):
for value in values:
self.checkParam(widget, name, value, conv=conv, **kwargs)
try:
self.checkParam(widget, name, value, conv=conv, **kwargs)
except AssertionError:
if allow_not_rounded:
self.checkParam(widget, name, value, conv=lambda val: val, **kwargs)
else:
raise
self.checkInvalidParam(widget, name, '',
errmsg='expected floating-point number but got ""')
self.checkInvalidParam(widget, name, 'spam',
Expand Down
0