How to use generate_raw_table method in autotest

Best Python code snippet using autotest_python

regression.py

Source:regression.py Github

copy

Full Screen

...49 return default50class Sample(object):51 """ Collect test results in same environment to a sample """52 def __init__(self, type, arg):53 def generate_raw_table(test_dict):54 ret_dict = []55 tmp = []56 type = category = None57 for i in test_dict:58 line = i.split('|')[1:]59 if not type:60 type = line[0:2]61 if type != line[0:2]:62 ret_dict.append('|'.join(type + tmp))63 type = line[0:2]64 tmp = []65 if "e+" in line[-1]:66 tmp.append("%.0f" % float(line[-1]))67 elif 'e-' in line[-1]:68 tmp.append("%.2f" % float(line[-1]))69 elif not (re.findall("[a-zA-Z]", line[-1]) or is_int(line[-1])):70 tmp.append("%.2f" % float(line[-1]))71 else:72 tmp.append(line[-1])73 if category != i.split('|')[0]:74 category = i.split('|')[0]75 ret_dict.append("Category:" + category.strip())76 ret_dict.append(self.categories)77 ret_dict.append('|'.join(type + tmp))78 return ret_dict79 if type == 'file':80 files = arg.split()81 self.files_dict = []82 for i in range(len(files)):83 fd = open(files[i], "r")84 f = []85 for line in fd.readlines():86 line = line.strip()87 if re.findall("^### ", line):88 if "kvm-userspace-ver" in line:89 self.kvmver = line.split(':')[-1]90 elif "kvm_version" in line:91 self.hostkernel = line.split(':')[-1]92 elif "guest-kernel-ver" in line:93 self.guestkernel = line.split(':')[-1]94 elif "session-length" in line:95 self.len = line.split(':')[-1]96 else:97 f.append(line.strip())98 self.files_dict.append(f)99 fd.close()100 elif type == 'database':101 jobid = arg102 self.kvmver = get_test_keyval(jobid, "kvm-userspace-ver")103 self.hostkernel = get_test_keyval(jobid, "kvm_version")104 self.guestkernel = get_test_keyval(jobid, "guest-kernel-ver")105 self.len = get_test_keyval(jobid, "session-length")106 self.categories = get_test_keyval(jobid, "category")107 idx = exec_sql("select job_idx from tko_jobs where afe_job_id=%s"108 % jobid)[-1]109 data = exec_sql("select test_idx,iteration_key,iteration_value"110 " from tko_perf_view where job_idx=%s" % idx)111 testidx = None112 job_dict = []113 test_dict = []114 for line in data:115 s = line.split()116 if not testidx:117 testidx = s[0]118 if testidx != s[0]:119 job_dict.append(generate_raw_table(test_dict))120 test_dict = []121 testidx = s[0]122 test_dict.append(' | '.join(s[1].split('--')[0:] + s[-1:]))123 job_dict.append(generate_raw_table(test_dict))124 self.files_dict = job_dict125 self.version = " userspace: %s\n host kernel: %s\n guest kernel: %s" % (126 self.kvmver, self.hostkernel, self.guestkernel)127 nrepeat = len(self.files_dict)128 if nrepeat < 2:129 print "`nrepeat' should be larger than 1!"130 sys.exit(1)131 self.desc = """ - Every Avg line represents the average value based on *%d* repetitions of the same test,132 and the following SD line represents the Standard Deviation between the *%d* repetitions.133 - The Standard deviation is displayed as a percentage of the average.134 - The significance of the differences between the two averages is calculated using unpaired T-test that135 takes into account the SD of the averages.136 - The paired t-test is computed for the averages of same category.137""" % (nrepeat, nrepeat)...

Full Screen

Full Screen

plots.py

Source:plots.py Github

copy

Full Screen

...93 94 95def compute_FMR_FNMR_FDR(impostors_per_demographic_eval, genuines_per_demographic_eval, thresholds, far_thresholds,tablefmt="plain"):96 97 def generate_raw_table(performance_dict):98 """99 Generates a simple table where axis X and Y are respectivelly the values of demographics 100 and \tau respectivelly101 """102 demographics_vs_fmerit = np.array([np.round(performance_dict[d],4) for d in performance_dict]) 103 return demographics_vs_fmerit104 def generate_tabulate_table(raw_table, header, demographics):105 """106 """107 extended_table = np.concatenate((np.array([demographics]).T, raw_table), axis=1)108 return tabulate.tabulate(extended_table, headers=header, tablefmt=tablefmt)109 def generate_fdr_table(fmrs_taus, fnmrs_taus):110 fdrs = []111 for i in range(fmrs_taus.shape[1]):112 fdr_tau = fairness_metric.compute_fdr(fmrs_taus[:,i],fnmrs_taus[:,i])113 fdrs.append(fdr_tau)114 return fdrs115 def generate_fdr_table_tabulate(fdr_raw_table, header):116 return tabulate.tabulate([fdr_raw_table], headers=header, tablefmt=tablefmt)117 FMR_raw, FNMR_raw = scoring.compute_fmr_fnmr_multiple_threshold(impostors_per_demographic_eval, genuines_per_demographic_eval, thresholds)118 header = [""] + [k for k in far_thresholds]119 demographics = [k for k in FMR_raw]120 121 print("##############################################")122 print("################## FMR #######################")123 print("##############################################")124 raw_table_fmr = generate_raw_table(FMR_raw) 125 print(generate_tabulate_table(raw_table_fmr, header, demographics))126 127 print("##############################################")128 print("################## FNMR #######################")129 print("##############################################")130 raw_table_fnmr = generate_raw_table(FNMR_raw)131 print(generate_tabulate_table(raw_table_fnmr, header, demographics))132 133 134 print("##############################################")135 print("################## FDR #######################")136 print("##############################################")137 fdr_raw_table = generate_fdr_table(raw_table_fmr, raw_table_fnmr)...

Full Screen

Full Screen

main.py

Source:main.py Github

copy

Full Screen

...7from wordle_table import generate_words_table, generate_answers_table8from data_gen import build_answer_table, build_word_table,build_answer_list, build_word_list9if __name__ == '__main__':10 regenerate_data()11 generate_raw_table()12 filter_raw_table()13 build_answer_table()14 build_word_table()15 build_answer_list()...

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