How to use get_downloaded_file_path method in toolium

Best Python code snippet using toolium_python

resto_client_cli_test.py

Source:resto_client_cli_test.py Github

copy

Full Screen

...66 """67 self.assert_in_settings(settings_key)68 self.assertEqual(RESTO_CLIENT_SETTINGS[settings_key], expected_value)69 @staticmethod70 def get_downloaded_file_path(base_filename: str) -> Path:71 """72 Returns the path in the downlaod directory of a file specified by its basename.73 :param base_filename: base file name74 :returns: the path to the file75 """76 return (Path(RESTO_CLIENT_SETTINGS[DOWNLOAD_DIR_KEY]) /77 RESTO_CLIENT_SETTINGS[SERVER_KEY] / base_filename)78 def assert_downloaded_file_ok(self, base_filename: str) -> None:79 """80 Verify that the download file is correct.81 :param base_filename: base file name82 """83 downloaded_file_path = self.get_downloaded_file_path(base_filename)84 self.assertTrue(downloaded_file_path.is_file(),85 'Could not find expected file: {}'.format(str(downloaded_file_path)))86 def do_test_download_file(self, command: List[str], expected_files: List[str]) -> None:87 """88 Test that the provided command, which is supposed to download one or several files,89 succeed in downloading them.90 :param command: list of words composing the command91 :param expected_files: the base file names of the expected downloaded files92 """93 with TemporaryDirectory() as tmp_dir:94 resto_client_run(arguments=['set', 'download_dir', tmp_dir])95 resto_client_run(arguments=command)96 for file_name in expected_files:97 self.assert_downloaded_file_ok(file_name)...

Full Screen

Full Screen

pfam.py

Source:pfam.py Github

copy

Full Screen

...21 self, record, tmp_path_prefix, max_evalue=0.01, db_path=None, clans_path=None22 ):23 self.record = record24 self.tmp_path_prefix = tmp_path_prefix25 self.db_path = db_path or util.get_downloaded_file_path(26 PFAM_DB_FILE_NAME, versioned=False27 )28 self.clans_path = clans_path or util.get_downloaded_file_path(29 PFAM_CLANS_FILE_NAME, versioned=False30 )31 self.max_evalue = max_evalue32 def _write_proteins(self, proteins, protein_path):33 records = []34 for feature in proteins:35 translation_str = feature.qualifiers.get("translation", [None])[0]36 if translation_str:37 translation = Seq(translation_str)38 else:39 translation = feature.extract(self.record.seq).translate()40 records.append(41 SeqRecord(translation, util.get_protein_id(feature), description="")42 )...

Full Screen

Full Screen

utils.py

Source:utils.py Github

copy

Full Screen

...19 r = redis.StrictRedis(host=constants.REDIS_HOST, port=constants.REDIS_PORT,20 password=constants.REDIS_PWD, charset=constants.REDIS_CHARSET, decode_responses=True)21 return r22# returns absolute file path to work on23def get_downloaded_file_path():24 page = requests.get(constants.BSE_URL) # get page content from API25 soup = BeautifulSoup(page.content, constants.HTML_PARSER)26 '''The desired link is in iframe. 27 So find frame and get source url'''28 iframe = soup.find(constants.IFRAME)29 frame_page = requests.get(constants.URL_PREFIX + get_frame_source_url(iframe))30 soup = BeautifulSoup(frame_page.content, constants.HTML_PARSER)31 resultant_list = soup.select(constants.ZIP_FILE_LOCATOR_ID)32 # get zip file url33 zip_file_url = get_zip_file_url(resultant_list)34 # download zip file35 zip_file = requests.get(zip_file_url)36 # read zip contents37 z = zipfile.ZipFile(io.BytesIO(zip_file.content))38 # extracts it to a folder39 z.extractall(constants.RESOURCES)40 # returns absolute file path41 return str(constants.RESOURCES + '/' + z.namelist()[0])42# returns top 10 stock list43def get_top_10_list():44 equity_csv_file = get_downloaded_file_path() # get file source45 conn = connect_redis_db() # get redis connection46 conn.flushall() # flush all data before insert new one47 ''' open csv file and read each lines.48 Store the split values in db with appropriate fields'''49 with open(equity_csv_file, 'r') as file:50 headers = next(file).split(',') # split headers for hashes filed entries51 for line in file:52 values = line.split(',')53 mapping = {headers[0]: values[0].strip(), headers[1]: values[1].strip(), headers[2]: values[2].strip(),54 headers[3]: values[3].strip(), headers[4]: float(values[4]), headers[5]: float(values[5]),55 headers[6]: float(values[6]), headers[7]: float(values[7]), headers[8]: float(values[8]),56 headers[9]: float(values[9]), headers[10]: int(values[10]), headers[11]: int(values[11]),57 headers[12]: float(values[12])}58 conn.hmset(values[1].strip(), mapping)...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run toolium automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful