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

Method check_create_from_data

Lib/test/test_tkinter/test_images.py:205–221  ·  view source on GitHub ↗
(self, ext)

Source from the content-addressed store, hash-verified

203 self.assertNotIn('::img::test', self.root.image_names())
204
205 def check_create_from_data(self, ext):
206 testfile = support.findfile('python.' + ext, subdir='tkinterdata')
207 with open(testfile, 'rb') as f:
208 data = f.read()
209 image = tkinter.PhotoImage('::img::test', master=self.root,
210 data=data)
211 self.assertEqual(str(image), '::img::test')
212 self.assertEqual(image.type(), 'photo')
213 self.assertEqual(image.width(), 16)
214 self.assertEqual(image.height(), 16)
215 self.assertEqual(image['data'], data if self.wantobjects
216 else data.decode('latin1'))
217 self.assertEqual(image['file'], '')
218 self.assertIn('::img::test', self.root.image_names())
219 del image
220 support.gc_collect() # For PyPy or other GCs.
221 self.assertNotIn('::img::test', self.root.image_names())
222
223 def test_create_from_ppm_file(self):
224 self.check_create_from_file('ppm')

Calls 11

strFunction · 0.85
heightMethod · 0.80
assertInMethod · 0.80
assertNotInMethod · 0.80
openFunction · 0.50
readMethod · 0.45
assertEqualMethod · 0.45
typeMethod · 0.45
widthMethod · 0.45
decodeMethod · 0.45
image_namesMethod · 0.45

Tested by

no test coverage detected