<s> import unittest <EOL> import env <EOL> import shutil <EOL> import platform <EOL> from os import path , mkdir <EOL> from index_runner import index_all <EOL> from queue . scanner import Scanner <EOL> from get_keyword import GetKeyword <EOL> class TestGetKeywordFromResource ( unittest . TestCase ) : <EOL> @ classmethod <EOL> def setUpClass ( cls ) : <EOL> db_base = path . join ( <EOL> env . RESULTS_DIR , <EOL> '<STR_LIT>' ) <EOL> cls . db_dir = path . join ( <EOL> db_base , <EOL> '<STR_LIT>' <EOL> ) <EOL> cls . index_dir = path . join ( <EOL> db_base , <EOL> '<STR_LIT>' , <EOL> ) <EOL> cls . suite_dir = path . join ( <EOL> env . TEST_DATA_DIR , <EOL> '<STR_LIT>' <EOL> ) <EOL> if path . exists ( db_base ) : <EOL> shutil . rmtree ( db_base ) <EOL> mkdir ( db_base ) <EOL> mkdir ( cls . db_dir ) <EOL> mkdir ( cls . index_dir ) <EOL> scanner = Scanner ( ) <EOL> scanner . scan ( <EOL> cls . suite_dir , <EOL> '<STR_LIT>' , <EOL> cls . db_dir ) <EOL> index_all ( cls . db_dir , cls . index_dir ) <EOL> cls . rf_ext = '<STR_LIT>' <EOL> def setUp ( self ) : <EOL> self . get_kw = GetKeyword ( <EOL> table_dir = self . db_dir , <EOL> index_dir = self . index_dir , <EOL> open_tab = self . get_common_robot_path , <EOL> rf_extension = self . rf_ext <EOL> ) <EOL> def test_get_lib_kw ( self ) : <EOL> regex , file_path = self . get_kw . get_lib_keyword ( <EOL> self . s2l_table_file , <EOL> None , <EOL> '<STR_LIT>' <EOL> ) <EOL> self . assertIsNotNone ( regex ) <EOL> self . assertIsNotNone ( file_path ) <EOL> def test_get_lib_keyword_file ( self ) : <EOL> kw_file = self . get_kw . get_lib_keyword_file ( <EOL> self . s2l_table_file , <EOL> None , <EOL> '<STR_LIT>' <EOL> ) <EOL> self . assertIn ( self . s2l_simulate , kw_file ) <EOL> kw_file = self . get_kw . get_lib_keyword_file ( <EOL> self . s2l_table_file , <EOL> None , <EOL> '<STR_LIT>' <EOL> ) <EOL> self . assertIn ( self . s2l_textarea_value_should_be , kw_file ) <EOL> kw_file = self . get_kw . get_lib_keyword_file ( <EOL> self . s2l_table_file , <EOL> None , <EOL> '<STR_LIT>' <EOL> ) <EOL> self . assertIn ( self . s2l_press_key , kw_file ) <EOL> kw_file = self . get_kw . get_lib_keyword_file ( <EOL> self . s2l_table_file , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' <EOL> ) <EOL> self . assertIn ( self . s2l_press_key , kw_file ) <EOL> kw_file = self . get_kw . get_lib_keyword_file ( <EOL> self . s2l_table_file , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' <EOL> ) <EOL> self . assertEqual ( kw_file , None ) <EOL> kw_file = self . get_kw . get_lib_keyword_file ( <EOL> self . s2l_table_file , <EOL> None , <EOL> '<STR_LIT>' <EOL> ) <EOL> self . assertEqual ( kw_file , None ) <EOL> def test_get_regex_library ( self ) : <EOL> kw = '<STR_LIT>' <EOL> regex = self . get_kw . get_regex_library ( kw ) <EOL> self . assertEqual ( <EOL> regex , <EOL> r'<STR_LIT>' <EOL> ) <EOL> kw = '<STR_LIT>' <EOL> regex = self . get_kw . get_regex_library ( kw ) <EOL> self . assertEqual ( <EOL> regex , <EOL> r'<STR_LIT>' <EOL> ) <EOL> @ property <EOL> def s2l ( self ) : <EOL> if platform . system ( ) == '<STR_LIT>' : <EOL> return '<STR_LIT>' <EOL> else : <EOL> return '<STR_LIT>' <EOL> @ property <EOL> def s2l_simulate ( self ) : <EOL> return path . join ( self . s2l , '<STR_LIT>' , '<STR_LIT>' ) <EOL> @ property <EOL> def s2l_press_key ( self ) : <EOL> return path . join ( self . s2l , '<STR_LIT>' , '<STR_LIT>' ) <EOL> @ property <EOL> def s2l_textarea_value_should_be ( self ) : <EOL> return path . join ( self . s2l , '<STR_LIT>' , '<STR_LIT>' ) <EOL> @ property <EOL> def s2l_table_file ( self ) : <EOL> return path . join ( <EOL> self . db_dir , <EOL> '<STR_LIT>' <EOL> ) <EOL> @ property <EOL> def get_common_robot ( self ) : <EOL> return '<STR_LIT>' <EOL> @ property <EOL> def get_common_robot_path ( self ) : <EOL> return path . join ( self . suite_dir , self . get_common_robot ) </s>
