11"""Test idlelib.configdialog.
22
33Half the class creates dialog, half works with user customizations.
4- Coverage: 81 %.
4+ Coverage: 95 %.
55"""
66from idlelib import configdialog
77from test .support import requires
@@ -226,7 +226,7 @@ def test_indent_scale(self):
226226 self .assertEqual (mainpage , {'Indent' : {'num-spaces' : '16' }})
227227
228228
229- class HighlightTest (unittest .TestCase ):
229+ class HighPageTest (unittest .TestCase ):
230230 """Test that highlight tab widgets enable users to make changes.
231231
232232 Test that widget actions set vars, that var changes add
@@ -235,21 +235,21 @@ class HighlightTest(unittest.TestCase):
235235
236236 @classmethod
237237 def setUpClass (cls ):
238- d = dialog
239- dialog .note .select (d . highpage )
240- d .set_theme_type = Func ()
241- d .paint_theme_sample = Func ()
242- d .set_highlight_target = Func ()
243- d .set_color_sample = Func ()
238+ page = cls . page = dialog . highpage
239+ dialog .note .select (page )
240+ page .set_theme_type = Func ()
241+ page .paint_theme_sample = Func ()
242+ page .set_highlight_target = Func ()
243+ page .set_color_sample = Func ()
244244
245245 @classmethod
246246 def tearDownClass (cls ):
247- d = dialog
247+ d = cls . page
248248 del d .set_theme_type , d .paint_theme_sample
249249 del d .set_highlight_target , d .set_color_sample
250250
251251 def setUp (self ):
252- d = dialog
252+ d = self . page
253253 # The following is needed for test_load_key_cfg, _delete_custom_keys.
254254 # This may indicate a defect in some test or function.
255255 for section in idleConf .GetSectionList ('user' , 'highlight' ):
@@ -262,7 +262,7 @@ def setUp(self):
262262
263263 def test_load_theme_cfg (self ):
264264 tracers .detach ()
265- d = dialog
265+ d = self . page
266266 eq = self .assertEqual
267267
268268 # Use builtin theme with no user themes created.
@@ -303,7 +303,7 @@ def test_load_theme_cfg(self):
303303
304304 def test_theme_source (self ):
305305 eq = self .assertEqual
306- d = dialog
306+ d = self . page
307307 # Test these separately.
308308 d .var_changed_builtin_name = Func ()
309309 d .var_changed_custom_name = Func ()
@@ -324,7 +324,7 @@ def test_theme_source(self):
324324
325325 def test_builtin_name (self ):
326326 eq = self .assertEqual
327- d = dialog
327+ d = self . page
328328 item_list = ['IDLE Classic' , 'IDLE Dark' , 'IDLE New' ]
329329
330330 # Not in old_themes, defaults name to first item.
@@ -351,7 +351,7 @@ def test_builtin_name(self):
351351 eq (d .paint_theme_sample .called , 3 )
352352
353353 def test_custom_name (self ):
354- d = dialog
354+ d = self . page
355355
356356 # If no selections, doesn't get added.
357357 d .customlist .SetMenu ([], '- no custom themes -' )
@@ -365,7 +365,7 @@ def test_custom_name(self):
365365 self .assertEqual (d .paint_theme_sample .called , 1 )
366366
367367 def test_color (self ):
368- d = dialog
368+ d = self . page
369369 d .on_new_color_set = Func ()
370370 # self.color is only set in get_color through ColorChooser.
371371 d .color .set ('green' )
@@ -375,7 +375,7 @@ def test_color(self):
375375 def test_highlight_target_list_mouse (self ):
376376 # Set highlight_target through targetlist.
377377 eq = self .assertEqual
378- d = dialog
378+ d = self . page
379379
380380 d .targetlist .SetMenu (['a' , 'b' , 'c' ], 'c' )
381381 eq (d .highlight_target .get (), 'c' )
@@ -384,7 +384,7 @@ def test_highlight_target_list_mouse(self):
384384 def test_highlight_target_text_mouse (self ):
385385 # Set highlight_target through clicking highlight_sample.
386386 eq = self .assertEqual
387- d = dialog
387+ d = self . page
388388
389389 elem = {}
390390 count = 0
@@ -420,7 +420,7 @@ def click_it(start):
420420
421421 def test_set_theme_type (self ):
422422 eq = self .assertEqual
423- d = dialog
423+ d = self . page
424424 del d .set_theme_type
425425
426426 # Builtin theme selected.
@@ -441,7 +441,7 @@ def test_set_theme_type(self):
441441
442442 def test_get_color (self ):
443443 eq = self .assertEqual
444- d = dialog
444+ d = self . page
445445 orig_chooser = configdialog .tkColorChooser .askcolor
446446 chooser = configdialog .tkColorChooser .askcolor = Func ()
447447 gntn = d .get_new_theme_name = Func ()
@@ -487,7 +487,7 @@ def test_get_color(self):
487487 configdialog .tkColorChooser .askcolor = orig_chooser
488488
489489 def test_on_new_color_set (self ):
490- d = dialog
490+ d = self . page
491491 color = '#3f7cae'
492492 d .custom_name .set ('Python' )
493493 d .highlight_target .set ('Selected Text' )
@@ -502,15 +502,15 @@ def test_on_new_color_set(self):
502502 def test_get_new_theme_name (self ):
503503 orig_sectionname = configdialog .SectionName
504504 sn = configdialog .SectionName = Func (return_self = True )
505- d = dialog
505+ d = self . page
506506
507507 sn .result = 'New Theme'
508508 self .assertEqual (d .get_new_theme_name ('' ), 'New Theme' )
509509
510510 configdialog .SectionName = orig_sectionname
511511
512512 def test_save_as_new_theme (self ):
513- d = dialog
513+ d = self . page
514514 gntn = d .get_new_theme_name = Func ()
515515 d .theme_source .set (True )
516516
@@ -530,7 +530,7 @@ def test_save_as_new_theme(self):
530530
531531 def test_create_new_and_save_new (self ):
532532 eq = self .assertEqual
533- d = dialog
533+ d = self . page
534534
535535 # Use default as previously active theme.
536536 d .theme_source .set (True )
@@ -562,7 +562,7 @@ def test_create_new_and_save_new(self):
562562
563563 def test_set_highlight_target (self ):
564564 eq = self .assertEqual
565- d = dialog
565+ d = self . page
566566 del d .set_highlight_target
567567
568568 # Target is cursor.
@@ -582,7 +582,7 @@ def test_set_highlight_target(self):
582582 d .set_highlight_target = Func ()
583583
584584 def test_set_color_sample_binding (self ):
585- d = dialog
585+ d = self . page
586586 scs = d .set_color_sample
587587
588588 d .fg_on .invoke ()
@@ -592,7 +592,7 @@ def test_set_color_sample_binding(self):
592592 self .assertEqual (scs .called , 2 )
593593
594594 def test_set_color_sample (self ):
595- d = dialog
595+ d = self . page
596596 del d .set_color_sample
597597 d .highlight_target .set ('Selected Text' )
598598 d .fg_bg_toggle .set (True )
@@ -603,7 +603,7 @@ def test_set_color_sample(self):
603603
604604 def test_paint_theme_sample (self ):
605605 eq = self .assertEqual
606- d = dialog
606+ d = self . page
607607 del d .paint_theme_sample
608608 hs_tag = d .highlight_sample .tag_cget
609609 gh = idleConf .GetHighlight
@@ -640,7 +640,7 @@ def test_paint_theme_sample(self):
640640
641641 def test_delete_custom (self ):
642642 eq = self .assertEqual
643- d = dialog
643+ d = self . page
644644 d .button_delete_custom ['state' ] = NORMAL
645645 yesno = configdialog .tkMessageBox .askyesno = Func ()
646646 dialog .deactivate_current_config = Func ()
0 commit comments