Best Python code snippet using autotest_python
topic_common.py
Source:topic_common.py
...93# much longer than the default94UPLOAD_SOCKET_TIMEOUT = 60*3095# Convertion functions to be called for printing,96# e.g. to print True/False for booleans.97def __convert_platform(field):98 if field is None:99 return ""100 elif isinstance(field, int):101 # Can be 0/1 for False/True102 return str(bool(field))103 else:104 # Can be a platform name105 return field106def _int_2_bool_string(value):107 return str(bool(value))108KEYS_CONVERT = {'locked': _int_2_bool_string,109 'invalid': lambda flag: str(bool(not flag)),110 'only_if_needed': _int_2_bool_string,111 'platform': __convert_platform,...
last_seen.py
Source:last_seen.py
...38 """39 :ru СвойÑÑво Ð´Ð»Ñ Ð¿Ð¾Ð»ÑÑÐµÐ½Ð¸Ñ Ð¸Ð½ÑоÑмаÑии о Ñом, Ñ ÐºÐ°ÐºÐ¾Ð³Ð¾ ÑÑÑÑойÑÑва полÑзоваÑÐµÐ»Ñ Ð·Ð°Ñ
одил в поÑледний Ñаз.40 :en A property for getting information about which device the user last logged in from.41 """42 return self.__convert_platform(self.__last_seen['platform']) if 'platform' in self.__last_seen else None43 def get_json(self) -> json:44 """45 :ru ÐÑÐ¾Ñ Ð¼ÐµÑод ÑоÑмиÑÑÐµÑ json обÑÐµÐºÑ Ð¸Ð· полей клаÑÑа 'LastSeen'.46 :en This method generates a json object from the fields of the 'LastSeen' class.47 """48 return {"time": self.time.strftime('%Y-%m-%d %H:%M:%S'),49 "platform": self.platform.name}50 @staticmethod51 def __convert_platform(platform: int) -> Platform:52 """53 :ru ÐÑÐ¾Ñ Ð¿ÑиваÑнÑй меÑод конвеÑÑиÑÑÐµÑ ÑиÑловое пÑедÑÑавление знаÑÐµÐ½Ð¸Ñ 'platform' в Enum 'Platform'.54 :en This private method converts the numeric representation of the value 'platform' to Enum 'Platform'.55 :param platform:ru ЧиÑловое пÑедÑÑавление знаÑÐµÐ½Ð¸Ñ 'platform'.56 :param platform:en Numeric representation of the 'platform' value.57 :type platform: int58 """59 if platform == 1:60 return Platform.MOBILE_SITE # ÐобилÑÐ½Ð°Ñ Ð²ÐµÑÑиÑ61 elif platform == 2:62 return Platform.IPHONE_APP # ÐÑиложение Ð´Ð»Ñ iPhone63 elif platform == 3:64 return Platform.IPAD_APP # ÐÑиложение Ð´Ð»Ñ iPad65 elif platform == 4:...
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!!