Best Python code snippet using localstack_python
data_reader.py
Source:data_reader.py
...25 26 inv_dictionary = {v: k for k, v in dictionary.items()} 27 self.data = self.data.rename(inv_dictionary, axis = 'columns')28 29 def convert_data_types(self, ths_separator = ' ', decimal_separator = ','): 30 self.data['Amount'] = self.data['Amount'].str.replace(ths_separator, '')31 self.data['Amount'] = self.data['Amount'].str.replace(decimal_separator, '.')32 self.data = self.data.astype({'Amount': 'float'}) 33 self.data['Transaction time'] = pd.to_datetime(self.data['Transaction time'])34 35 def reshape_data(self, dictionary, 36 ths_separator = ' ', decimal_separator = ',', date_format = '%Y.%m.%d. %H:%M:S'):37 self.identify_columns(dictionary)38 39 if self.fileType=='csv':40 self.convert_data_types(ths_separator=ths_separator, decimal_separator = decimal_separator)41 42########################43data_reader = dataReader()44data_reader.read_data(path ='E:\\Software Engineering\\SmartPurse\\testing things\\2021_input_b_csv2.csv',45 file_type='csv', sep=';', header=14)46example_dictionary = {47 'Transaction type' : 'Forgalom tÃpusa',48 'Transaction time' : 'Tranzakció idÅpontja',49 'Amount' : 'Ãsszeg',50 'Counterparty account number' : 'Ellenoldali számlaszám',51 'Counterparty account name' : 'Ellenoldali név',52 'Description' : 'Közlemény' 53 }54data_reader.reshape_data(example_dictionary)...
geographic_objects.py
Source: geographic_objects.py
...11 def __init__(self, FILE_ADDRESS, FOLDER_ADDRESS):12 #latitude szerokoÅÄ geograficzna (Y)13 #longitude dÅugosÄ geograficzna (X)14 data = DataImport(FILE_ADDRESS, "dict", FOLDER_ADDRESS)15 self.data = self.convert_data_types(data(), "float")16 self.calculate_radians_for_latitude_and_longitude()17 def __call__(self):18 return self.data19 def convert_data_types(self, data_list, DATA_TYPE):20 output = {}21 for key in data_list:22 value = data_list[key]23 output[key] = self.convert_data_type(value, DATA_TYPE)24 return output25 def convert_data_type(self, input, data_type):26 if input == "N/A" or input == "None":27 return None28 elif data_type == "str":29 return input30 elif data_type == "int":31 return int(input)32 elif data_type == "float":33 return float(input)34 def calculate_radians_for_latitude_and_longitude(self):35 self.data["latitude_rad"] = deg_to_rad(self.data["latitude_deg"])36 self.data["longitude_rad"] = deg_to_rad(self.data["longitude_deg"])37#--------------------------------------------------------------------------------------------38class Ship(GeographicObject):39 def __init__(self, FILE_ADDRESS, FOLDER_ADDRESS):40 #latitude szerokoÅÄ geograficzna (Y)41 #longitude dÅugosÄ geograficzna (X)42 data = DataImport(FILE_ADDRESS, "dict", FOLDER_ADDRESS)43 self.data = self.convert_data_types(data(), "float")44 self.calculate_radians_for_latitude_and_longitude()45 self.calculate_heading_rad()46 def calculate_heading_rad(self):47 self.data["heading_rad"] = deg_to_rad(self.data["heading_deg"])48#--------------------------------------------------------------------------------------------49if __name__ == "__main__":50 test = 351 os.chdir("..")52 if test == 1:53 ship = GeographicObject("SHIP_DATA_INPUT.txt", "data_files")54 print(ship())55 if test == 2:56 point = GeographicObject("POINT_DATA_INPUT.txt", "data_files")57 print(point())...
test_handler.py
Source: test_handler.py
...14 "store_and_fwd_flag": "N"15 }16 17 def test_given_valid_route_IT_should_succeed(self):18 result = convert_data_types([self.ROUTE])19 self.assertEqual(1, result[0]['vendor_id'])20 self.assertEqual(datetime(2016, 6, 30, 23, 59, 58), result[0]['pickup_datetime'])21 self.assertEqual(-73.9881286621094, result[0]['pickup_longitude'])22 23if __name__ == '__main__':...
Check out the latest blogs from LambdaTest on this topic:
In some sense, testing can be more difficult than coding, as validating the efficiency of the test cases (i.e., the ‘goodness’ of your tests) can be much harder than validating code correctness. In practice, the tests are just executed without any validation beyond the pass/fail verdict. On the contrary, the code is (hopefully) always validated by testing. By designing and executing the test cases the result is that some tests have passed, and some others have failed. Testers do not know much about how many bugs remain in the code, nor about their bug-revealing efficiency.
With the rising demand for new services and technologies in the IT, manufacturing, healthcare, and financial sector, QA/ DevOps engineering has become the most important part of software companies. Below is a list of some characteristics to look for when interviewing a potential candidate.
Technical debt was originally defined as code restructuring, but in today’s fast-paced software delivery environment, it has evolved. Technical debt may be anything that the software development team puts off for later, such as ineffective code, unfixed defects, lacking unit tests, excessive manual tests, or missing automated tests. And, like financial debt, it is challenging to pay back.
In addition to the four values, the Agile Manifesto contains twelve principles that are used as guides for all methodologies included under the Agile movement, such as XP, Scrum, and Kanban.
People love to watch, read and interact with quality content — especially video content. Whether it is sports, news, TV shows, or videos captured on smartphones, people crave digital content. The emergence of OTT platforms has already shaped the way people consume content. Viewers can now enjoy their favorite shows whenever they want rather than at pre-set times. Thus, the OTT platform’s concept of viewing anything, anytime, anywhere has hit the right chord.
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!