<s> """<STR_LIT>""" <EOL> import sublime <EOL> import inspect <EOL> import re <EOL> import sys <EOL> if sys . version_info < ( <NUM_LIT:3> , <NUM_LIT:0> ) : <EOL> from tableofcomments import TableOfComments <EOL> else : <EOL> from . . tableofcomments import TableOfComments <EOL> class TestCase ( ) : <EOL> output = '<STR_LIT>' <EOL> errors = [ ] <EOL> def __init__ ( self , view , edit ) : <EOL> self . output = '<STR_LIT>' <EOL> self . errors = [ ] <EOL> self . view = view <EOL> self . edit = edit <EOL> def setup ( self ) : <EOL> self . view . set_syntax_file ( '<STR_LIT>' ) <EOL> def run ( self ) : <EOL> self . backup_plugin_settings ( ) <EOL> self . set_settings ( { <EOL> '<STR_LIT>' : '<STR_LIT:>>' , <EOL> '<STR_LIT>' : '<STR_LIT:->' <EOL> } ) <EOL> methods = self . get_test_methods ( ) <EOL> for testname in methods : <EOL> self . output += testname + '<STR_LIT>' <EOL> eval ( '<STR_LIT>' + testname + '<STR_LIT>' ) <EOL> self . output += '<STR_LIT:\n>' <EOL> self . restore_plugin_settings ( ) <EOL> return self . output <EOL> def teardown ( self ) : <EOL> pass <EOL> def get_test_methods ( self ) : <EOL> test_methods = [ ] <EOL> members = inspect . getmembers ( self , predicate = inspect . ismethod ) <EOL> for name , func in members : <EOL> if name . find ( "<STR_LIT>" ) == <NUM_LIT:0> : <EOL> test_methods . append ( name ) <EOL> return test_methods <EOL> def set_text ( self , text ) : <EOL> self . view . replace ( self . edit , sublime . Region ( <NUM_LIT:0> , self . view . size ( ) ) , '<STR_LIT>' ) <EOL> self . view . insert ( self . edit , <NUM_LIT:0> , text ) <EOL> def get_text ( self ) : <EOL> return self . view . substr ( sublime . Region ( <NUM_LIT:0> , self . view . size ( ) ) ) <EOL> def get_plugin ( self ) : <EOL> return TableOfComments ( self . view , self . edit ) <EOL> def run_plugin ( self ) : <EOL> self . view . run_command ( '<STR_LIT>' ) <EOL> def set_syntax ( self , syntax ) : <EOL> shortcuts = { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' <EOL> } <EOL> if syntax in shortcuts . keys ( ) : <EOL> syntax = shortcuts [ syntax ] <EOL> self . view . set_syntax_file ( syntax ) <EOL> def backup_plugin_settings ( self ) : <EOL> self . settings = sublime . load_settings ( <EOL> '<STR_LIT>' ) <EOL> self . _original_settings = { } <EOL> for name in [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] : <EOL> if self . settings . has ( name ) : <EOL> self . _original_settings [ name ] = self . settings . get ( name ) <EOL> def restore_plugin_settings ( self ) : <EOL> if self . _original_settings : <EOL> values = self . _original_settings <EOL> for name in values : <EOL> self . settings . set ( name , values [ name ] ) <EOL> sublime . save_settings ( '<STR_LIT>' ) <EOL> def set_settings ( self , settings ) : <EOL> for name in settings : <EOL> self . settings . set ( name , settings [ name ] ) <EOL> sublime . save_settings ( '<STR_LIT>' ) <EOL> def error ( self , text ) : <EOL> self . errors . append ( text ) <EOL> self . output += '<STR_LIT:F>' <EOL> def ok ( self ) : <EOL> self . output += '<STR_LIT:.>' <EOL> def assert_true ( self , value , msg = '<STR_LIT>' ) : <EOL> if value is True : <EOL> self . ok ( ) <EOL> return True <EOL> else : <EOL> self . error ( msg ) <EOL> return False <EOL> def assert_false ( self , value , msg = '<STR_LIT>' ) : <EOL> if value is False : <EOL> self . ok ( ) <EOL> return True <EOL> else : <EOL> self . error ( msg ) <EOL> return False <EOL> def text_equals ( self , sent ) : <EOL> text = self . get_text ( ) <EOL> if text . strip ( ) == sent . strip ( ) : <EOL> self . ok ( ) <EOL> else : <EOL> self . error ( <EOL> "<STR_LIT>" + "<STR_LIT>" + text + <EOL> "<STR_LIT>" + sent + "<STR_LIT>" <EOL> ) <EOL> def find ( self , text ) : <EOL> result = self . get_text ( ) <EOL> match = result . find ( text ) <EOL> if match >= <NUM_LIT:0> : <EOL> self . ok ( ) <EOL> return True <EOL> else : <EOL> self . error ( "<STR_LIT>" + text + "<STR_LIT>" ) <EOL> return False </s>
