<s> if __name__ == "<STR_LIT:__main__>" : <EOL> import sys <EOL> sys . path . append ( '<STR_LIT>' ) <EOL> import unittest2 as unittest <EOL> from vdebug . opts import Options , OptionsError <EOL> class OptionsTest ( unittest . TestCase ) : <EOL> def tearDown ( self ) : <EOL> Options . instance = None <EOL> def test_has_instance ( self ) : <EOL> Options . set ( { <NUM_LIT:1> : "<STR_LIT:hello>" , <NUM_LIT:2> : "<STR_LIT>" } ) <EOL> self . assertIsInstance ( Options . inst ( ) , Options ) <EOL> def test_get_option ( self ) : <EOL> Options . set ( { '<STR_LIT:foo>' : "<STR_LIT:hello>" , '<STR_LIT:bar>' : "<STR_LIT>" } ) <EOL> self . assertEqual ( "<STR_LIT:hello>" , Options . get ( '<STR_LIT:foo>' ) ) <EOL> def test_get_option_as_type ( self ) : <EOL> Options . set ( { '<STR_LIT:foo>' : "<STR_LIT:1>" , '<STR_LIT:bar>' : "<STR_LIT:2>" } ) <EOL> opt = Options . get ( '<STR_LIT:foo>' , int ) <EOL> self . assertIsInstance ( opt , int ) <EOL> self . assertEqual ( <NUM_LIT:1> , opt ) <EOL> def test_option_is_not_set ( self ) : <EOL> Options . set ( { '<STR_LIT:foo>' : "<STR_LIT>" , '<STR_LIT:bar>' : "<STR_LIT:2>" } ) <EOL> self . assertFalse ( Options . isset ( "<STR_LIT>" ) ) <EOL> def test_option_is_not_valid ( self ) : <EOL> Options . set ( { '<STR_LIT:foo>' : "<STR_LIT>" , '<STR_LIT:bar>' : "<STR_LIT:2>" } ) <EOL> self . assertFalse ( Options . isset ( "<STR_LIT>" ) ) <EOL> def test_option_isset ( self ) : <EOL> Options . set ( { '<STR_LIT:foo>' : "<STR_LIT>" , '<STR_LIT:bar>' : "<STR_LIT:2>" } ) <EOL> self . assertTrue ( Options . isset ( "<STR_LIT:bar>" ) ) <EOL> def test_uninit_raises_error ( self ) : <EOL> self . assertRaises ( OptionsError , Options . isset , '<STR_LIT>' ) <EOL> def test_get_raises_error ( self ) : <EOL> Options . set ( { '<STR_LIT:foo>' : "<STR_LIT:1>" , '<STR_LIT:bar>' : "<STR_LIT:2>" } ) <EOL> self . assertRaises ( OptionsError , Options . get , '<STR_LIT>' ) </s>
