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

Method test_children

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

Source from the content-addressed store, hash-verified

1514 self.assertEqual(self.tv.bbox(child1), '')
1515
1516 def test_children(self):
1517 # no children yet, should get an empty tuple
1518 self.assertEqual(self.tv.get_children(), ())
1519
1520 item_id = self.tv.insert('', 'end')
1521 self.assertIsInstance(self.tv.get_children(), tuple)
1522 self.assertEqual(self.tv.get_children()[0], item_id)
1523
1524 # add item_id and child3 as children of child2
1525 child2 = self.tv.insert('', 'end')
1526 child3 = self.tv.insert('', 'end')
1527 self.tv.set_children(child2, item_id, child3)
1528 self.assertEqual(self.tv.get_children(child2), (item_id, child3))
1529
1530 # child3 has child2 as parent, thus trying to set child2 as a children
1531 # of child3 should result in an error
1532 self.assertRaises(tkinter.TclError,
1533 self.tv.set_children, child3, child2)
1534
1535 # remove child2 children
1536 self.tv.set_children(child2)
1537 self.assertEqual(self.tv.get_children(child2), ())
1538
1539 # remove root's children
1540 self.tv.set_children('')
1541 self.assertEqual(self.tv.get_children(), ())
1542
1543 def test_column(self):
1544 # return a dict with all options/values

Callers

nothing calls this directly

Calls 6

assertIsInstanceMethod · 0.80
set_childrenMethod · 0.80
assertEqualMethod · 0.45
get_childrenMethod · 0.45
insertMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected