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

Method test_wm_attribute

Lib/test/test_tkinter/test_misc.py:527–577  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

525class WmTest(AbstractTkTest, unittest.TestCase):
526
527 def test_wm_attribute(self):
528 w = self.root
529 attributes = w.wm_attributes(return_python_dict=True)
530 self.assertIsInstance(attributes, dict)
531 attributes2 = w.wm_attributes()
532 self.assertIsInstance(attributes2, tuple)
533 self.assertEqual(attributes2[::2],
534 tuple('-' + k for k in attributes))
535 self.assertEqual(attributes2[1::2], tuple(attributes.values()))
536 # silently deprecated
537 attributes3 = w.wm_attributes(None)
538 if self.wantobjects:
539 self.assertEqual(attributes3, attributes2)
540 else:
541 self.assertIsInstance(attributes3, str)
542
543 for name in attributes:
544 self.assertEqual(w.wm_attributes(name), attributes[name])
545 # silently deprecated
546 for name in attributes:
547 self.assertEqual(w.wm_attributes('-' + name), attributes[name])
548
549 self.assertIn('alpha', attributes)
550 self.assertIn('fullscreen', attributes)
551 self.assertIn('topmost', attributes)
552 if w._windowingsystem == "win32":
553 self.assertIn('disabled', attributes)
554 self.assertIn('toolwindow', attributes)
555 self.assertIn('transparentcolor', attributes)
556 if w._windowingsystem == "aqua":
557 self.assertIn('modified', attributes)
558 self.assertIn('notify', attributes)
559 self.assertIn('titlepath', attributes)
560 self.assertIn('transparent', attributes)
561 if w._windowingsystem == "x11":
562 self.assertIn('type', attributes)
563 self.assertIn('zoomed', attributes)
564
565 w.wm_attributes(alpha=0.5)
566 self.assertEqual(w.wm_attributes('alpha'),
567 0.5 if self.wantobjects else '0.5')
568 w.wm_attributes(alpha=1.0)
569 self.assertEqual(w.wm_attributes('alpha'),
570 1.0 if self.wantobjects else '1.0')
571 # silently deprecated
572 w.wm_attributes('-alpha', 0.5)
573 self.assertEqual(w.wm_attributes('alpha'),
574 0.5 if self.wantobjects else '0.5')
575 w.wm_attributes(alpha=1.0)
576 self.assertEqual(w.wm_attributes('alpha'),
577 1.0 if self.wantobjects else '1.0')
578
579 def test_wm_iconbitmap(self):
580 t = tkinter.Toplevel(self.root)

Callers

nothing calls this directly

Calls 5

wm_attributesMethod · 0.80
assertIsInstanceMethod · 0.80
assertInMethod · 0.80
assertEqualMethod · 0.45
valuesMethod · 0.45

Tested by

no test coverage detected