How to use get_tag method in lisa

Best Python code snippet using lisa_python

import_configuration.py

Source:import_configuration.py Github

copy

Full Screen

...24 self.config = config25 def repopulate_gui(self):26 o_gui = GuiHandler(parent=self.parent)27 # step128 current_folder = self.get_tag("current_folder")29 self.parent.current_folder = current_folder30 os.chdir(current_folder)31 diamond = self.get_tag("diamond")32 self.parent.ui.diamond.setText(diamond)33 diamond_background = self.get_tag("diamond_background")34 self.parent.ui.diamond_background.setText(diamond_background)35 vanadium = self.get_tag("vanadium")36 self.parent.ui.vanadium.setText(vanadium)37 vanadium_background = self.get_tag("vanadium_background")38 self.parent.ui.vanadium_background.setText(vanadium_background)39 sample_background = self.get_tag("sample_background")40 self.parent.ui.sample_background.setText(sample_background)41 first_scan = self.get_tag("first_scan")42 self.parent.ui.first_scan.setText(first_scan)43 last_scan = self.get_tag("last_scan")44 self.parent.ui.last_scan.setText(last_scan)45 frequency_index = self.get_tag("frequency_index", data_type='int')46 o_gui.dropdown_set_index(widget_id=self.parent.ui.frequency, index=frequency_index)47 recalibration = self.get_tag("recalibration", data_type="bool")48 if recalibration:49 o_gui.radiobutton_set_state(widget_id=self.parent.ui.recalibration_yes, state=True)50 else:51 o_gui.radiobutton_set_state(widget_id=self.parent.ui.recalibration_no, state=True)52 renormalization = self.get_tag("renormalization", data_type="bool")53 if renormalization:54 o_gui.radiobutton_set_state(widget_id=self.parent.ui.renormalization_yes, state=True)55 else:56 o_gui.radiobutton_set_state(widget_id=self.parent.ui.renormalization_no, state=True)57 autotemplate = self.get_tag("autotemplate", data_type="bool")58 if autotemplate:59 o_gui.radiobutton_set_state(widget_id=self.parent.ui.autotemplate_yes, state=True)60 else:61 o_gui.radiobutton_set_state(widget_id=self.parent.ui.autotemplate_no, state=True)62 postprocessing = self.get_tag("postprocessing", data_type="bool")63 if postprocessing:64 o_gui.radiobutton_set_state(widget_id=self.parent.ui.postprocessing_yes, state=True)65 else:66 o_gui.radiobutton_set_state(widget_id=self.parent.ui.postprocessing_no, state=True)67 comments = self.get_tag("comments")68 self.parent.ui.comments.setText(comments)69 create_new_autonom_folder = self.get_tag("create_new_autonom_folder", data_type='bool')70 o_gui.radiobutton_set_state(widget_id=self.parent.ui.create_folder_button, state=create_new_autonom_folder)71 o_step1_handler = Step1GuiHandler(parent=self.parent)72 o_step1_handler.new_autonom_group_box(status=create_new_autonom_folder)73 auto_autonom_folder = self.get_tag("auto_autonom_folder", data_type="bool")74 if auto_autonom_folder:75 o_gui.radiobutton_set_state(widget_id=self.parent.ui.auto_manual_folder, state=True)76 else:77 o_gui.radiobutton_set_state(widget_id=self.parent.ui.manual_output_folder, state=True)78 o_step1_handler.manual_output_folder_button_handler()79 manual_autonom_folder_name = self.get_tag("manual_autonom_folder_name")80 self.parent.ui.manual_output_folder_field.setText(manual_autonom_folder_name)81 # step282 table = self.get_tag("table")83 o_import_table = ImportTable(parent=self.parent)84 o_import_table.table_contain = table85 o_import_table.parse_config_table()86 o_import_table.populate_gui()87 o_gui_step2 = Step2GuiHandler(parent=self.parent)88 background_flag = self.get_tag("background_flag", data_type='bool')89 if background_flag:90 o_gui.radiobutton_set_state(widget_id=self.parent.ui.background_yes, state=True)91 else:92 o_gui.radiobutton_set_state(widget_id=self.parent.ui.background_no, state=True)93 o_gui_step2.step2_background_flag()94 background_no_field = self.get_tag("background_no_field")95 self.parent.ui.background_no_field.setText(background_no_field)96 background_index = self.get_tag("background_index", data_type='int')97 self.parent.ui.background_comboBox.setCurrentIndex(background_index)98 # PDF99 fourier_filter_min = self.get_tag("ndabs_fourier_filter_min")100 self.parent.ui.fourier_filter_from.setText(fourier_filter_min)101 fourier_filter_max = self.get_tag("ndabs_fourier_filter_max")102 self.parent.ui.fourier_filter_to.setText(fourier_filter_max)103 q_min = self.get_tag("q_min")104 self.parent.ui.q_range_min.setText(q_min)105 q_max = self.get_tag("q_max")106 self.parent.ui.q_range_max.setText(q_max)107 plazcek_fit_range_min = self.get_tag("plazcek_fit_range_min")108 self.parent.ui.plazcek_fit_range_min.setText(plazcek_fit_range_min)109 plazcek_fit_range_max = self.get_tag("plazcek_fit_range_max")110 self.parent.ui.plazcek_fit_range_max.setText(plazcek_fit_range_max)111 hydrogen_flag = self.get_tag("hydrogen_flag", data_type="bool")112 if hydrogen_flag:113 o_gui.radiobutton_set_state(widget_id=self.parent.ui.hydrogen_yes, state=True)114 else:115 o_gui.radiobutton_set_state(widget_id=self.parent.ui.hydrogen_no, state=True)116 muscat_flag = self.get_tag("muscat_flag", data_type="bool")117 if muscat_flag:118 o_gui.radiobutton_set_state(widget_id=self.parent.ui.muscat_yes, state=True)119 else:120 o_gui.radiobutton_set_state(widget_id=self.parent.ui.muscat_no, state=True)121 scale_data_flag = self.get_tag("scale_data_flag", data_type="bool")122 if scale_data_flag:123 o_gui.radiobutton_set_state(widget_id=self.parent.ui.scale_data_yes, state=True)124 else:125 o_gui.radiobutton_set_state(widget_id=self.parent.ui.scale_data_no, state=True)126 #run_rmc_flag = self.get_tag("run_rmc_flag", data_type = "bool")127 #o_gui.radiobutton_set_state(widget_id = self.parent.ui.run_rmc_yes, state = run_rmc_flag)128 output_file_name = self.get_tag("ndabs_output_file_name")129 self.parent.ui.run_ndabs_output_file_name.setText(output_file_name)130 pdf_qmax_line_edit = self.get_tag("pdf_qmax_line_edit")131 self.parent.ui.pdf_qmax_line_edit.setText(pdf_qmax_line_edit)132 try:133 pdf_sum_scans_output_file_name = self.get_tag("pdf_sum_scans_output_file_name")134 self.parent.ui.sum_scans_output_file_name.setText(pdf_sum_scans_output_file_name)135 except ValueError:136 pass137 try:138 pdf_sum_scans_rmax = self.get_tag("psd_sum_scans_rmax")139 self.parent.ui.sum_scans_rmax.setText(pdf_sum_scans_rmax)140 except ValueError:141 pass142 interactive_mode_flag = self.get_tag("interactive_mode_flag", data_type="bool")143 o_gui.radiobutton_set_state(widget_id=self.parent.ui.interactive_mode_checkbox, state=interactive_mode_flag)144 mantid_calibration_value = self.get_tag("mantid_calibration_value")145 self.parent.ui.mantid_calibration_value.setText(mantid_calibration_value)146 mantid_characterization = self.get_tag("mantid_characterization_value")147 self.parent.ui.mantid_characterization_value.setText(mantid_characterization)148 number_of_bins = self.get_tag("mantid_number_of_bins")149 self.parent.ui.mantid_number_of_bins.setText(number_of_bins)150 min_crop = self.get_tag("mantid_min_crop_wavelength")151 self.parent.ui.mantid_min_crop_wavelength.setText(min_crop)152 max_crop = self.get_tag("mantid_max_crop_wavelength")153 self.parent.ui.mantid_max_crop_wavelength.setText(max_crop)154 vanadium_radius = self.get_tag("mantid_vanadium_radius")155 self.parent.ui.mantid_vanadium_radius.setText(vanadium_radius)156 output_directory = self.get_tag("mantid_output_directory_value")157 self.parent.ui.mantid_output_directory_value.setText(output_directory)158 o_gui_step2.check_gui()159 def get_tag(self, tag_name, data_type='string'):160 config = self.config161 _section_name = self.section_name162 try:163 value = config.get(_section_name, tag_name)164 except:165 raise ValueError("Tag missing !")166 if data_type == 'string':167 return value168 if data_type == 'bool':169 return str2bool(value)170 if data_type == 'int':171 return int(value)172 if data_type == 'float':173 return float(value)...

