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

Method test_add

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

Source from the content-addressed store, hash-verified

624 self.assertEqual(str(widget2['orient']), 'horizontal')
625
626 def test_add(self):
627 # attempt to add a child that is not a direct child of the paned window
628 label = ttk.Label(self.paned)
629 child = ttk.Label(label)
630 self.assertRaises(tkinter.TclError, self.paned.add, child)
631 label.destroy()
632 child.destroy()
633 # another attempt
634 label = ttk.Label(self.root)
635 child = ttk.Label(label)
636 self.assertRaises(tkinter.TclError, self.paned.add, child)
637 child.destroy()
638 label.destroy()
639
640 good_child = ttk.Label(self.root)
641 self.paned.add(good_child)
642 # re-adding a child is not accepted
643 self.assertRaises(tkinter.TclError, self.paned.add, good_child)
644
645 other_child = ttk.Label(self.paned)
646 self.paned.add(other_child)
647 self.assertEqual(self.paned.pane(0), self.paned.pane(1))
648 self.assertRaises(tkinter.TclError, self.paned.pane, 2)
649 good_child.destroy()
650 other_child.destroy()
651 self.assertRaises(tkinter.TclError, self.paned.pane, 0)
652
653 def test_forget(self):
654 self.assertRaises(tkinter.TclError, self.paned.forget, None)

Callers

nothing calls this directly

Calls 5

paneMethod · 0.80
assertRaisesMethod · 0.45
destroyMethod · 0.45
addMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected