How to use __convert_platform method in autotest

Best Python code snippet using autotest_python

topic_common.py

Source:topic_common.py Github

copy

Full Screen

...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,...

Full Screen

Full Screen

last_seen.py

Source:last_seen.py Github

copy

Full Screen

...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:...

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 autotest 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