How to use get_property method in Playwright Python

Best Python code snippet using playwright-python

test_references.py

Source:test_references.py Github

copy

Full Screen

...48 top_reg21_x = root.find_by_path("top.reg2[1].x")49 top_reg21_y = root.find_by_path("top.reg2[1].y")50 with self.subTest("bad lookup"):51 with self.assertRaises(LookupError):52 top.get_property('thisisnotaprop')53 with self.assertRaises(LookupError):54 top.get_property('sw')55 with self.assertRaises(TypeError):56 top.get_property('sw', bad_kwarg=1234)57 self.assertEqual(top.get_property('name'), "top")58 self.assertEqual(top.get_property('name', default="NA"), "NA")59 with self.subTest("glbl_sig"):60 self.assertIs(glbl_sig.get_property('ref_prop'), None)61 with self.subTest("top"):62 self.assertEqual(top.get_property('ref_prop'), top_reg21_x)63 self.assertIs(top.get_property('ref_prop').inst, top_reg21_x.inst)64 with self.subTest("top.reg1"):65 self.assertEqual(top_reg1.get_property('ref_prop'), top_reg1_x)66 self.assertIs(top_reg1.get_property('ref_prop').inst, top_reg1_x.inst)67 with self.subTest("top.reg1.sig"):68 self.assertIs(top_reg1_sig.get_property('ref_prop'), None)69 with self.subTest("top.reg1.x"):70 self.assertEqual(top_reg1_x.get_property('resetsignal'), glbl_sig)71 self.assertIs(top_reg1_x.get_property('resetsignal').inst, glbl_sig.inst)72 with self.subTest("top.reg1.y"):73 self.assertEqual(top_reg1_y.get_property('resetsignal'), top_reg1_sig)74 self.assertIs(top_reg1_y.get_property('resetsignal').inst, top_reg1_sig.inst)75 with self.subTest("top.reg2[0]"):76 self.assertEqual(top_reg20.get_property('ref_prop'), top_reg20_x)77 self.assertIs(top_reg20.get_property('ref_prop').inst, top_reg20_x.inst)78 with self.subTest("top.reg2[0].sig"):79 self.assertIs(top_reg20_sig.get_property('ref_prop'), None)80 with self.subTest("top.reg2[0].x"):81 self.assertEqual(top_reg20_x.get_property('resetsignal'), glbl_sig)82 self.assertIs(top_reg20_x.get_property('resetsignal').inst, glbl_sig.inst)83 with self.subTest("top.reg2[0].y"):84 self.assertEqual(top_reg20_y.get_property('resetsignal'), top_reg20_sig)85 self.assertIs(top_reg20_y.get_property('resetsignal').inst, top_reg20_sig.inst)86 with self.subTest("top.reg2[1]"):87 self.assertEqual(top_reg21.get_property('ref_prop'), top_reg21_x)88 self.assertIs(top_reg21.get_property('ref_prop').inst, top_reg21_x.inst)89 with self.subTest("top.reg2[1].sig"):90 self.assertIs(top_reg21_sig.get_property('ref_prop'), None)91 with self.subTest("top.reg2[1].x"):92 self.assertEqual(top_reg21_x.get_property('resetsignal'), glbl_sig)93 self.assertIs(top_reg21_x.get_property('resetsignal').inst, glbl_sig.inst)94 with self.subTest("top.reg2[1].y"):95 self.assertEqual(top_reg21_y.get_property('resetsignal'), top_reg21_sig)96 self.assertIs(top_reg21_y.get_property('resetsignal').inst, top_reg21_sig.inst)97 def test_dynamic_lhs_refs(self):98 root = self.compile(99 ["rdl_src/references_dynamic_lhs.rdl"],100 "top"101 )102 glbl_sig = root.find_by_path("glbl_sig")103 top = root.find_by_path("top")104 top_reg1 = root.find_by_path("top.reg1")105 top_reg1_sig = root.find_by_path("top.reg1.sig")106 top_reg1_x = root.find_by_path("top.reg1.x")107 top_reg1_y = root.find_by_path("top.reg1.y")108 top_reg20 = root.find_by_path("top.reg2[0]")109 top_reg20_sig = root.find_by_path("top.reg2[0].sig")110 top_reg20_x = root.find_by_path("top.reg2[0].x")111 top_reg20_y = root.find_by_path("top.reg2[0].y")112 top_reg21 = root.find_by_path("top.reg2[1]")113 top_reg21_sig = root.find_by_path("top.reg2[1].sig")114 top_reg21_x = root.find_by_path("top.reg2[1].x")115 top_reg21_y = root.find_by_path("top.reg2[1].y")116 with self.subTest("glbl_sig"):117 self.assertIs(glbl_sig.get_property('ref_prop'), None)118 with self.subTest("top"):119 self.assertIs(top.get_property('ref_prop'), None)120 with self.subTest("top.reg1"):121 self.assertEqual(top_reg1.get_property('ref_prop'), top_reg20)122 self.assertIs(top_reg1.get_property('ref_prop').inst, top_reg20.inst)123 with self.subTest("top.reg1.sig"):124 self.assertIs(top_reg1_sig.get_property('ref_prop'), None)125 with self.subTest("top.reg1.x"):126 self.assertEqual(top_reg1_x.get_property('ref_prop'), top_reg1_y)127 self.assertIs(top_reg1_x.get_property('ref_prop').inst, top_reg1_y.inst)128 self.assertEqual(top_reg1_x.get_property('resetsignal'), glbl_sig)129 self.assertIs(top_reg1_x.get_property('resetsignal').inst, glbl_sig.inst)130 self.assertEqual(top_reg1_x.get_property('next').name, "ored")131 self.assertEqual(top_reg1_x.get_property('next').node, top_reg20_y)132 with self.subTest("top.reg1.y"):133 self.assertEqual(top_reg1_y.get_property('ref_prop'), top_reg1_x)134 self.assertIs(top_reg1_y.get_property('ref_prop').inst, top_reg1_x.inst)135 self.assertEqual(top_reg1_y.get_property('resetsignal'), glbl_sig)136 self.assertIs(top_reg1_y.get_property('resetsignal').inst, glbl_sig.inst)137 self.assertEqual(top_reg1_y.get_property('next').name, "anded")138 self.assertEqual(top_reg1_y.get_property('next').node, top_reg1_x)139 with self.subTest("top.reg2[0]"):140 self.assertEqual(top_reg20.get_property('ref_prop'), top_reg21_x)141 self.assertIs(top_reg20.get_property('ref_prop').inst, top_reg21_x.inst)142 with self.subTest("top.reg2[0].sig"):143 self.assertIs(top_reg20_sig.get_property('ref_prop'), None)144 with self.subTest("top.reg2[0].x"):145 self.assertEqual(top_reg20_x.get_property('ref_prop'), top_reg1)146 self.assertIs(top_reg20_x.get_property('ref_prop').inst, top_reg1.inst)147 self.assertEqual(top_reg20_x.get_property('resetsignal'), top_reg20_sig)148 self.assertIs(top_reg20_x.get_property('resetsignal').inst, top_reg20_sig.inst)149 with self.subTest("top.reg2[0].y"):150 self.assertEqual(top_reg20_y.get_property('ref_prop'), top_reg1_x)151 self.assertIs(top_reg20_y.get_property('ref_prop').inst, top_reg1_x.inst)152 self.assertEqual(top_reg20_y.get_property('resetsignal'), glbl_sig)153 self.assertIs(top_reg20_y.get_property('resetsignal').inst, glbl_sig.inst)154 self.assertEqual(top_reg20_y.get_property('next').name, "anded")155 self.assertEqual(top_reg20_y.get_property('next').node, top_reg20_x)156 with self.subTest("top.reg2[1]"):157 self.assertEqual(top_reg21.get_property('ref_prop'), top_reg21_x)158 self.assertIs(top_reg21.get_property('ref_prop').inst, top_reg21_x.inst)159 with self.subTest("top.reg2[1].sig"):160 self.assertIs(top_reg21_sig.get_property('ref_prop'), None)161 with self.subTest("top.reg2[1].x"):162 self.assertEqual(top_reg21_x.get_property('ref_prop'), top_reg1)163 self.assertIs(top_reg21_x.get_property('ref_prop').inst, top_reg1.inst)164 self.assertEqual(top_reg21_x.get_property('resetsignal'), top_reg21_sig)165 self.assertIs(top_reg21_x.get_property('resetsignal').inst, top_reg21_sig.inst)166 with self.subTest("top.reg2[1].y"):167 self.assertEqual(top_reg21_y.get_property('ref_prop'), top_reg1_x)168 self.assertIs(top_reg21_y.get_property('ref_prop').inst, top_reg1_x.inst)169 self.assertEqual(top_reg21_y.get_property('resetsignal'), glbl_sig)170 self.assertIs(top_reg21_y.get_property('resetsignal').inst, glbl_sig.inst)171 self.assertEqual(top_reg21_y.get_property('next').name, "anded")172 self.assertEqual(top_reg21_y.get_property('next').node, top_reg21_x)173 def test_default_lhs_refs(self):174 root = self.compile(175 ["rdl_src/references_default_lhs.rdl"],176 "top"177 )178 glbl_sig = root.find_by_path("glbl_sig")179 top = root.find_by_path("top")180 top_reg1 = root.find_by_path("top.reg1")181 top_reg1_sig = root.find_by_path("top.reg1.sig")182 top_reg1_x = root.find_by_path("top.reg1.x")183 top_reg1_y = root.find_by_path("top.reg1.y")184 top_reg20 = root.find_by_path("top.reg2[0]")185 top_reg20_sig = root.find_by_path("top.reg2[0].sig")186 top_reg20_x = root.find_by_path("top.reg2[0].x")187 top_reg20_y = root.find_by_path("top.reg2[0].y")188 top_reg21 = root.find_by_path("top.reg2[1]")189 top_reg21_sig = root.find_by_path("top.reg2[1].sig")190 top_reg21_x = root.find_by_path("top.reg2[1].x")191 top_reg21_y = root.find_by_path("top.reg2[1].y")192 top_reg3 = root.find_by_path("top.reg3")193 top_reg3_z = root.find_by_path("top.reg3.z")194 with self.subTest("glbl_sig"):195 self.assertIs(glbl_sig.get_property('ref_prop'), None)196 with self.subTest("top"):197 self.assertIs(top.get_property('ref_prop'), None)198 with self.subTest("top.reg1"):199 self.assertIs(top_reg1.get_property('ref_prop'), None)200 with self.subTest("top.reg1.sig"):201 self.assertIs(top_reg1_sig.get_property('ref_prop'), None)202 with self.subTest("top.reg1.x"):203 self.assertIs(top_reg1_x.get_property('ref_prop'), None)204 self.assertEqual(top_reg1_x.get_property('resetsignal'), glbl_sig)205 self.assertIs(top_reg1_x.get_property('resetsignal').inst, glbl_sig.inst)206 with self.subTest("top.reg1.y"):207 self.assertEqual(top_reg1_y.get_property('ref_prop'), top_reg1_x)208 self.assertIs(top_reg1_y.get_property('ref_prop').inst, top_reg1_x.inst)209 self.assertEqual(top_reg1_y.get_property('resetsignal'), top_reg1_sig)210 self.assertIs(top_reg1_y.get_property('resetsignal').inst, top_reg1_sig.inst)211 self.assertEqual(top_reg1_y.get_property('next').name, "anded")212 self.assertEqual(top_reg1_y.get_property('next').node, top_reg1_x)213 with self.subTest("top.reg2[0]"):214 self.assertIs(top_reg20.get_property('ref_prop'), None)215 with self.subTest("top.reg2[0].sig"):216 self.assertIs(top_reg20_sig.get_property('ref_prop'), None)217 with self.subTest("top.reg2[0].x"):218 self.assertIs(top_reg20_x.get_property('ref_prop'), None)219 self.assertEqual(top_reg20_x.get_property('resetsignal'), glbl_sig)220 self.assertIs(top_reg20_x.get_property('resetsignal').inst, glbl_sig.inst)221 with self.subTest("top.reg2[0].y"):222 self.assertEqual(top_reg20_y.get_property('ref_prop'), top_reg20_x)223 self.assertIs(top_reg20_y.get_property('ref_prop').inst, top_reg20_x.inst)224 self.assertEqual(top_reg20_y.get_property('resetsignal'), top_reg20_sig)225 self.assertIs(top_reg20_y.get_property('resetsignal').inst, top_reg20_sig.inst)226 self.assertEqual(top_reg20_y.get_property('next').name, "anded")227 self.assertEqual(top_reg20_y.get_property('next').node, top_reg20_x)228 with self.subTest("top.reg2[1]"):229 self.assertIs(top_reg21.get_property('ref_prop'), None)230 with self.subTest("top.reg2[1].sig"):231 self.assertIs(top_reg21_sig.get_property('ref_prop'), None)232 with self.subTest("top.reg2[1].x"):233 self.assertIs(top_reg21_x.get_property('ref_prop'), None)234 self.assertEqual(top_reg21_x.get_property('resetsignal'), glbl_sig)235 self.assertIs(top_reg21_x.get_property('resetsignal').inst, glbl_sig.inst)236 with self.subTest("top.reg2[1].y"):237 self.assertEqual(top_reg21_y.get_property('ref_prop'), top_reg21_x)238 self.assertIs(top_reg21_y.get_property('ref_prop').inst, top_reg21_x.inst)239 self.assertEqual(top_reg21_y.get_property('resetsignal'), top_reg21_sig)240 self.assertIs(top_reg21_y.get_property('resetsignal').inst, top_reg21_sig.inst)241 self.assertEqual(top_reg21_y.get_property('next').name, "anded")242 self.assertEqual(top_reg21_y.get_property('next').node, top_reg21_x)243 with self.subTest("top.reg3"):244 self.assertEqual(top_reg3.get_property('ref_prop'), top_reg1)245 self.assertIs(top_reg3.get_property('ref_prop').inst, top_reg1.inst)246 with self.subTest("top.reg3.z"):247 self.assertEqual(top_reg3_z.get_property('ref_prop'), top_reg1)248 self.assertIs(top_reg3_z.get_property('ref_prop').inst, top_reg1.inst)249 self.assertEqual(top_reg3_z.get_property('resetsignal'), top_reg21_sig)250 self.assertIs(top_reg3_z.get_property('resetsignal').inst, top_reg21_sig.inst)251 self.assertEqual(top_reg3_z.get_property('next').name, "ored")252 self.assertEqual(top_reg3_z.get_property('next').node, top_reg20_y)253 def test_signal_dpa(self):254 root = self.compile(255 ["rdl_src/signal_scope.rdl"],256 "top"257 )258 my_signal = root.find_by_path("top.my_signal")259 b = root.find_by_path("top.a.b")260 my_signal_via_prop = b.get_property('resetsignal')261 self.assertEqual(my_signal, my_signal_via_prop)262 self.assertEqual(263 my_signal.get_property('name'),264 my_signal_via_prop.get_property('name')265 )...

