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

Method test_column

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

Source from the content-addressed store, hash-verified

1541 self.assertEqual(self.tv.get_children(), ())
1542
1543 def test_column(self):
1544 # return a dict with all options/values
1545 self.assertIsInstance(self.tv.column('#0'), dict)
1546 # return a single value of the given option
1547 if self.wantobjects:
1548 self.assertIsInstance(self.tv.column('#0', width=None), int)
1549 # set a new value for an option
1550 self.tv.column('#0', width=10)
1551 # testing new way to get option value
1552 self.assertEqual(self.tv.column('#0', 'width'),
1553 10 if self.wantobjects else '10')
1554 self.assertEqual(self.tv.column('#0', width=None),
1555 10 if self.wantobjects else '10')
1556 # check read-only option
1557 self.assertRaises(tkinter.TclError, self.tv.column, '#0', id='X')
1558
1559 self.assertRaises(tkinter.TclError, self.tv.column, 'invalid')
1560 invalid_kws = [
1561 {'unknown_option': 'some value'}, {'stretch': 'wrong'},
1562 {'anchor': 'wrong'}, {'width': 'wrong'}, {'minwidth': 'wrong'}
1563 ]
1564 for kw in invalid_kws:
1565 self.assertRaises(tkinter.TclError, self.tv.column, '#0',
1566 **kw)
1567
1568 def test_delete(self):
1569 self.assertRaises(tkinter.TclError, self.tv.delete, '#0')

Callers

nothing calls this directly

Calls 4

assertIsInstanceMethod · 0.80
columnMethod · 0.45
assertEqualMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected