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

Method test_tk_setPalette

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

Source from the content-addressed store, hash-verified

104 f.tk_busy_cget('cursor')
105
106 def test_tk_setPalette(self):
107 root = self.root
108 root.tk_setPalette('black')
109 self.assertEqual(root['background'], 'black')
110 root.tk_setPalette('white')
111 self.assertEqual(root['background'], 'white')
112 self.assertRaisesRegex(tkinter.TclError,
113 '^unknown color name "spam"$',
114 root.tk_setPalette, 'spam')
115
116 root.tk_setPalette(background='black')
117 self.assertEqual(root['background'], 'black')
118 root.tk_setPalette(background='blue', highlightColor='yellow')
119 self.assertEqual(root['background'], 'blue')
120 self.assertEqual(root['highlightcolor'], 'yellow')
121 root.tk_setPalette(background='yellow', highlightColor='blue')
122 self.assertEqual(root['background'], 'yellow')
123 self.assertEqual(root['highlightcolor'], 'blue')
124 self.assertRaisesRegex(tkinter.TclError,
125 '^unknown color name "spam"$',
126 root.tk_setPalette, background='spam')
127 self.assertRaisesRegex(tkinter.TclError,
128 '^must specify a background color$',
129 root.tk_setPalette, spam='white')
130 self.assertRaisesRegex(tkinter.TclError,
131 '^must specify a background color$',
132 root.tk_setPalette, highlightColor='blue')
133
134 def test_after(self):
135 root = self.root

Callers

nothing calls this directly

Calls 3

tk_setPaletteMethod · 0.80
assertRaisesRegexMethod · 0.80
assertEqualMethod · 0.45

Tested by

no test coverage detected