Full Screen

Full Screen

pyccarui.py

Source:pyccarui.py Github

copy

Full Screen

...33def get_font(size):34 if size not in deffont:35 deffont[size] = pygame.font.Font(None, size)36 return deffont[size]37def get_property(win_id, property):38 value = None39 if win_id in windows:40 W = windows[win_id]41 if property in W:42 value = W[property]43 elif property in defprop:44 value = defprop[property]45 return value46def ui_set_property(win_id, property, value):47 if win_id not in windows:48 windows[win_id] = {}49 W = windows[win_id]50 W[property] = value51def draw_border(win_id, bbox, flags):52 BG = get_property(win_id, 'BG')53 if flags & 0x04: # enabled54 FG = get_property(win_id, 'FG')55 if flags & 0x08: # active56 thickness = get_property(win_id, 'a-thick')57 else: # inactive58 thickness = get_property(win_id, 'n-thin')59 else: # disabled60 FG = get_property(win_id, 'dis_FG')61 thickness = get_property(win_id, 'n-thin')62 d = get_property(win_id, 'inset')63 if thickness > d:64 thickness = d65 (x, y, w, h) = bbox66 pygame.draw.rect(screen, FG, (x+d-thickness, y+d-thickness, w-2*d+2*thickness, h-2*d+2*thickness), 0)67 pygame.draw.rect(screen, BG, (x+d, y+d, w-2*d, h-2*d), 0)68def draw_back(win_id, bbox, flags):69 BG = get_property(win_id, 'BG')70 if flags & 0x04: # enabled71 FG = get_property(win_id, 'FG')72 else: # disabled73 FG = get_property(win_id, 'dis_FG')74 thickness = get_property(win_id, 'line')75 d = get_property(win_id, 'inset')76 (x, y, w, h) = bbox77 x = x + 3 * d78 y = y + 3 * d79 w = w - 6 * d80 h = h - 6 * d81 hw = int(round(w/2))82 hh = int(round(h/2))83 ht = int(round(thickness/2))84 centre = (x+hw, y+hh)85 radius = hw86 pygame.draw.circle(screen, FG, centre, radius, 0)87 pygame.draw.circle(screen, BG, centre, radius-thickness, 0)88 bboxi = (x, y+hh, hw, hh)89 pygame.draw.rect(screen, BG, bboxi, 0)90 xarr = x + ht91 yarr = y + hh92 pygame.draw.polygon(screen, FG, [(xarr-d,yarr), (xarr+d,yarr), (xarr,yarr+d)], 0)93def draw_main(win_id, bbox, flags):94 BG = get_property(win_id, 'BG')95 if flags & 0x04: # enabled96 FG = get_property(win_id, 'FG')97 else: # disabled98 FG = get_property(win_id, 'dis_FG')99 thickness = get_property(win_id, 'line')100 d = get_property(win_id, 'inset')101 (x, y, w, h) = bbox102 x = x + 3 * d103 y = y + 3 * d104 w = w - 6 * d105 h = h - 6 * d106 t = int(round(h/7))107 for i in range(0, 4):108 bboxi = (x, y+2*i*t, w, t)109 pygame.draw.rect(screen, FG, bboxi, 0)110def draw_exit(win_id, bbox, flags):111 BG = get_property(win_id, 'BG')112 if flags & 0x04: # enabled113 FG = get_property(win_id, 'FG')114 else: # disabled115 FG = get_property(win_id, 'dis_FG')116 thickness = get_property(win_id, 'line')117 d = get_property(win_id, 'inset')118 (x, y, w, h) = bbox119 x = x + 3 * d120 y = y + 3 * d121 w = w - 6 * d122 h = h - 6 * d123 hw = int(round(w/2))124 hh = int(round(h/2))125 ht = int(round(thickness/2))126 centre = (x+hw, y+hh)127 radius = hw128 pygame.draw.circle(screen, FG, centre, radius, 0)129 pygame.draw.circle(screen, BG, centre, radius-thickness, 0)130 bboxi = (x+hw-thickness-ht, y, 3*thickness, hh)131 pygame.draw.rect(screen, BG, bboxi, 0)132 bboxi = (x+hw-ht, y-thickness, thickness, hh+thickness)133 pygame.draw.rect(screen, FG, bboxi, 0)134def draw_up(win_id, bbox, flags):135 if flags & 0x04: # enabled136 FG = get_property(win_id, 'FG')137 else: # disabled138 FG = get_property(win_id, 'dis_FG')139 thickness = get_property(win_id, 'line')140 d = get_property(win_id, 'inset')141 (x, y, w, h) = bbox142 hw = int(round(w/2))143 xl = x + 3*d144 yt = y + 3*d145 x0 = x + hw146 xr = x + w - 3*d147 yb = y + h - 3*d148 pygame.draw.polygon(screen, FG, [(xl,yb), (x0,yt), (xr,yb)], 0)149def draw_down(win_id, bbox, flags):150 if flags & 0x04: # enabled151 FG = get_property(win_id, 'FG')152 else: # disabled153 FG = get_property(win_id, 'dis_FG')154 thickness = get_property(win_id, 'line')155 d = get_property(win_id, 'inset')156 (x, y, w, h) = bbox157 hw = int(round(w/2))158 xl = x + 3*d159 yt = y + 3*d160 x0 = x + hw161 xr = x + w - 3*d162 yb = y + h - 3*d163 pygame.draw.polygon(screen, FG, [(xl,yt), (x0,yb), (xr,yt)], 0)164def draw_scroll(win_id, bbox, flags):165 d = get_property(win_id, 'inset')166 scroll = get_property(win_id, 'Scroll')167 (x, y, w, h) = bbox168 pygame.draw.rect(screen, grey, (x+d, y, w-2*d, h), 0)169 if scroll:170 (s_min, s_max) = scroll171 bboxi = (x+2*d, int(round(y+(h*s_min)/100)), w-4*d, int(round((h*(s_max-s_min))/100)))172 pygame.draw.rect(screen, blue, bboxi, 0)173def draw_menu_item(win_id, bbox, flags):174 d = get_property(win_id, 'inset')175 FG = get_property(win_id, 'FG')176 text = get_property(win_id, 'Label')177 size = get_property(win_id, 'size')178 font = get_font(size)179 label = font.render(str(text), 1, (FG))180 (x, y, w, h) = bbox181 screen.blit(label, (x+2*d,y+2*d))182 if flags & 0x10: # we have a submenu183 thickness = get_property(win_id, 'line')184 xl = x + w - 6*d185 yt = y + 2*d186 y0 = y + h/2187 xr = x + w - 2*d188 yb = y + h - 2*d189 pygame.draw.polygon(screen, FG, [(xl,yt), (xl,yb), (xr,y0)], 0)190def draw_canvas_tracker_point(bbox, location, BG, FG):191 (x, y, w, h) = bbox192 half_size = int(round(min(w,h)/12)) # half-size of square to draw around touch point193 thickness = 2194 (tx, ty) = location195 if x + half_size > tx:196 sx = x197 sw = half_size + tx - x198 elif tx + half_size > x + w:199 sx = tx - half_size200 sw = x + w - sx201 else:202 sx = tx - half_size203 sw = 2 * half_size204 if y + half_size > ty:205 sy = y206 sh = half_size + ty - y207 elif ty + half_size > y + h:208 sy = ty - half_size209 sh = y + h - sy210 else:211 sy = ty - half_size212 sh = 2 * half_size213 pygame.draw.rect(screen, FG, (sx, sy, sw, sh), 0)214 pygame.draw.rect(screen, BG, (sx+thickness, sy+thickness, sw-2*thickness, sh-2*thickness), 0)215def draw_canvas_tracker(win_id, bbox, flags):216 count = get_property(win_id, 'CT#')217 loc_1 = None218 loc_2 = None219 if count is not None:220 if count > 0:221 loc_1 = get_property(win_id, 'CT1')222 if count > 1:223 loc_2 = get_property(win_id, 'CT2')224 if loc_1 is not None:225 FG = get_property(win_id, 'FG')226 BG = get_property(win_id, 'BG')227 draw_canvas_tracker_point(bbox, loc_1, BG, FG)228 if loc_2 is not None:229 draw_canvas_tracker_point(bbox, loc_2, BG, FG)230def ui_draw(win_id):231 flags = get_property(win_id, 'flags')232 if flags & 0x01: # visible233 bbox = get_property(win_id, 'bbox')234 BG = get_property(win_id, 'BG')235 pygame.draw.rect(screen, BG, bbox, 0) # 0-thickness = fill236 if (flags & 0x21) == 0x01: # visible, but not blank237 if flags & 0x02: # there's a border238 draw_border(win_id, bbox, flags)239 type = get_property(win_id, 'type')240 if type == 'Back':241 draw_back(win_id, bbox, flags)242 elif type == 'Main':243 draw_main(win_id, bbox, flags)244 elif type == 'Exit':245 draw_exit(win_id, bbox, flags)246 elif type == 'Up':247 draw_up(win_id, bbox, flags)248 elif type == 'Down':249 draw_down(win_id, bbox, flags)250 elif type == 'Scroll':251 draw_scroll(win_id, bbox, flags)252 elif type == 'Menu Item':253 draw_menu_item(win_id, bbox, flags)...

