MCPcopy Index your code
hub / github.com/python/cpython / checkPixelsParam

Method checkPixelsParam

Lib/test/test_tkinter/widget_tests.py:149–170  ·  view source on GitHub ↗
(self, widget, name, *values, conv=None, **kwargs)

Source from the content-addressed store, hash-verified

147 self.checkInvalidParam(widget, name, 'spam', errmsg=errmsg)
148
149 def checkPixelsParam(self, widget, name, *values, conv=None, **kwargs):
150 if conv is None:
151 if self._rounds_pixels and name not in self._no_round:
152 conv = round
153 alow_neg = tk_version < (9, 1)
154 for value in values:
155 expected = _sentinel
156 conv1 = conv
157 if isinstance(value, str):
158 if not getattr(self, '_converts_pixels', True):
159 conv1 = str
160 if conv1 and conv1 is not str:
161 expected = pixels_conv(value) * self.scaling
162 conv1 = round
163 elif not alow_neg and isinstance(value, (int, float)) and value < 0:
164 self.checkInvalidParam(widget, name, value)
165 continue
166 self.checkParam(widget, name, value, expected=expected,
167 conv=conv1, **kwargs)
168 errmsg = '(bad|expected) screen distance ((or "" )?but got )?"{}"'
169 self.checkInvalidParam(widget, name, '6x', errmsg=errmsg)
170 self.checkInvalidParam(widget, name, 'spam', errmsg=errmsg)
171
172 def checkReliefParam(self, widget, name, *, allow_empty=False):
173 values = ('flat', 'groove', 'raised', 'ridge', 'solid', 'sunken')

Calls 3

checkInvalidParamMethod · 0.95
checkParamMethod · 0.95
pixels_convFunction · 0.90

Tested by

no test coverage detected