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

Method test_insert

Lib/test/test_ttk/test_widgets.py:661–699  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

659 self.assertRaises(tkinter.TclError, self.paned.forget, 0)
660
661 def test_insert(self):
662 self.assertRaises(tkinter.TclError, self.paned.insert, None, 0)
663 self.assertRaises(tkinter.TclError, self.paned.insert, 0, None)
664 self.assertRaises(tkinter.TclError, self.paned.insert, 0, 0)
665
666 child = ttk.Label(self.root)
667 child2 = ttk.Label(self.root)
668 child3 = ttk.Label(self.root)
669
670 if tk_version >= (8, 7):
671 self.paned.insert(0, child)
672 self.assertEqual(self.paned.panes(), (str(child),))
673 self.paned.forget(0)
674 else:
675 self.assertRaises(tkinter.TclError, self.paned.insert, 0, child)
676
677 self.assertEqual(self.paned.panes(), ())
678 self.paned.insert('end', child2)
679 self.paned.insert(0, child)
680 self.assertEqual(self.paned.panes(), (str(child), str(child2)))
681
682 self.paned.insert(0, child2)
683 self.assertEqual(self.paned.panes(), (str(child2), str(child)))
684
685 self.paned.insert('end', child3)
686 self.assertEqual(self.paned.panes(),
687 (str(child2), str(child), str(child3)))
688
689 # reinserting a child should move it to its current position
690 panes = self.paned.panes()
691 self.paned.insert('end', child3)
692 self.assertEqual(panes, self.paned.panes())
693
694 # moving child3 to child2 position should result in child2 ending up
695 # in previous child position and child ending up in previous child3
696 # position
697 self.paned.insert(child2, child3)
698 self.assertEqual(self.paned.panes(),
699 (str(child3), str(child2), str(child)))
700
701 def test_pane(self):
702 self.assertRaises(tkinter.TclError, self.paned.pane, 0)

Callers

nothing calls this directly

Calls 6

strFunction · 0.85
panesMethod · 0.80
assertRaisesMethod · 0.45
insertMethod · 0.45
assertEqualMethod · 0.45
forgetMethod · 0.45

Tested by

no test coverage detected