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

Method test_element_create_image_errors

Lib/test/test_ttk/test_style.py:243–261  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

241 self.assertEqual(b.winfo_reqheight(), 16)
242
243 def test_element_create_image_errors(self):
244 style = self.style
245 image = tkinter.PhotoImage(master=self.root, width=10, height=10)
246 with self.assertRaises(IndexError):
247 style.element_create('block2', 'image')
248 with self.assertRaises(TypeError):
249 style.element_create('block2', 'image', image, 1)
250 with self.assertRaises(ValueError):
251 style.element_create('block2', 'image', image, ())
252 with self.assertRaisesRegex(TclError, 'Invalid state name'):
253 style.element_create('block2', 'image', image, ('spam', image))
254 with self.assertRaisesRegex(TclError, 'Invalid state name'):
255 style.element_create('block2', 'image', image, (1, image))
256 with self.assertRaises(TypeError):
257 style.element_create('block2', 'image', image, ('pressed', 1, image))
258 with self.assertRaises(TypeError):
259 style.element_create('block2', 'image', image, (1, 'selected', image))
260 with self.assertRaisesRegex(TclError, 'bad option'):
261 style.element_create('block2', 'image', image, spam=1)
262
263 def test_element_create_vsapi_1(self):
264 style = self.style

Callers

nothing calls this directly

Calls 3

element_createMethod · 0.80
assertRaisesRegexMethod · 0.80
assertRaisesMethod · 0.45

Tested by

no test coverage detected