<s> import unittest <EOL> import Tkinter as tkinter <EOL> import ttk <EOL> from test . test_support import requires , run_unittest <EOL> from test_ttk . support import AbstractTkTest <EOL> requires ( '<STR_LIT>' ) <EOL> class StyleTest ( AbstractTkTest , unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> super ( StyleTest , self ) . setUp ( ) <EOL> self . style = ttk . Style ( self . root ) <EOL> def test_configure ( self ) : <EOL> style = self . style <EOL> style . configure ( '<STR_LIT>' , background = '<STR_LIT>' ) <EOL> self . assertEqual ( style . configure ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> '<STR_LIT>' ) <EOL> self . assertIsInstance ( style . configure ( '<STR_LIT>' ) , dict ) <EOL> def test_map ( self ) : <EOL> style = self . style <EOL> style . map ( '<STR_LIT>' , background = [ ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) ] ) <EOL> self . assertEqual ( style . map ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> [ ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) ] if self . wantobjects else <EOL> [ ( '<STR_LIT>' , '<STR_LIT>' ) ] ) <EOL> self . assertIsInstance ( style . map ( '<STR_LIT>' ) , dict ) <EOL> def test_lookup ( self ) : <EOL> style = self . style <EOL> style . configure ( '<STR_LIT>' , background = '<STR_LIT>' ) <EOL> style . map ( '<STR_LIT>' , background = [ ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) ] ) <EOL> self . assertEqual ( style . lookup ( '<STR_LIT>' , '<STR_LIT>' ) , '<STR_LIT>' ) <EOL> self . assertEqual ( style . lookup ( '<STR_LIT>' , '<STR_LIT>' , <EOL> [ '<STR_LIT>' , '<STR_LIT>' ] ) , '<STR_LIT>' ) <EOL> self . assertEqual ( style . lookup ( '<STR_LIT>' , '<STR_LIT>' , <EOL> default = '<STR_LIT>' ) , '<STR_LIT>' ) <EOL> def test_layout ( self ) : <EOL> style = self . style <EOL> self . assertRaises ( tkinter . TclError , style . layout , '<STR_LIT>' ) <EOL> tv_style = style . layout ( '<STR_LIT>' ) <EOL> style . layout ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertEqual ( style . layout ( '<STR_LIT>' ) , <EOL> [ ( '<STR_LIT:null>' , { '<STR_LIT>' : '<STR_LIT>' } ) ] <EOL> ) <EOL> style . layout ( '<STR_LIT>' , tv_style ) <EOL> self . assertEqual ( style . layout ( '<STR_LIT>' ) , tv_style ) <EOL> self . assertIsInstance ( style . layout ( '<STR_LIT>' ) , list ) <EOL> self . assertRaises ( tkinter . TclError , style . layout , '<STR_LIT>' , <EOL> [ ( '<STR_LIT:name>' , { '<STR_LIT>' : '<STR_LIT>' } ) ] ) <EOL> def test_theme_use ( self ) : <EOL> self . assertRaises ( tkinter . TclError , self . style . theme_use , <EOL> '<STR_LIT>' ) <EOL> curr_theme = self . style . theme_use ( ) <EOL> new_theme = None <EOL> for theme in self . style . theme_names ( ) : <EOL> if theme != curr_theme : <EOL> new_theme = theme <EOL> self . style . theme_use ( theme ) <EOL> break <EOL> else : <EOL> return <EOL> self . assertFalse ( curr_theme == new_theme ) <EOL> self . assertFalse ( new_theme != self . style . theme_use ( ) ) <EOL> self . style . theme_use ( curr_theme ) <EOL> tests_gui = ( StyleTest , ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> run_unittest ( * tests_gui ) </s>