Full Screen

Full Screen

test_prop_side_effects.py

Source:test_prop_side_effects.py Github

copy

Full Screen

...7 "top"8 )9 #-----------------------------------------------------------------------10 with self.subTest("bool pair"):11 self.assertFalse(root.find_by_path("top.my_signal").get_property('async'))12 self.assertTrue(root.find_by_path("top.my_signal").get_property('sync'))13 #-----------------------------------------------------------------------14 with self.subTest("rclr"):15 self.assertFalse(root.find_by_path("top.r1.f0").get_property('rclr'))16 self.assertTrue(root.find_by_path("top.r1.f1").get_property('rclr'))17 self.assertFalse(root.find_by_path("top.r1.f2").get_property('rclr'))18 self.assertTrue(root.find_by_path("top.r1.f3").get_property('rclr'))19 self.assertFalse(root.find_by_path("top.r1.f4").get_property('rclr'))20 self.assertTrue(root.find_by_path("top.r1.f5").get_property('rclr'))21 self.assertFalse(root.find_by_path("top.r1.f6").get_property('rclr'))22 self.assertTrue(root.find_by_path("top.r1.f7").get_property('rclr'))23 self.assertFalse(root.find_by_path("top.r1.f8").get_property('rclr'))24 with self.subTest("rset"):25 self.assertFalse(root.find_by_path("top.r1.f0").get_property('rset'))26 self.assertFalse(root.find_by_path("top.r1.f1").get_property('rset'))27 self.assertTrue(root.find_by_path("top.r1.f2").get_property('rset'))28 self.assertFalse(root.find_by_path("top.r1.f3").get_property('rset'))29 self.assertTrue(root.find_by_path("top.r1.f4").get_property('rset'))30 self.assertFalse(root.find_by_path("top.r1.f5").get_property('rset'))31 self.assertTrue(root.find_by_path("top.r1.f6").get_property('rset'))32 self.assertFalse(root.find_by_path("top.r1.f7").get_property('rset'))33 self.assertTrue(root.find_by_path("top.r1.f8").get_property('rset'))34 with self.subTest("onread"):35 self.assertIsNone(root.find_by_path("top.r1.f0").get_property('onread'))36 self.assertEqual(37 root.find_by_path("top.r1.f1").get_property('onread'),38 rdltypes.OnReadType.rclr39 )40 self.assertEqual(41 root.find_by_path("top.r1.f2").get_property('onread'),42 rdltypes.OnReadType.rset43 )44 self.assertEqual(45 root.find_by_path("top.r1.f3").get_property('onread'),46 rdltypes.OnReadType.rclr47 )48 self.assertEqual(49 root.find_by_path("top.r1.f4").get_property('onread'),50 rdltypes.OnReadType.rset51 )52 self.assertEqual(53 root.find_by_path("top.r1.f5").get_property('onread'),54 rdltypes.OnReadType.rclr55 )56 self.assertEqual(57 root.find_by_path("top.r1.f6").get_property('onread'),58 rdltypes.OnReadType.rset59 )60 self.assertEqual(61 root.find_by_path("top.r1.f7").get_property('onread'),62 rdltypes.OnReadType.rclr63 )64 self.assertEqual(65 root.find_by_path("top.r1.f8").get_property('onread'),66 rdltypes.OnReadType.rset67 )68 #-----------------------------------------------------------------------69 with self.subTest("woclr"):70 self.assertFalse(root.find_by_path("top.r2.f0").get_property('woclr'))71 self.assertTrue(root.find_by_path("top.r2.f1").get_property('woclr'))72 self.assertFalse(root.find_by_path("top.r2.f2").get_property('woclr'))73 self.assertTrue(root.find_by_path("top.r2.f3").get_property('woclr'))74 self.assertFalse(root.find_by_path("top.r2.f4").get_property('woclr'))75 self.assertTrue(root.find_by_path("top.r2.f5").get_property('woclr'))76 self.assertFalse(root.find_by_path("top.r2.f6").get_property('woclr'))77 self.assertTrue(root.find_by_path("top.r2.f7").get_property('woclr'))78 self.assertFalse(root.find_by_path("top.r2.f8").get_property('woclr'))79 with self.subTest("woset"):80 self.assertFalse(root.find_by_path("top.r2.f0").get_property('woset'))81 self.assertFalse(root.find_by_path("top.r2.f1").get_property('woset'))82 self.assertTrue(root.find_by_path("top.r2.f2").get_property('woset'))83 self.assertFalse(root.find_by_path("top.r2.f3").get_property('woset'))84 self.assertTrue(root.find_by_path("top.r2.f4").get_property('woset'))85 self.assertFalse(root.find_by_path("top.r2.f5").get_property('woset'))86 self.assertTrue(root.find_by_path("top.r2.f6").get_property('woset'))87 self.assertFalse(root.find_by_path("top.r2.f7").get_property('woset'))88 self.assertTrue(root.find_by_path("top.r2.f8").get_property('woset'))89 with self.subTest("onwrite"):90 self.assertIsNone(root.find_by_path("top.r2.f0").get_property('onwrite'))91 self.assertEqual(92 root.find_by_path("top.r2.f1").get_property('onwrite'),93 rdltypes.OnWriteType.woclr94 )95 self.assertEqual(96 root.find_by_path("top.r2.f2").get_property('onwrite'),97 rdltypes.OnWriteType.woset98 )99 self.assertEqual(100 root.find_by_path("top.r2.f3").get_property('onwrite'),101 rdltypes.OnWriteType.woclr102 )103 self.assertEqual(104 root.find_by_path("top.r2.f4").get_property('onwrite'),105 rdltypes.OnWriteType.woset106 )107 self.assertEqual(108 root.find_by_path("top.r2.f5").get_property('onwrite'),109 rdltypes.OnWriteType.woclr110 )111 self.assertEqual(112 root.find_by_path("top.r2.f6").get_property('onwrite'),113 rdltypes.OnWriteType.woset114 )115 self.assertEqual(116 root.find_by_path("top.r2.f7").get_property('onwrite'),117 rdltypes.OnWriteType.woclr118 )119 self.assertEqual(120 root.find_by_path("top.r2.f8").get_property('onwrite'),121 rdltypes.OnWriteType.woset122 )123 #-----------------------------------------------------------------------124 with self.subTest("incrthreshold alias"):125 self.assertEqual(126 root.find_by_path("top.r3.f1").get_property('incrthreshold'),127 1128 )129 self.assertEqual(130 root.find_by_path("top.r3.f1").get_property('threshold'),131 1132 )133 self.assertEqual(134 root.find_by_path("top.r3.f2").get_property('incrthreshold'),135 2136 )137 self.assertEqual(138 root.find_by_path("top.r3.f2").get_property('threshold'),139 2140 )141 with self.subTest("incrsaturate alias"):142 self.assertEqual(143 root.find_by_path("top.r3.f1").get_property('incrsaturate'),144 3145 )146 self.assertEqual(147 root.find_by_path("top.r3.f1").get_property('saturate'),148 3149 )150 self.assertEqual(151 root.find_by_path("top.r3.f2").get_property('incrsaturate'),152 4153 )154 self.assertEqual(155 root.find_by_path("top.r3.f2").get_property('saturate'),156 4...