Full Screen

Full Screen

test-ipp.py

Source:test-ipp.py Github

copy

Full Screen

...3from plt_testing import *4import binascii5bs = b'\x01\x02\x03\x04\x05\x06\x07\x08,0x09\x00\x81\x82'6ipp3 = ipp.IPprefix(6, bytearray(bs), 48)7test_println('3: version={0}, addr={1}, length={2}'.format(ipp3.version, binascii.hexlify(ipp3.addr), ipp3.length), get_tag())8ipp2 = ipp.IPprefix(4, bytearray([192, 168]))9test_println('2: version={0}, addr={1}'.format(ipp2.version, binascii.hexlify(ipp2.addr)), get_tag())10ipp1 = ipp.IPprefix(4, bytearray())11test_println(str('1: version={0}\n'.format(ipp1.version)), get_tag())12test_println(str("ipp3 = %s" % ipp3), get_tag())13test_println(str("ipp2 = %s" % ipp2), get_tag())14test_println(str("ipp1 = %s" % str(ipp1)), get_tag())15test_println(str("addrs: ipp3 = %s ipp2 = %s" % (binascii.hexlify(ipp3.addr), binascii.hexlify(ipp2.addr))), get_tag())16ipp3.length = 717test_println(str('len=7: version={0}, addr={1}, length={2}\n'.format(ipp3.version, binascii.hexlify(ipp3.addr), ipp3.length)), get_tag())18test_println("try to set length = 0", get_tag())19try:20 ipp3.length = 021except:22 test_println(" {0} raised: {1}\n".format(sys.exc_info()[0], sys.exc_info()[1]), get_tag())23test_println("try to set IPv6 length = 129", get_tag())24try:25 ipp3.length = 12926except:27 test_println( " {0} raised: {1}\n".format(sys.exc_info()[0], sys.exc_info()[1]), get_tag())28test_println("try to set IPv6 length = '4'", get_tag())29try:30 ipp3.length = '4'31except:32 test_println(" {0} raised: {1}\n".format(sys.exc_info()[0], sys.exc_info()[1]), get_tag())33test_println("try to set version = 5", get_tag())34try:35 ipp3.version = 536except:37 test_println( " {0} raised: {1}\n".format(sys.exc_info()[0], sys.exc_info()[1]), get_tag())38ippv4 = ipp.IPprefix(4, bytearray("5678", encoding='utf-8'), 32)39ippv4g = ipp.IPprefix(4, bytearray("90AB", encoding='utf-8'), 32)40ippv4l = ipp.IPprefix(4, bytearray("1234", encoding='utf-8'), 32)41ippv4p = ipp.IPprefix(4, bytearray("5678", encoding='utf-8'), 16)42test_println( "test compare", get_tag())43test_println( "4 lt 4l = {0}, {1} (T,F)".format(ippv4l < ippv4, ippv4 < ippv4l), get_tag())44test_println( "4 le:4l = {0}, {1} (T,F)".format(ippv4l <= ippv4, ippv4 <= ippv4l), get_tag())45test_println( "4 eq 4 = {0}, {1} (T,T)".format(ippv4 == ippv4, ippv4 == ippv4), get_tag())46test_println( "4 ne 4 = {0}, {1} (F,F)".format(ippv4 != ippv4, ippv4 != ippv4), get_tag())47test_println( "4g gt 4 = {0}, {1} (T,F)".format(ippv4g > ippv4, ippv4 > ippv4g), get_tag())48test_println( "4g ge 4 = {0}, {1} (T,F)\n".format(ippv4g >= ippv4, ippv4 >= ippv4g), get_tag())49test_println( "4p lt 4, 4p with longer prefix = {0}, {1} (T,F)".format(ippv4 < ippv4p, ippv4p < ippv4), get_tag())50test_println( "4p eq 4, 4p with longer prefix = {0}, {1} (F,F)\n".format(ippv4 == ippv4p, ippv4p == ippv4), get_tag())51test_println( "Test print v4 IPprefix objects", get_tag())52v4a = ipp.IPprefix(4, bytearray(b"\x82\xd8\x00\x01"))53v4b = ipp.IPprefix(4, bytearray(b"\x82\xd8\x01\x02"))54v4c = ipp.IPprefix(4, bytearray(b"\x02\xd8\x03\x02"))55v4d = ipp.IPprefix(4, bytearray(b"\x82\xd8\x04\x03"), 16)56test_println( "v4a = {0}".format(v4a), get_tag())57test_println( "v4b = {0}".format(v4b), get_tag())58test_println( "v4c = {0}".format(v4c), get_tag())59test_println( "v4d = {0}".format(v4d), get_tag())60test_println( "Test print v6 IPprefix objects", get_tag()) # 2001:0df0::/4761v6a = ipp.IPprefix(6, bytearray(b"\x20\x01\x0d\xf0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xab\xcd"))62v6b = ipp.IPprefix(6, bytearray(b"\x02\x00\x00\x01\x0d\x0d\x01\x02\x00\x00\x00\x00\x00\x00\xab\xcd"))63v6c = ipp.IPprefix(6, bytearray(b"\x02\x00\x00\x01\x0d\x0d\x07\x00\x00\x12\x00\x00\x00\x00\xab\xcd"), 120)64v6d = ipp.IPprefix(6, bytearray(b"\x20\x01\x0d\xf0\x0d\x0d\x00\x00\xde\xad\x00\x00\x00\x00\xab\xcd"), 47)65test_println( "v6a = {0}".format(v6a), get_tag())66test_println( "v6b = {0}".format(v6b), get_tag())67test_println( "v6c = {0}".format(v6c), get_tag())68test_println( "v6d = {0}\n".format(v6d), get_tag())69fs4 = ipp.from_s("130.216.1.1")70test_println( "fs4 = {0}".format(fs4), get_tag())71fs4s = ipp.from_s("130.216.1.1/16")72test_println( "fs4s = {0}".format(fs4s), get_tag())73fs6 = ipp.from_s("2001:0df0::00ef:0000:0000:0001")74test_println( "fs4 = {0}".format(fs6), get_tag())75fs6s = ipp.from_s("2001:0df0::/47")76test_println( "fs4s = {0}\n".format(fs6s), get_tag())77test_println( str(ipp.rfc1918s16), get_tag())78test_println( str(ipp.rfc1918s12), get_tag())79test_println( str(ipp.rfc1918s8), get_tag())80r1918_16 = ipp.from_s("192.168.1.1/24")81n1918_16 = ipp.from_s("192.169.1.1/24")82test_println( "{0} is_prefix {1}, {2} isp_refix {3} (T,F)\n".format(83 ipp.rfc1918s16, ipp.rfc1918s16.is_prefix(r1918_16),84 ipp.rfc1918s16, ipp.rfc1918s16.is_prefix(n1918_16)), get_tag())85test_println("r1918_16.isrfc1918 = {0} (T)".format(r1918_16.is_rfc1918()), get_tag())86test_println("n1918_16.isrfc1918 = {0} (F)".format(n1918_16.is_rfc1918()), get_tag())87r1918_12 = ipp.from_s("172.16.1.1/16")88r1918_8 = ipp.from_s("10.1.1.1/16")89r1918_8a = ipp.from_s("10.1.1.1/12")90r1918_12a = ipp.from_s("172.16.1.2/16")91test_println("r1918_12.isrfc1918 = {0} (T)".format(r1918_12.is_rfc1918()), get_tag())92test_println("r1918_8.isrfc1918 = {0} (T)\n".format(r1918_8.is_rfc1918()), get_tag())93test_println( "ipp.version = {0}\n".format(ipp.version()), get_tag())94zs = ipp.IPprefix(4, bytearray(b"12\x00\x51"))95test_println( "zs = {0} (49.50.0.81)\n".format(zs), get_tag())96test_println( "width(r1918_8) = %d (15)" % r1918_8.width(), get_tag())97test_println( "r1918_8.equal(r1918_8) = %s (T)" % r1918_8.equal(r1918_8), get_tag())98test_println( "r1918_8.equal(r1918_8a) = %s (T)" % r1918_8.equal(r1918_8a), get_tag())99test_println( "r1918_8.has_bit_set(4) = %s (T)" % r1918_8.has_bit_set(4), get_tag())100test_println( "r1918_8.has_bit_set(5) = %s (F)" % r1918_8.has_bit_set(5), get_tag())101test_println( "r1918_8.complement() = %s (245.254.254.254/16)" % r1918_8.complement(), get_tag())102a1 = ipp.from_s("172.16.1.1/32")103a2 = ipp.from_s("172.16.1.2/32")104test_println( "r1918_12.first_bit_different(r1918_12a) = %d (16)" % r1918_12.first_bit_different(r1918_12a), get_tag())...

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