<s> import unittest <EOL> from robot . conf . settings import _BaseSettings , RobotSettings , RebotSettings <EOL> from robot . errors import DataError <EOL> from robot . utils . asserts import assert_equal <EOL> class SettingWrapper ( _BaseSettings ) : <EOL> def __init__ ( self ) : <EOL> pass <EOL> class TestRobotAndRebotSettings ( unittest . TestCase ) : <EOL> def test_robot_and_rebot_settings_are_independent ( self ) : <EOL> orig_opts = RobotSettings ( ) . _opts <EOL> RebotSettings ( ) <EOL> assert_equal ( RobotSettings ( ) . _opts , orig_opts ) <EOL> def test_extra_options ( self ) : <EOL> assert_equal ( RobotSettings ( name = '<STR_LIT>' ) [ '<STR_LIT:Name>' ] , '<STR_LIT>' ) <EOL> assert_equal ( RobotSettings ( { '<STR_LIT:name>' : '<STR_LIT>' } , name = '<STR_LIT>' ) [ '<STR_LIT:Name>' ] , '<STR_LIT>' ) <EOL> def test_multi_options_as_single_string ( self ) : <EOL> assert_equal ( RobotSettings ( { '<STR_LIT:test>' : '<STR_LIT>' } ) [ '<STR_LIT>' ] , [ '<STR_LIT>' ] ) <EOL> assert_equal ( RebotSettings ( { '<STR_LIT>' : '<STR_LIT>' } ) [ '<STR_LIT>' ] , [ '<STR_LIT>' ] ) <EOL> def test_output_files_as_none_string ( self ) : <EOL> for name in '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' : <EOL> attr = ( name [ : - <NUM_LIT:4> ] if name . endswith ( '<STR_LIT>' ) else name ) . lower ( ) <EOL> settings = RobotSettings ( { name . lower ( ) : '<STR_LIT>' } ) <EOL> assert_equal ( settings [ name ] , None ) <EOL> if hasattr ( settings , attr ) : <EOL> assert_equal ( getattr ( settings , attr ) , None ) <EOL> def test_output_files_as_none_object ( self ) : <EOL> for name in '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' : <EOL> attr = ( name [ : - <NUM_LIT:4> ] if name . endswith ( '<STR_LIT>' ) else name ) . lower ( ) <EOL> settings = RobotSettings ( { name . lower ( ) : None } ) <EOL> assert_equal ( settings [ name ] , None ) <EOL> if hasattr ( settings , attr ) : <EOL> assert_equal ( getattr ( settings , attr ) , None ) <EOL> def test_log_levels ( self ) : <EOL> self . _verify_log_level ( '<STR_LIT>' ) <EOL> self . _verify_log_level ( '<STR_LIT>' ) <EOL> self . _verify_log_level ( '<STR_LIT>' ) <EOL> self . _verify_log_level ( '<STR_LIT>' ) <EOL> self . _verify_log_level ( '<STR_LIT>' ) <EOL> def test_default_log_level ( self ) : <EOL> self . _verify_log_levels ( RobotSettings ( ) , '<STR_LIT>' ) <EOL> self . _verify_log_levels ( RebotSettings ( ) , '<STR_LIT>' ) <EOL> def _verify_log_level ( self , input , level = None , default = None ) : <EOL> level = level or input <EOL> default = default or level <EOL> self . _verify_log_levels ( RobotSettings ( { '<STR_LIT>' : input } ) , level , default ) <EOL> self . _verify_log_levels ( RebotSettings ( { '<STR_LIT>' : input } ) , level , default ) <EOL> def _verify_log_levels ( self , settings , level , default = None ) : <EOL> assert_equal ( settings [ '<STR_LIT>' ] , level ) <EOL> assert_equal ( settings [ '<STR_LIT>' ] , default or level ) <EOL> def test_log_levels_with_default ( self ) : <EOL> self . _verify_log_level ( '<STR_LIT>' , level = '<STR_LIT>' , default = '<STR_LIT>' ) <EOL> self . _verify_log_level ( '<STR_LIT>' , level = '<STR_LIT>' , default = '<STR_LIT>' ) <EOL> self . _verify_log_level ( '<STR_LIT>' , level = '<STR_LIT>' , default = '<STR_LIT>' ) <EOL> def test_invalid_log_level ( self ) : <EOL> self . _verify_invalid_log_level ( '<STR_LIT>' ) <EOL> self . _verify_invalid_log_level ( '<STR_LIT>' ) <EOL> self . _verify_invalid_log_level ( '<STR_LIT>' ) <EOL> self . _verify_invalid_log_level ( '<STR_LIT>' ) <EOL> def test_visible_level_higher_than_normal_level ( self ) : <EOL> self . _verify_invalid_log_level ( '<STR_LIT>' ) <EOL> self . _verify_invalid_log_level ( '<STR_LIT>' ) <EOL> def _verify_invalid_log_level ( self , input ) : <EOL> self . assertRaises ( DataError , RobotSettings , { '<STR_LIT>' : input } ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> unittest . main ( ) </s>