Full Screen

Full Screen

test_parameters.py

Source:test_parameters.py Github

copy

Full Screen

...13 reg8 = root.find_by_path("myAmap.reg8")14 mem32 = root.find_by_path("myAmap.mem32")15 mem64 = root.find_by_path("myAmap.mem64")16 with self.subTest("reg32"):17 self.assertEqual(reg32.get_property('regwidth'), 32)18 self.assertEqual(reg32.get_property('shared'), True)19 data = reg32.get_child_by_name("data")20 self.assertEqual(data.width, 31)21 self.assertEqual(data.high, 30)22 self.assertEqual(data.low, 0)23 with self.subTest("reg32a"):24 self.assertEqual(reg32a.get_property('regwidth'), 32)25 self.assertEqual(reg32a.get_property('shared'), True)26 data = reg32a.get_child_by_name("data")27 self.assertEqual(data.width, 31)28 self.assertEqual(data.high, 30)29 self.assertEqual(data.low, 0)30 with self.subTest("reg16"):31 self.assertEqual(reg16.get_property('regwidth'), 16)32 self.assertEqual(reg16.get_property('shared'), True)33 data = reg16.get_child_by_name("data")34 self.assertEqual(data.width, 15)35 self.assertEqual(data.high, 14)36 self.assertEqual(data.low, 0)37 with self.subTest("reg8"):38 self.assertEqual(reg8.get_property('regwidth'), 8)39 self.assertEqual(reg8.get_property('shared'), False)40 data = reg8.get_child_by_name("data")41 self.assertEqual(data.width, 7)42 self.assertEqual(data.high, 6)43 self.assertEqual(data.low, 0)44 with self.subTest("mem32"):45 self.assertEqual(mem32.get_property('mementries'), 4096)46 self.assertEqual(mem32.get_property('memwidth'), 32)47 with self.subTest("mem64"):48 self.assertEqual(mem64.get_property('mementries'), 4096)49 self.assertEqual(mem64.get_property('memwidth'), 64)50 def test_more(self):51 root = self.compile(52 ["rdl_src/parameters.rdl"],53 "amap2"54 )55 reg1 = root.find_by_path("amap2.reg1")56 reg2 = root.find_by_path("amap2.reg2")57 reg3 = root.find_by_path("amap2.reg3")58 with self.subTest("reg1"):59 self.assertEqual(reg1.inst.type_name, "param_reg")60 self.assertEqual(reg1.get_property('name'), "myname")61 self.assertEqual(reg1.get_property('shared'), False)62 data = reg1.get_child_by_name("data")63 self.assertEqual(data.get_property('hdl_path_slice'), ["dat"])64 with self.subTest("reg2"):65 self.assertEqual(reg2.inst.type_name, "param_reg")66 self.assertEqual(reg2.get_property('name'), "myname")67 self.assertEqual(reg2.get_property('shared'), False)68 data = reg2.get_child_by_name("data")69 self.assertEqual(data.get_property('hdl_path_slice'), ["dat"])70 with self.subTest("reg3"):71 self.assertEqual(reg3.inst.type_name, "param_reg_NAME_a36638b4_SHARED_t_FIELD_SLICES_184d423e")72 self.assertEqual(reg3.get_property('name'), "othername")73 self.assertEqual(reg3.get_property('shared'), True)74 data = reg3.get_child_by_name("data")75 self.assertEqual(data.get_property('hdl_path_slice'), ["foo"])76 def test_nested(self):77 root = self.compile(78 ["rdl_src/parameters.rdl"],79 "nested"80 )81 f1 = root.find_by_path("nested.rf_inst.r_inst1.f")82 f2 = root.find_by_path("nested.rf_inst.r_inst2.f")83 f3 = root.find_by_path("nested.r1_inst.f")84 with self.subTest("f1"):85 self.assertEqual(f1.width, 4)86 with self.subTest("f2"):87 self.assertEqual(f2.width, 4)88 with self.subTest("f3"):89 self.assertEqual(f3.width, 5)90 def test_elab_defaults(self):91 root = self.compile(92 ["rdl_src/parameters.rdl"],93 "elab_params",94 parameters={}95 )96 f1 = root.find_by_path("elab_params.r1.f")97 f2 = root.find_by_path("elab_params.r2.f")98 f3 = root.find_by_path("elab_params.r3.f")99 self.assertEqual(f1.width, 1)100 self.assertEqual(f2.width, 2)101 self.assertEqual(f3.width, 3)102 self.assertEqual(f1.get_property('onwrite'), rdlt.OnWriteType.woset)103 self.assertEqual(f2.get_property('donttest'), True)104 self.assertEqual(f3.get_property('name'), "default")105 def test_elab_override(self):106 root = self.compile(107 ["rdl_src/parameters.rdl"],108 "elab_params",109 parameters={110 "STR":"python!",111 "INT": 5,112 "INTARR": [6,7],113 "ONWR": rdlt.OnWriteType.woclr,114 "BOOL": False115 }116 )117 f1 = root.find_by_path("elab_params.r1.f")118 f2 = root.find_by_path("elab_params.r2.f")119 f3 = root.find_by_path("elab_params.r3.f")120 self.assertEqual(f1.width, 5)121 self.assertEqual(f2.width, 6)122 self.assertEqual(f3.width, 7)123 self.assertEqual(f1.get_property('onwrite'), rdlt.OnWriteType.woclr)124 self.assertEqual(f2.get_property('donttest'), False)125 self.assertEqual(f3.get_property('name'), "python!")126 def test_elab_override_via_eval(self):127 rdlc = RDLCompiler()128 root = self.compile(129 ["rdl_src/parameters.rdl"],130 "elab_params",131 parameters={132 "STR": rdlc.eval('"python!"'),133 "INT": rdlc.eval('5'),134 "INTARR": rdlc.eval("'{6,7}"),135 "ONWR": rdlc.eval('woclr'),136 "BOOL": rdlc.eval('100/2 - 50')137 }138 )139 f1 = root.find_by_path("elab_params.r1.f")140 f2 = root.find_by_path("elab_params.r2.f")141 f3 = root.find_by_path("elab_params.r3.f")142 self.assertEqual(f1.width, 5)143 self.assertEqual(f2.width, 6)144 self.assertEqual(f3.width, 7)145 self.assertEqual(f1.get_property('onwrite'), rdlt.OnWriteType.woclr)146 self.assertEqual(f2.get_property('donttest'), False)147 self.assertEqual(f3.get_property('name'), "python!")148 def test_param_scope(self):149 root = self.compile(150 ["rdl_src/parameters.rdl"],151 "param_scope"152 )153 ffX = root.find_by_path("param_scope.rfX.rf3.rf2.rr.ff")154 ffY = root.find_by_path("param_scope.rfY.rf3.rf2.rr.ff")155 ffZ = root.find_by_path("param_scope.rfZ.rf3.rf2.rr.ff")156 self.assertEqual(ffX.width, 2)157 self.assertEqual(ffY.width, 3)...

