How to use _log_list method in robotframework-appiumlibrary

Best Python code snippet using robotframework-appiumlibrary_python

calc_log.py

Source:calc_log.py Github

copy

Full Screen

1'''2Created on Mar 1, 20133@author: sesuskic4'''5from .decode_api import enook6from version_info import version_info7__all__ = ["CalcLog", "Pro2CalcException"]8class Pro2CalcException(Exception):9 def __init__(self, text):10 super(Pro2CalcException, self).__init__(text)11class CalcLog(object):12 def __init__(self, filename=''):13 header = '# Calculator version {:s}\n'.format(version_info.get_version_string())14 self._filename = filename15 self._log_list = []16 if self._filename != '':17 fid_log = open(self._filename, 'w') # 'w'->'a' w/ prior writes18 fid_log.write(header)19 fid_log.close()20 else:21 self._log_list.append(header)22 return23 24 def add_to_log(self, text, raiseerror=False):25 if self._filename != '':26 fid_log = open(self._filename, 'a')27 fid_log.write(text)28 fid_log.close()29 else:30 self._log_list.append(text)31 if raiseerror:32 raise Pro2CalcException(text)33 34 def write_to_calc_log(self, modem_calc):35 if (modem_calc.IQ_CAL_setting == 0):36 self._log_list.append('# Done successfully! \n')37 self._log_list.append('# ------------------------Key Chip Settings------------------------ \n')38 self._log_list.append('# RF is {:6.6f} MHz; {:3.1f} ppm {:8.0f} Hz crystal\n'.format(modem_calc.inputs.API_fc / 1e6, modem_calc.crystal_tol, modem_calc.inputs.API_freq_xo))39 if (enook(modem_calc.inputs.API_modulation_type)):40 self._log_list.append('# Symbol rate is {:6.0f} sps; OOK RX BW is {:6.0f} Hz\n'.format(modem_calc.inputs.API_Rsymb, modem_calc.inputs.API_RXBW))41 else:42 self._log_list.append('# Symbol rate is {:6.0f} sps; Fd is {:6.0f} Hz; Modulation BW is {:6.0f} Hz; modulation index is {:2.3f} \n'.format(modem_calc.inputs.API_Rsymb, modem_calc.demodulator.fields.df, modem_calc.demodulator.BW_mod, modem_calc.demodulator.fields.hModInd))43 # print('3) Modulation BW is {:6.0f} Hz; modulation index is {:2.3f} \n'.format(BW_mod,hModInd/2**9))44 pro2bar = False45 try:46 foo = modem_calc.demodulator.fields.ndec347 pro2bar = True48 except:49 self._log_list.append('# Max frequency error(single end) between TX and Rx is {:6.0f} Hz \n'.format(modem_calc.demodulator.fields.tx_rx_err))50 if pro2bar and hasattr(modem_calc.demodulator.fields, "rx_hopping_en"):51 if (modem_calc.demodulator.fields.rx_hopping_en == 1):52 self._log_list.append('# Max frequency error(single end) between TX and Rx is {:6.0f} Hz \n'.format(modem_calc.tx_rx_err))53 else:54 self._log_list.append('# Max frequency error(single end) between TX and Rx is {:6.0f} Hz \n'.format(modem_calc.demodulator.fields.tx_rx_err))55 if (not(enook(modem_calc.inputs.API_modulation_type))):56 if (modem_calc.inputs.API_BER_mode):57 self._log_list.append('# In BER testing mode, PLL AFC is disabled. \n')58 elif (modem_calc.inputs.API_afc_en == 1 or modem_calc.inputs.API_afc_en == 2):59 self._log_list.append('# AFC correction value is fedback to PLL, and AFC loop will be reset if estimated frequency error exceeds {:6.0f} Hz\n'.format(modem_calc.demodulator.fields.afclim * (float(modem_calc.demodulator.fields.afc_gain) / float(2 ** 6)) * (modem_calc.modulator.fields.dsm_ratio)))60 else:61 self._log_list.append('# AFC correction value is not fedback to PLL. Internal modem AFC is still enabled. \n')62 self._log_list.append('# RX IF frequency is {:6.0f} Hz \n'.format(modem_calc.if_freq))63 self._log_list.append('# RX OSR OF BCR is {:6.3f} \n'.format(modem_calc.demodulator.fields.OSR_rx_BCR / 2 ** 3))64 self._log_list.append('# WB filter {:d} (BW = {:6.2f} kHz); NB-filter {:d} (BW = {:4.2f} kHz) \n'.format(modem_calc.demodulator.filter_k1, modem_calc.demodulator.RX_CH_BW_k1, modem_calc.demodulator.filter_k2, modem_calc.demodulator.RX_CH_BW_k2))65 self._log_list.append('# Decby-2 bypass is set to {:d}\n'.format(modem_calc.demodulator.fields.dwn2byp))66 self._log_list.append('# Decby-3 bypass is set to {:d}\n'.format(modem_calc.demodulator.fields.dwn3byp))67 bar = False68 try:69 foo = modem_calc.demodulator.fields.ndec370 bar = True71 except:72 self._log_list.append('# nDec-0 is {:d}; nDec-1 is {:d}; nDec-2 is {:d} \n'.format(int(modem_calc.demodulator.fields.ndec0), int(modem_calc.demodulator.fields.ndec1), int(modem_calc.demodulator.fields.ndec2)))73 if bar:74 self._log_list.append('# nDec-0 is {:d}; nDec-1 is {:d}; nDec-2 is {:d}; nDec-3 is {:d} \n'.format(int(modem_calc.demodulator.fields.ndec0), int(modem_calc.demodulator.fields.ndec1), int(modem_calc.demodulator.fields.ndec2), int(modem_calc.demodulator.fields.ndec3)))75 if hasattr(modem_calc.demodulator.fields, "rx_hopping_en"):76 if (modem_calc.demodulator.fields.rx_hopping_en == 1):77 self._log_list.append('# DSA rx-hopping is used for super low data rate; Hopping Step Size is{:6.0f} Hz;Hopping CH number is {:d}.\n' .format(modem_calc.inputs.API_fhst, modem_calc.demodulator.fields.fh_ch_number))78 if(modem_calc.inputs.API_pm_len < modem_calc.demodulator.fields.fh_ch_number * 4 + 8):79 self._log_list.append('# Warning: {:d}-bit preamble is not long enough to run DSA rx-hopping for the super low data rate.\n'.format(int(modem_calc.inputs.API_pm_len)))80 self._log_list.append('# {:d}-bit preamble is required for the current application.\n'.format(modem_calc.demodulator.fields.fh_ch_number * 4 + 8))81 # print('12)AFC loop gain is {6.0f} \n'.format(afc_gain))82 # print('13)AFC loop limiter is {6.0f} \n'.format(rtl_afclim))83 if (modem_calc.demodulator.fields.nonstdpk == 1):84 self._log_list.append('# async demodulator is used.\n')85 else:86 self._log_list.append('# sync demodulator is used.\n')87 if (modem_calc.warning2log): # add warning msg to log file if any88 self._log_list.append('\n# Note: \n')89 self._log_list.append(modem_calc.warning2log)90 if self._filename == '':91 return92 # write to calc_log.txt93 fid_log = open(self._filename, 'a');94 if (modem_calc.IQ_CAL_setting == 0):95 fid_log.write("".join(self._log_list))96 fid_log.write('\n\n') # append two lines at end to seperate multiple cases97 fid_log.close()98 return99 100 def log(self):...

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 robotframework-appiumlibrary 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