MCPcopy Create free account
hub / github.com/python/cpython / test_load_theme_cfg

Method test_load_theme_cfg

Lib/idlelib/idle_test/test_configdialog.py:298–337  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

296 d.set_color_sample.called = 0
297
298 def test_load_theme_cfg(self):
299 tracers.detach()
300 d = self.page
301 eq = self.assertEqual
302
303 # Use builtin theme with no user themes created.
304 idleConf.CurrentTheme = mock.Mock(return_value='IDLE Classic')
305 d.load_theme_cfg()
306 self.assertTrue(d.theme_source.get())
307 # builtinlist sets variable builtin_name to the CurrentTheme default.
308 eq(d.builtin_name.get(), 'IDLE Classic')
309 eq(d.custom_name.get(), '- no custom themes -')
310 eq(d.custom_theme_on.state(), ('disabled',))
311 eq(d.set_theme_type.called, 1)
312 eq(d.paint_theme_sample.called, 1)
313 eq(d.set_highlight_target.called, 1)
314
315 # Builtin theme with non-empty user theme list.
316 idleConf.SetOption('highlight', 'test1', 'option', 'value')
317 idleConf.SetOption('highlight', 'test2', 'option2', 'value2')
318 d.load_theme_cfg()
319 eq(d.builtin_name.get(), 'IDLE Classic')
320 eq(d.custom_name.get(), 'test1')
321 eq(d.set_theme_type.called, 2)
322 eq(d.paint_theme_sample.called, 2)
323 eq(d.set_highlight_target.called, 2)
324
325 # Use custom theme.
326 idleConf.CurrentTheme = mock.Mock(return_value='test2')
327 idleConf.SetOption('main', 'Theme', 'default', '0')
328 d.load_theme_cfg()
329 self.assertFalse(d.theme_source.get())
330 eq(d.builtin_name.get(), 'IDLE Classic')
331 eq(d.custom_name.get(), 'test2')
332 eq(d.set_theme_type.called, 3)
333 eq(d.paint_theme_sample.called, 3)
334 eq(d.set_highlight_target.called, 3)
335
336 del idleConf.CurrentTheme
337 tracers.attach()
338
339 def test_theme_source(self):
340 eq = self.assertEqual

Callers

nothing calls this directly

Calls 9

eqFunction · 0.85
load_theme_cfgMethod · 0.80
assertTrueMethod · 0.80
assertFalseMethod · 0.80
detachMethod · 0.45
getMethod · 0.45
stateMethod · 0.45
SetOptionMethod · 0.45
attachMethod · 0.45

Tested by

no test coverage detected