Full Screen

Full Screen

Playwright tutorial

LambdaTest’s Playwright tutorial will give you a broader idea about the Playwright automation framework, its unique features, and use cases with examples to exceed your understanding of Playwright testing. This tutorial will give A to Z guidance, from installing the Playwright framework to some best practices and advanced concepts.

Chapters:

  1. What is Playwright : Playwright is comparatively new but has gained good popularity. Get to know some history of the Playwright with some interesting facts connected with it.
  2. How To Install Playwright : Learn in detail about what basic configuration and dependencies are required for installing Playwright and run a test. Get a step-by-step direction for installing the Playwright automation framework.
  3. Playwright Futuristic Features: Launched in 2020, Playwright gained huge popularity quickly because of some obliging features such as Playwright Test Generator and Inspector, Playwright Reporter, Playwright auto-waiting mechanism and etc. Read up on those features to master Playwright testing.
  4. What is Component Testing: Component testing in Playwright is a unique feature that allows a tester to test a single component of a web application without integrating them with other elements. Learn how to perform Component testing on the Playwright automation framework.
  5. Inputs And Buttons In Playwright: Every website has Input boxes and buttons; learn about testing inputs and buttons with different scenarios and examples.
  6. Functions and Selectors in Playwright: Learn how to launch the Chromium browser with Playwright. Also, gain a better understanding of some important functions like “BrowserContext,” which allows you to run multiple browser sessions, and “newPage” which interacts with a page.
  7. Handling Alerts and Dropdowns in Playwright : Playwright interact with different types of alerts and pop-ups, such as simple, confirmation, and prompt, and different types of dropdowns, such as single selector and multi-selector get your hands-on with handling alerts and dropdown in Playright testing.
  8. Playwright vs Puppeteer: Get to know about the difference between two testing frameworks and how they are different than one another, which browsers they support, and what features they provide.
  9. Run Playwright Tests on LambdaTest: Playwright testing with LambdaTest leverages test performance to the utmost. You can run multiple Playwright tests in Parallel with the LammbdaTest test cloud. Get a step-by-step guide to run your Playwright test on the LambdaTest platform.
  10. Playwright Python Tutorial: Playwright automation framework support all major languages such as Python, JavaScript, TypeScript, .NET and etc. However, there are various advantages to Python end-to-end testing with Playwright because of its versatile utility. Get the hang of Playwright python testing with this chapter.
  11. Playwright End To End Testing Tutorial: Get your hands on with Playwright end-to-end testing and learn to use some exciting features such as TraceViewer, Debugging, Networking, Component testing, Visual testing, and many more.
  12. Playwright Video Tutorial: Watch the video tutorials on Playwright testing from experts and get a consecutive in-depth explanation of Playwright automation testing.

Run Playwright Python 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