How to use parse method in Playwright Internal

Best JavaScript code snippet using playwright-internal

spec.py

Source:spec.py Github

copy

Full Screen

1#!/usr/bin/env python32from .error import Error3from .parse_enums import Acc, Emit, Key4LEX_BYTE_CLASSES = bytearray(b"\000\000\000\000\000\000\000\000\000\001\002\000\000\000\000\000"5 b"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"6 b"\001\003\004\005\006\007\007\007\007\007\010\011\012\013\014\015"7 b"\016\017\020\020\020\020\020\020\021\021\022\007\007\007\023\007"8 b"\007\024\024\024\025\026\024\027\027\027\027\027\027\027\027\027"9 b"\027\027\027\027\027\030\027\027\027\027\027\031\032\033\007\027"10 b"\007\034\035\024\025\036\037\027\027\040\027\027\041\027\042\027"11 b"\027\027\043\044\045\046\027\027\027\027\027\047\050\051\007\000"12 b"\052\052\052\052\052\052\052\052\052\052\052\052\052\052\052\052"13 b"\053\053\053\053\053\053\053\053\053\053\053\053\053\053\053\053"14 b"\054\054\054\054\054\054\054\054\054\054\054\054\054\054\054\054"15 b"\054\054\054\054\054\054\054\054\054\054\054\054\054\054\054\054"16 b"\055\055\056\056\056\056\056\056\056\056\056\056\056\056\056\056"17 b"\056\056\056\056\056\056\056\056\056\056\056\056\056\056\056\056"18 b"\057\060\060\060\060\060\060\060\060\060\060\060\060\061\060\060"19 b"\062\063\063\063\064\055\055\055\055\055\055\055\055\055\055\055")20LEX_TRANSITIONS = [21 bytearray(b"\214\220\201\113\041\125\115\220\117\002\124\003\001\001\004\005\005\005\013\067"22 b"\001\001\001\001\001\120\220\121\001\001\001\024\031\001\014\001\001\020\001\122"23 b"\101\123\215\215\215\215\215\215\215\215\215\215\215"),24 bytearray(b"\223\223\223\223\223\223\223\223\223\001\223\001\001\001\001\001\001\001\013\223"25 b"\001\001\001\001\001\223\223\223\001\001\001\001\001\001\001\001\001\001\001\223"26 b"\223\223\223\223\223\223\223\223\223\223\223\223\223"),27 bytearray(b"\223\223\223\223\223\223\223\223\223\001\223\001\001\001\004\005\005\005\013\223"28 b"\001\001\001\001\001\223\223\223\001\001\001\001\031\001\001\001\001\001\001\223"29 b"\223\223\223\223\223\223\223\223\223\223\223\223\223"),30 bytearray(b"\223\223\223\223\223\223\223\223\223\001\223\001\001\001\004\005\005\005\013\223"31 b"\001\001\001\001\001\223\223\223\001\001\001\001\034\001\001\001\001\001\001\223"32 b"\223\223\223\223\223\223\223\223\223\223\223\223\223"),33 bytearray(b"\324\324\324\324\324\324\324\324\324\001\324\001\006\001\001\001\001\001\013\324"34 b"\001\001\010\001\001\324\324\324\001\001\010\001\001\001\001\001\001\001\001\324"35 b"\324\324\324\324\324\324\324\324\324\324\324\324\324"),36 bytearray(b"\324\324\324\324\324\324\324\324\324\001\324\001\006\001\005\005\005\005\013\324"37 b"\001\001\010\001\001\324\324\324\001\001\010\001\001\001\001\001\001\001\001\324"38 b"\324\324\324\324\324\324\324\324\324\324\324\324\324"),39 bytearray(b"\223\223\223\223\223\223\223\223\223\001\223\001\001\001\007\007\007\007\013\223"40 b"\001\001\001\001\001\223\223\223\001\001\001\001\001\001\001\001\001\001\001\223"41 b"\223\223\223\223\223\223\223\223\223\223\223\223\223"),42 bytearray(b"\325\325\325\325\325\325\325\325\325\001\325\001\001\001\007\007\007\007\013\325"43 b"\001\001\010\001\001\325\325\325\001\001\010\001\001\001\001\001\001\001\001\325"44 b"\325\325\325\325\325\325\325\325\325\325\325\325\325"),45 bytearray(b"\223\223\223\223\223\223\223\223\223\011\223\011\001\001\012\012\012\012\013\223"46 b"\001\001\001\001\001\223\223\223\001\001\001\001\001\001\001\001\001\001\001\223"47 b"\223\223\223\223\223\223\223\223\223\223\223\223\223"),48 bytearray(b"\223\223\223\223\223\223\223\223\223\001\223\001\001\001\012\012\012\012\013\223"49 b"\001\001\001\001\001\223\223\223\001\001\001\001\001\001\001\001\001\001\001\223"50 b"\223\223\223\223\223\223\223\223\223\223\223\223\223"),51 bytearray(b"\325\325\325\325\325\325\325\325\325\001\325\001\001\001\012\012\012\012\013\325"52 b"\001\001\001\001\001\325\325\325\001\001\001\001\001\001\001\001\001\001\001\325"53 b"\325\325\325\325\325\325\325\325\325\325\325\325\325"),54 bytearray(b"\322\322\322\322\322\322\322\322\322\322\322\322\322\322\322\322\322\322\322\322"55 b"\322\322\322\322\322\322\322\322\322\322\322\322\322\322\322\322\322\322\322\322"56 b"\322\322\322\322\322\322\322\322\322\322\322\322\322"),57 bytearray(b"\223\223\223\223\223\223\223\223\223\001\223\001\001\001\001\001\001\001\013\223"58 b"\001\001\001\001\001\223\223\223\037\001\001\001\001\001\001\001\001\001\015\223"59 b"\223\223\223\223\223\223\223\223\223\223\223\223\223"),60 bytearray(b"\223\223\223\223\223\223\223\223\223\001\223\001\001\001\001\001\001\001\013\223"61 b"\001\001\001\001\001\223\223\223\001\001\001\001\001\016\001\001\001\001\001\223"62 b"\223\223\223\223\223\223\223\223\223\223\223\223\223"),63 bytearray(b"\223\223\223\223\223\223\223\223\223\001\223\001\001\001\001\001\001\001\013\223"64 b"\001\001\001\001\001\223\223\223\001\001\001\001\001\017\001\001\001\001\001\223"65 b"\223\223\223\223\223\223\223\223\223\223\223\223\223"),66 bytearray(b"\314\314\314\314\314\314\314\314\314\001\314\001\001\001\001\001\001\001\013\314"67 b"\001\001\001\001\001\314\314\314\001\001\001\001\001\001\001\001\001\001\001\314"68 b"\314\314\314\314\314\314\314\314\314\314\314\314\314"),69 bytearray(b"\223\223\223\223\223\223\223\223\223\001\223\001\001\001\001\001\001\001\013\223"70 b"\001\001\001\001\001\223\223\223\001\001\001\001\001\001\001\021\001\001\001\223"71 b"\223\223\223\223\223\223\223\223\223\223\223\223\223"),72 bytearray(b"\223\223\223\223\223\223\223\223\223\001\223\001\001\001\001\001\001\001\013\223"73 b"\001\001\001\001\001\223\223\223\001\001\001\001\001\001\001\001\001\001\022\223"74 b"\223\223\223\223\223\223\223\223\223\223\223\223\223"),75 bytearray(b"\223\223\223\223\223\223\223\223\223\001\223\001\001\001\001\001\001\001\013\223"76 b"\001\001\001\001\001\223\223\223\001\001\023\001\001\001\001\001\001\001\001\223"77 b"\223\223\223\223\223\223\223\223\223\223\223\223\223"),78 bytearray(b"\315\315\315\315\315\315\315\315\315\001\315\001\001\001\001\001\001\001\013\315"79 b"\001\001\001\001\001\315\315\315\001\001\001\001\001\001\001\001\001\001\001\315"80 b"\315\315\315\315\315\315\315\315\315\315\315\315\315"),81 bytearray(b"\223\223\223\223\223\223\223\223\223\001\223\001\001\001\001\001\001\001\013\223"82 b"\001\001\001\001\001\223\223\223\025\001\001\001\001\001\001\001\001\001\001\223"83 b"\223\223\223\223\223\223\223\223\223\223\223\223\223"),84 bytearray(b"\223\223\223\223\223\223\223\223\223\001\223\001\001\001\001\001\001\001\013\223"85 b"\001\001\001\001\001\223\223\223\001\001\001\001\001\026\001\001\001\001\001\223"86 b"\223\223\223\223\223\223\223\223\223\223\223\223\223"),87 bytearray(b"\223\223\223\223\223\223\223\223\223\001\223\001\001\001\001\001\001\001\013\223"88 b"\001\001\001\001\001\223\223\223\001\001\001\001\001\001\001\001\027\001\001\223"89 b"\223\223\223\223\223\223\223\223\223\223\223\223\223"),90 bytearray(b"\223\223\223\223\223\223\223\223\223\001\223\001\001\001\001\001\001\001\013\223"91 b"\001\001\001\001\001\223\223\223\001\001\030\001\001\001\001\001\001\001\001\223"92 b"\223\223\223\223\223\223\223\223\223\223\223\223\223"),93 bytearray(b"\316\316\316\316\316\316\316\316\316\001\316\001\001\001\001\001\001\001\013\316"94 b"\001\001\001\001\001\316\316\316\001\001\001\001\001\001\001\001\001\001\001\316"95 b"\316\316\316\316\316\316\316\316\316\316\316\316\316"),96 bytearray(b"\223\223\223\223\223\223\223\223\223\001\223\001\001\001\001\001\001\001\013\223"97 b"\001\001\001\001\001\223\223\223\001\001\001\001\001\001\032\001\001\001\001\223"98 b"\223\223\223\223\223\223\223\223\223\223\223\223\223"),99 bytearray(b"\223\223\223\223\223\223\223\223\223\001\223\001\001\001\001\001\001\001\013\223"100 b"\001\001\001\001\001\223\223\223\001\001\001\033\001\001\001\001\001\001\001\223"101 b"\223\223\223\223\223\223\223\223\223\223\223\223\223"),102 bytearray(b"\317\317\317\317\317\317\317\317\317\001\317\001\001\001\001\001\001\001\013\317"103 b"\001\001\001\001\001\317\317\317\001\001\001\001\001\001\001\001\001\001\001\317"104 b"\317\317\317\317\317\317\317\317\317\317\317\317\317"),105 bytearray(b"\223\223\223\223\223\223\223\223\223\001\223\001\001\001\001\001\001\001\013\223"106 b"\001\001\001\001\001\223\223\223\001\001\001\001\001\001\035\001\001\001\001\223"107 b"\223\223\223\223\223\223\223\223\223\223\223\223\223"),108 bytearray(b"\223\223\223\223\223\223\223\223\223\001\223\001\001\001\001\001\001\001\013\223"109 b"\001\001\001\001\001\223\223\223\001\001\001\036\001\001\001\001\001\001\001\223"110 b"\223\223\223\223\223\223\223\223\223\223\223\223\223"),111 bytearray(b"\320\320\320\320\320\320\320\320\320\001\320\001\001\001\001\001\001\001\013\320"112 b"\001\001\001\001\001\320\320\320\001\001\001\001\001\001\001\001\001\001\001\320"113 b"\320\320\320\320\320\320\320\320\320\320\320\320\320"),114 bytearray(b"\223\223\223\223\223\223\223\223\223\001\223\001\001\001\001\001\001\001\013\223"115 b"\001\001\001\001\001\223\223\223\001\001\001\001\001\001\040\001\001\001\001\223"116 b"\223\223\223\223\223\223\223\223\223\223\223\223\223"),117 bytearray(b"\321\321\321\321\321\321\321\321\321\001\321\001\001\001\001\001\001\001\013\321"118 b"\001\001\001\001\001\321\321\321\001\001\001\001\001\001\001\001\001\001\001\321"119 b"\321\321\321\321\321\321\321\321\321\321\321\321\321"),120 bytearray(b"\214\041\226\041\065\041\041\041\041\041\041\041\041\041\041\041\041\041\041\041"121 b"\041\041\041\041\041\041\051\041\041\041\041\041\041\041\041\041\041\041\041\041"122 b"\041\041\216\216\216\216\050\042\047\043\044\046\045"),123 bytearray(b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"124 b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"125 b"\217\217\217\217\050\217\217\217\217\217\217\217\217"),126 bytearray(b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"127 b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"128 b"\217\217\050\050\217\217\217\217\217\217\217\217\217"),129 bytearray(b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"130 b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"131 b"\217\217\217\047\047\217\217\217\217\217\217\217\217"),132 bytearray(b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"133 b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"134 b"\217\217\047\217\217\217\217\217\217\217\217\217\217"),135 bytearray(b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"136 b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"137 b"\217\217\047\047\047\217\217\217\217\217\217\217\217"),138 bytearray(b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"139 b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"140 b"\217\217\050\050\050\217\217\217\217\217\217\217\217"),141 bytearray(b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"142 b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"143 b"\217\217\041\041\041\217\217\217\217\217\217\217\217"),144 bytearray(b"\224\224\226\224\041\224\224\224\224\224\224\224\224\041\224\224\224\224\224\224"145 b"\224\224\224\224\052\224\041\224\224\041\224\041\224\224\041\041\224\041\060\224"146 b"\224\224\224\224\224\224\224\224\224\224\224\224\224"),147 bytearray(b"\225\225\226\225\225\225\225\225\225\225\225\225\225\225\053\225\225\225\225\225"148 b"\225\225\225\225\225\225\225\225\225\225\225\225\225\225\225\225\225\225\225\225"149 b"\225\225\225\225\225\225\225\225\225\225\225\225\225"),150 bytearray(b"\225\225\226\225\225\225\225\225\225\225\225\225\225\225\054\225\225\225\225\225"151 b"\225\225\225\225\225\225\225\225\225\225\225\225\225\225\225\225\225\225\225\225"152 b"\225\225\225\225\225\225\225\225\225\225\225\225\225"),153 bytearray(b"\225\225\226\225\225\225\225\225\225\225\225\225\225\225\056\055\225\225\225\225"154 b"\225\225\225\225\225\225\225\225\225\225\225\225\225\225\225\225\225\225\225\225"155 b"\225\225\225\225\225\225\225\225\225\225\225\225\225"),156 bytearray(b"\225\225\226\225\225\225\225\225\225\225\225\225\225\225\057\225\225\225\225\225"157 b"\225\225\225\225\225\225\225\225\225\225\225\225\225\225\225\225\225\225\225\225"158 b"\225\225\225\225\225\225\225\225\225\225\225\225\225"),159 bytearray(b"\225\225\226\225\225\225\225\225\225\225\225\225\225\225\060\057\057\057\225\225"160 b"\057\057\057\225\225\225\225\225\057\057\057\057\225\225\225\225\225\225\225\225"161 b"\225\225\225\225\225\225\225\225\225\225\225\225\225"),162 bytearray(b"\225\225\226\225\225\225\225\225\225\225\225\225\225\225\061\061\061\061\225\225"163 b"\061\061\061\225\225\225\225\225\061\061\061\061\225\225\225\225\225\225\225\225"164 b"\225\225\225\225\225\225\225\225\225\225\225\225\225"),165 bytearray(b"\225\225\226\225\225\225\225\225\225\225\225\225\225\225\061\061\061\061\225\225"166 b"\061\064\061\225\225\225\225\225\061\061\061\061\225\225\225\225\225\225\225\225"167 b"\225\225\225\225\225\225\225\225\225\225\225\225\225"),168 bytearray(b"\225\225\226\225\225\225\225\225\225\225\225\225\225\225\062\062\062\062\225\225"169 b"\062\062\062\225\225\225\225\225\062\062\062\062\225\225\225\225\225\225\225\225"170 b"\225\225\225\225\225\225\225\225\225\225\225\225\225"),171 bytearray(b"\225\225\226\225\225\225\225\225\225\225\225\225\225\225\063\063\063\063\225\225"172 b"\063\063\063\225\225\225\225\225\063\063\063\063\225\225\225\225\225\225\225\225"173 b"\225\225\225\225\225\225\225\225\225\225\225\225\225"),174 bytearray(b"\225\225\226\225\225\225\225\225\225\225\225\225\225\225\041\041\041\041\225\225"175 b"\041\041\041\225\225\225\225\225\041\041\041\041\225\225\225\225\225\225\225\225"176 b"\225\225\225\225\225\225\225\225\225\225\225\225\225"),177 bytearray(b"\225\225\226\225\225\225\225\225\225\225\225\225\225\225\062\062\062\225\225\225"178 b"\225\225\225\225\225\225\225\225\225\225\225\225\225\225\225\225\225\225\225\225"179 b"\225\225\225\225\225\225\225\225\225\225\225\225\225"),180 bytearray(b"\327\327\327\327\327\327\327\327\327\327\327\327\327\327\327\327\327\327\066\327"181 b"\327\327\327\327\327\327\327\327\327\327\327\327\327\327\327\327\327\327\327\327"182 b"\327\327\327\327\327\327\327\327\327\327\327\327\327"),183 bytearray(b"\323\323\323\323\323\323\323\323\323\323\323\323\323\323\323\323\323\323\323\323"184 b"\323\323\323\323\323\323\323\323\323\323\323\323\323\323\323\323\323\323\323\323"185 b"\323\323\323\323\323\323\323\323\323\323\323\323\323"),186 bytearray(b"\214\077\311\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100"187 b"\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100"188 b"\100\100\216\216\216\216\076\070\075\071\072\074\073"),189 bytearray(b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"190 b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"191 b"\217\217\217\217\076\217\217\217\217\217\217\217\217"),192 bytearray(b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"193 b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"194 b"\217\217\076\076\217\217\217\217\217\217\217\217\217"),195 bytearray(b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"196 b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"197 b"\217\217\217\075\075\217\217\217\217\217\217\217\217"),198 bytearray(b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"199 b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"200 b"\217\217\075\217\217\217\217\217\217\217\217\217\217"),201 bytearray(b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"202 b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"203 b"\217\217\075\075\075\217\217\217\217\217\217\217\217"),204 bytearray(b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"205 b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"206 b"\217\217\076\076\076\217\217\217\217\217\217\217\217"),207 bytearray(b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"208 b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"209 b"\217\217\100\100\100\217\217\217\217\217\217\217\217"),210 bytearray(b"\214\100\311\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100"211 b"\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100"212 b"\100\100\216\216\216\216\076\070\075\071\072\074\073"),213 bytearray(b"\214\100\330\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100"214 b"\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100"215 b"\100\100\216\216\216\216\076\070\075\071\072\074\073"),216 bytearray(b"\214\111\312\112\112\112\112\112\112\112\112\112\112\112\112\112\112\112\112\112"217 b"\112\112\112\112\112\112\112\112\112\112\112\112\112\112\112\112\112\112\112\112"218 b"\112\112\216\216\216\216\110\102\107\103\104\106\105"),219 bytearray(b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"220 b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"221 b"\217\217\217\217\110\217\217\217\217\217\217\217\217"),222 bytearray(b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"223 b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"224 b"\217\217\110\110\217\217\217\217\217\217\217\217\217"),225 bytearray(b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"226 b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"227 b"\217\217\217\107\107\217\217\217\217\217\217\217\217"),228 bytearray(b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"229 b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"230 b"\217\217\107\217\217\217\217\217\217\217\217\217\217"),231 bytearray(b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"232 b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"233 b"\217\217\107\107\107\217\217\217\217\217\217\217\217"),234 bytearray(b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"235 b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"236 b"\217\217\110\110\110\217\217\217\217\217\217\217\217"),237 bytearray(b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"238 b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"239 b"\217\217\112\112\112\217\217\217\217\217\217\217\217"),240 bytearray(b"\214\112\312\112\112\112\112\112\112\112\112\112\112\112\112\112\112\112\112\112"241 b"\112\112\112\112\112\112\112\112\112\112\112\112\112\112\112\112\112\112\112\112"242 b"\112\112\216\216\216\216\110\102\107\103\104\106\105"),243 bytearray(b"\214\112\331\112\112\112\112\112\112\112\112\112\112\112\112\112\112\112\112\112"244 b"\112\112\112\112\112\112\112\112\112\112\112\112\112\112\112\112\112\112\112\112"245 b"\112\112\216\216\216\216\110\102\107\103\104\106\105"),246 bytearray(b"\227\114\313\227\227\227\227\227\227\227\227\227\227\227\227\227\227\227\227\227"247 b"\227\227\227\227\227\227\227\227\227\227\227\227\227\227\227\227\227\227\227\227"248 b"\227\227\227\227\227\227\227\227\227\227\227\227\227"),249 bytearray(b"\214\227\313\227\227\227\227\227\227\227\227\227\227\227\227\227\227\227\227\227"250 b"\227\227\227\227\227\227\227\227\227\227\227\227\227\227\227\227\227\227\227\227"251 b"\227\227\215\215\215\215\215\215\215\215\215\215\215"),252 bytearray(b"\326\115\326\326\326\326\326\326\326\221\326\221\221\221\116\116\116\116\326\326"253 b"\116\116\116\221\221\326\326\326\116\116\116\116\221\221\221\221\221\221\221\326"254 b"\326\326\326\326\326\326\326\326\326\326\326\326\326"),255 bytearray(b"\222\222\222\222\222\222\222\222\222\221\222\221\221\221\115\115\115\115\222\222"256 b"\115\115\115\221\221\222\222\222\115\115\115\115\221\221\221\221\221\221\221\222"257 b"\222\222\222\222\222\222\222\222\222\222\222\222\222"),258 bytearray(b"\303\303\303\303\303\303\303\303\303\303\303\303\303\303\303\303\303\303\303\303"259 b"\303\303\303\303\303\303\303\303\303\303\303\303\303\303\303\303\303\303\303\303"260 b"\303\303\303\303\303\303\303\303\303\303\303\303\303"),261 bytearray(b"\304\304\304\304\304\304\304\304\304\304\304\304\304\304\304\304\304\304\304\304"262 b"\304\304\304\304\304\304\304\304\304\304\304\304\304\304\304\304\304\304\304\304"263 b"\304\304\304\304\304\304\304\304\304\304\304\304\304"),264 bytearray(b"\305\305\305\305\305\305\305\305\305\305\305\305\305\305\305\305\305\305\305\305"265 b"\305\305\305\305\305\305\305\305\305\305\305\305\305\305\305\305\305\305\305\305"266 b"\305\305\305\305\305\305\305\305\305\305\305\305\305"),267 bytearray(b"\306\306\306\306\306\306\306\306\306\306\306\306\306\306\306\306\306\306\306\306"268 b"\306\306\306\306\306\306\306\306\306\306\306\306\306\306\306\306\306\306\306\306"269 b"\306\306\306\306\306\306\306\306\306\306\306\306\306"),270 bytearray(b"\307\307\307\307\307\307\307\307\307\307\307\307\307\307\307\307\307\307\307\307"271 b"\307\307\307\307\307\307\307\307\307\307\307\307\307\307\307\307\307\307\307\307"272 b"\307\307\307\307\307\307\307\307\307\307\307\307\307"),273 bytearray(b"\310\310\310\310\310\310\310\310\310\310\310\310\310\310\310\310\310\310\310\310"274 b"\310\310\310\310\310\310\310\310\310\310\310\310\310\310\310\310\310\310\310\310"275 b"\310\310\310\310\310\310\310\310\310\310\310\310\310"),276 bytearray(b"\214\125\332\125\125\125\125\125\125\125\125\125\125\125\125\125\125\125\125\125"277 b"\125\125\125\125\125\125\125\125\125\125\125\125\125\125\125\125\125\125\125\125"278 b"\125\125\216\216\216\216\134\126\133\127\130\132\131"),279 bytearray(b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"280 b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"281 b"\217\217\217\217\134\217\217\217\217\217\217\217\217"),282 bytearray(b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"283 b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"284 b"\217\217\134\134\217\217\217\217\217\217\217\217\217"),285 bytearray(b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"286 b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"287 b"\217\217\217\133\133\217\217\217\217\217\217\217\217"),288 bytearray(b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"289 b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"290 b"\217\217\133\217\217\217\217\217\217\217\217\217\217"),291 bytearray(b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"292 b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"293 b"\217\217\133\133\133\217\217\217\217\217\217\217\217"),294 bytearray(b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"295 b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"296 b"\217\217\134\134\134\217\217\217\217\217\217\217\217"),297 bytearray(b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"298 b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"299 b"\217\217\125\125\125\217\217\217\217\217\217\217\217"),300]301PARSE_DEFS = [302 (Error.LONG, None, [], [], None),303 (None, None, [1], [], None),304 (None, Emit.NULL, [], [], None),305 (None, Emit.TRUE, [], [], None),306 (None, Emit.FALSE, [], [], None),307 (None, Emit.INF, [], [], None),308 (None, Emit.NEG_INF, [], [], None),309 (None, Emit.NAN, [], [], None),310 (None, Emit.INT, [], [], None),311 (None, Emit.FLOAT, [], [], None),312 (None, Emit.STRING, [], [], None),313 (None, Emit.DATA, [], [], None),314 (None, Emit.SHORT_ARRAY_IN, [17], [], None),315 (None, Emit.SHORT_MAP_IN, [21], [], None),316 (None, None, [2], [], None),317 (None, Emit.NULL, [3], [], None),318 (None, Emit.TRUE, [3], [], None),319 (None, Emit.FALSE, [3], [], None),320 (None, Emit.INF, [3], [], None),321 (None, Emit.NEG_INF, [3], [], None),322 (None, Emit.NAN, [3], [], None),323 (None, Emit.INT, [3], [], None),324 (None, Emit.FLOAT, [3], [], None),325 (None, Emit.STRING, [3], [], None),326 (None, None, [9], [Acc.DATA], None),327 (None, None, [13], [Acc.STRING], None),328 (None, None, [11], [], None),329 (None, None, [15], [], None),330 (None, Emit.SHORT_ARRAY_IN, [3, 17], [], None),331 (None, Emit.LONG_ARRAY_IN, [19, 0], [], None),332 (None, Emit.SHORT_MAP_IN, [3, 21], [], None),333 (None, Emit.LONG_MAP_IN, [24, 0], [], Key.UNQUOTED),334 (None, Emit.LONG_MAP_IN, [24, 0], [], Key.QUOTED),335 (Error.SUFFIX, None, [], [], None),336 (None, None, [2, 5], [], None),337 (None, None, [3, 5], [], None),338 (None, None, [4], [], None),339 (None, None, [], [], None),340 (None, None, [3], [], None),341 (Error.SIBLING, None, [], [], None),342 (Error.CHILD, None, [], [], None),343 (None, None, [6], [], None),344 (None, None, [6, 5], [], None),345 (None, None, [5], [], None),346 (Error.SHORT, None, [], [], None),347 (None, None, [9], [], None),348 (None, None, [9, 5], [], None),349 (None, None, [8], [], None),350 (None, Emit.ACC_DATA, [], [], None),351 (None, None, [13], [Acc.NL, Acc.STRING], None),352 (None, None, [11], [Acc.NL], None),353 (None, None, [11, 5], [], None),354 (None, None, [10], [], None),355 (None, Emit.ACC_STRING, [], [Acc.NL], None),356 (None, None, [13], [], None),357 (None, None, [13], [Acc.SP, Acc.STRING], None),358 (None, None, [13, 5], [], None),359 (None, None, [12], [], None),360 (Error.BANG_LAST, None, [], [], None),361 (None, None, [15, 5], [], None),362 (None, None, [14], [], None),363 (None, Emit.ACC_STRING, [], [], None),364 (Error.ARRAY_END, None, [], [], None),365 (None, None, [16, 7], [], None),366 (None, Emit.SHORT_ARRAY_OUT, [], [], None),367 (None, Emit.NULL, [16], [], None),368 (None, Emit.TRUE, [16], [], None),369 (None, Emit.FALSE, [16], [], None),370 (None, Emit.INF, [16], [], None),371 (None, Emit.NEG_INF, [16], [], None),372 (None, Emit.NAN, [16], [], None),373 (None, Emit.INT, [16], [], None),374 (None, Emit.FLOAT, [16], [], None),375 (None, Emit.STRING, [16], [], None),376 (None, Emit.DATA, [16], [], None),377 (None, Emit.SHORT_ARRAY_IN, [16, 17], [], None),378 (None, Emit.SHORT_MAP_IN, [16, 21], [], None),379 (None, None, [19], [], None),380 (None, None, [19, 0], [], None),381 (None, None, [19, 5], [], None),382 (None, None, [18], [], None),383 (None, Emit.LONG_ARRAY_OUT, [], [], None),384 (Error.MAP_END, None, [], [], None),385 (None, None, [20, 22], [], None),386 (None, Emit.SHORT_MAP_OUT, [], [], None),387 (Error.MAP_KEY, None, [], [], None),388 (None, None, [20, 7], [], Key.UNQUOTED),389 (None, None, [20, 7], [], Key.QUOTED),390 (None, None, [7], [], Key.UNQUOTED),391 (None, None, [7], [], Key.QUOTED),392 (None, None, [24], [], None),393 (None, None, [24, 0], [], Key.UNQUOTED),394 (None, None, [24, 0], [], Key.QUOTED),395 (None, None, [24, 5], [], None),396 (None, None, [23], [], None),397 (None, Emit.LONG_MAP_OUT, [], [], None),398]399PARSE_TABLE = [400 [PARSE_DEFS[1], PARSE_DEFS[0], PARSE_DEFS[0], PARSE_DEFS[0], PARSE_DEFS[12],401 PARSE_DEFS[0], PARSE_DEFS[13], PARSE_DEFS[0], PARSE_DEFS[0], PARSE_DEFS[0],402 PARSE_DEFS[0], PARSE_DEFS[0], PARSE_DEFS[2], PARSE_DEFS[3], PARSE_DEFS[4],403 PARSE_DEFS[5], PARSE_DEFS[6], PARSE_DEFS[7], PARSE_DEFS[0], PARSE_DEFS[0],404 PARSE_DEFS[8], PARSE_DEFS[9], PARSE_DEFS[11], PARSE_DEFS[10], PARSE_DEFS[0],405 PARSE_DEFS[0], PARSE_DEFS[0]],406 [PARSE_DEFS[0], PARSE_DEFS[0], PARSE_DEFS[0], PARSE_DEFS[29], PARSE_DEFS[28],407 PARSE_DEFS[0], PARSE_DEFS[30], PARSE_DEFS[0], PARSE_DEFS[0], PARSE_DEFS[26],408 PARSE_DEFS[26], PARSE_DEFS[27], PARSE_DEFS[15], PARSE_DEFS[16], PARSE_DEFS[17],409 PARSE_DEFS[18], PARSE_DEFS[19], PARSE_DEFS[20], PARSE_DEFS[31], PARSE_DEFS[32],410 PARSE_DEFS[21], PARSE_DEFS[22], PARSE_DEFS[24], PARSE_DEFS[23], PARSE_DEFS[25],411 PARSE_DEFS[25], PARSE_DEFS[14]],412 [PARSE_DEFS[34], PARSE_DEFS[1], PARSE_DEFS[0], PARSE_DEFS[33], PARSE_DEFS[33],413 PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],414 PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],415 PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],416 PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],417 PARSE_DEFS[33], PARSE_DEFS[33]],418 [PARSE_DEFS[35], PARSE_DEFS[36], PARSE_DEFS[37], PARSE_DEFS[33], PARSE_DEFS[33],419 PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],420 PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],421 PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],422 PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],423 PARSE_DEFS[33], PARSE_DEFS[38]],424 [PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[0], PARSE_DEFS[39], PARSE_DEFS[39],425 PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39],426 PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39],427 PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39],428 PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39],429 PARSE_DEFS[39], PARSE_DEFS[38]],430 [PARSE_DEFS[40], PARSE_DEFS[40], PARSE_DEFS[0], PARSE_DEFS[40], PARSE_DEFS[40],431 PARSE_DEFS[40], PARSE_DEFS[40], PARSE_DEFS[40], PARSE_DEFS[40], PARSE_DEFS[40],432 PARSE_DEFS[40], PARSE_DEFS[40], PARSE_DEFS[40], PARSE_DEFS[40], PARSE_DEFS[40],433 PARSE_DEFS[40], PARSE_DEFS[40], PARSE_DEFS[40], PARSE_DEFS[40], PARSE_DEFS[40],434 PARSE_DEFS[40], PARSE_DEFS[40], PARSE_DEFS[40], PARSE_DEFS[40], PARSE_DEFS[40],435 PARSE_DEFS[40], PARSE_DEFS[41]],436 [PARSE_DEFS[42], PARSE_DEFS[43], PARSE_DEFS[37], PARSE_DEFS[33], PARSE_DEFS[33],437 PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],438 PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],439 PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],440 PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],441 PARSE_DEFS[33], PARSE_DEFS[33]],442 [PARSE_DEFS[44], PARSE_DEFS[44], PARSE_DEFS[44], PARSE_DEFS[44], PARSE_DEFS[12],443 PARSE_DEFS[44], PARSE_DEFS[13], PARSE_DEFS[44], PARSE_DEFS[44], PARSE_DEFS[44],444 PARSE_DEFS[44], PARSE_DEFS[44], PARSE_DEFS[2], PARSE_DEFS[3], PARSE_DEFS[4],445 PARSE_DEFS[5], PARSE_DEFS[6], PARSE_DEFS[7], PARSE_DEFS[44], PARSE_DEFS[44],446 PARSE_DEFS[8], PARSE_DEFS[9], PARSE_DEFS[11], PARSE_DEFS[10], PARSE_DEFS[44],447 PARSE_DEFS[44], PARSE_DEFS[44]],448 [PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39],449 PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39],450 PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39],451 PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39],452 PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[24], PARSE_DEFS[39], PARSE_DEFS[39],453 PARSE_DEFS[39], PARSE_DEFS[45]],454 [PARSE_DEFS[46], PARSE_DEFS[47], PARSE_DEFS[48], PARSE_DEFS[33], PARSE_DEFS[33],455 PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],456 PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],457 PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],458 PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],459 PARSE_DEFS[33], PARSE_DEFS[45]],460 [PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39],461 PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[50],462 PARSE_DEFS[50], PARSE_DEFS[27], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39],463 PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39],464 PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[49],465 PARSE_DEFS[49], PARSE_DEFS[26]],466 [PARSE_DEFS[51], PARSE_DEFS[52], PARSE_DEFS[53], PARSE_DEFS[33], PARSE_DEFS[33],467 PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],468 PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],469 PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],470 PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],471 PARSE_DEFS[33], PARSE_DEFS[33]],472 [PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39],473 PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[50],474 PARSE_DEFS[50], PARSE_DEFS[27], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39],475 PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39],476 PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[55],477 PARSE_DEFS[49], PARSE_DEFS[54]],478 [PARSE_DEFS[56], PARSE_DEFS[57], PARSE_DEFS[53], PARSE_DEFS[33], PARSE_DEFS[33],479 PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],480 PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],481 PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],482 PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],483 PARSE_DEFS[33], PARSE_DEFS[33]],484 [PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39],485 PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[58],486 PARSE_DEFS[58], PARSE_DEFS[58], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39],487 PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39],488 PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[58],489 PARSE_DEFS[58], PARSE_DEFS[27]],490 [PARSE_DEFS[59], PARSE_DEFS[60], PARSE_DEFS[61], PARSE_DEFS[33], PARSE_DEFS[33],491 PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],492 PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],493 PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],494 PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],495 PARSE_DEFS[33], PARSE_DEFS[33]],496 [PARSE_DEFS[62], PARSE_DEFS[62], PARSE_DEFS[62], PARSE_DEFS[62], PARSE_DEFS[62],497 PARSE_DEFS[64], PARSE_DEFS[62], PARSE_DEFS[62], PARSE_DEFS[63], PARSE_DEFS[62],498 PARSE_DEFS[62], PARSE_DEFS[62], PARSE_DEFS[62], PARSE_DEFS[62], PARSE_DEFS[62],499 PARSE_DEFS[62], PARSE_DEFS[62], PARSE_DEFS[62], PARSE_DEFS[62], PARSE_DEFS[62],500 PARSE_DEFS[62], PARSE_DEFS[62], PARSE_DEFS[62], PARSE_DEFS[62], PARSE_DEFS[62],501 PARSE_DEFS[62], PARSE_DEFS[62]],502 [PARSE_DEFS[44], PARSE_DEFS[44], PARSE_DEFS[44], PARSE_DEFS[44], PARSE_DEFS[75],503 PARSE_DEFS[64], PARSE_DEFS[76], PARSE_DEFS[44], PARSE_DEFS[44], PARSE_DEFS[44],504 PARSE_DEFS[44], PARSE_DEFS[44], PARSE_DEFS[65], PARSE_DEFS[66], PARSE_DEFS[67],505 PARSE_DEFS[68], PARSE_DEFS[69], PARSE_DEFS[70], PARSE_DEFS[44], PARSE_DEFS[44],506 PARSE_DEFS[71], PARSE_DEFS[72], PARSE_DEFS[74], PARSE_DEFS[73], PARSE_DEFS[44],507 PARSE_DEFS[44], PARSE_DEFS[44]],508 [PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[78], PARSE_DEFS[39],509 PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39],510 PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39],511 PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39],512 PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39],513 PARSE_DEFS[39], PARSE_DEFS[77]],514 [PARSE_DEFS[79], PARSE_DEFS[80], PARSE_DEFS[81], PARSE_DEFS[33], PARSE_DEFS[33],515 PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],516 PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],517 PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],518 PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],519 PARSE_DEFS[33], PARSE_DEFS[77]],520 [PARSE_DEFS[82], PARSE_DEFS[82], PARSE_DEFS[82], PARSE_DEFS[82], PARSE_DEFS[82],521 PARSE_DEFS[82], PARSE_DEFS[82], PARSE_DEFS[84], PARSE_DEFS[83], PARSE_DEFS[82],522 PARSE_DEFS[82], PARSE_DEFS[82], PARSE_DEFS[82], PARSE_DEFS[82], PARSE_DEFS[82],523 PARSE_DEFS[82], PARSE_DEFS[82], PARSE_DEFS[82], PARSE_DEFS[82], PARSE_DEFS[82],524 PARSE_DEFS[82], PARSE_DEFS[82], PARSE_DEFS[82], PARSE_DEFS[82], PARSE_DEFS[82],525 PARSE_DEFS[82], PARSE_DEFS[82]],526 [PARSE_DEFS[85], PARSE_DEFS[85], PARSE_DEFS[85], PARSE_DEFS[85], PARSE_DEFS[85],527 PARSE_DEFS[85], PARSE_DEFS[85], PARSE_DEFS[84], PARSE_DEFS[85], PARSE_DEFS[85],528 PARSE_DEFS[85], PARSE_DEFS[85], PARSE_DEFS[85], PARSE_DEFS[85], PARSE_DEFS[85],529 PARSE_DEFS[85], PARSE_DEFS[85], PARSE_DEFS[85], PARSE_DEFS[86], PARSE_DEFS[87],530 PARSE_DEFS[85], PARSE_DEFS[85], PARSE_DEFS[85], PARSE_DEFS[85], PARSE_DEFS[85],531 PARSE_DEFS[85], PARSE_DEFS[85]],532 [PARSE_DEFS[85], PARSE_DEFS[85], PARSE_DEFS[85], PARSE_DEFS[85], PARSE_DEFS[85],533 PARSE_DEFS[85], PARSE_DEFS[85], PARSE_DEFS[85], PARSE_DEFS[85], PARSE_DEFS[85],534 PARSE_DEFS[85], PARSE_DEFS[85], PARSE_DEFS[85], PARSE_DEFS[85], PARSE_DEFS[85],535 PARSE_DEFS[85], PARSE_DEFS[85], PARSE_DEFS[85], PARSE_DEFS[88], PARSE_DEFS[89],536 PARSE_DEFS[85], PARSE_DEFS[85], PARSE_DEFS[85], PARSE_DEFS[85], PARSE_DEFS[85],537 PARSE_DEFS[85], PARSE_DEFS[85]],538 [PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39],539 PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39],540 PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39],541 PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[91], PARSE_DEFS[92],542 PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39],543 PARSE_DEFS[39], PARSE_DEFS[90]],544 [PARSE_DEFS[93], PARSE_DEFS[94], PARSE_DEFS[95], PARSE_DEFS[33], PARSE_DEFS[33],545 PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],546 PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],547 PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],548 PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],549 PARSE_DEFS[33], PARSE_DEFS[90]],...

Full Screen

Full Screen

qasm3subListener.py

Source:qasm3subListener.py Github

copy

Full Screen

1# Generated from qasm3sub.g4 by ANTLR 4.9.22from antlr4 import *3if __name__ is not None and "." in __name__:4 from .qasm3subParser import qasm3subParser5else:6 from qasm3subParser import qasm3subParser7# This class defines a complete listener for a parse tree produced by qasm3subParser.8class qasm3subListener(ParseTreeListener):9 # Enter a parse tree produced by qasm3subParser#program.10 def enterProgram(self, ctx:qasm3subParser.ProgramContext):11 pass12 # Exit a parse tree produced by qasm3subParser#program.13 def exitProgram(self, ctx:qasm3subParser.ProgramContext):14 pass15 # Enter a parse tree produced by qasm3subParser#header.16 def enterHeader(self, ctx:qasm3subParser.HeaderContext):17 pass18 # Exit a parse tree produced by qasm3subParser#header.19 def exitHeader(self, ctx:qasm3subParser.HeaderContext):20 pass21 # Enter a parse tree produced by qasm3subParser#version.22 def enterVersion(self, ctx:qasm3subParser.VersionContext):23 pass24 # Exit a parse tree produced by qasm3subParser#version.25 def exitVersion(self, ctx:qasm3subParser.VersionContext):26 pass27 # Enter a parse tree produced by qasm3subParser#include.28 def enterInclude(self, ctx:qasm3subParser.IncludeContext):29 pass30 # Exit a parse tree produced by qasm3subParser#include.31 def exitInclude(self, ctx:qasm3subParser.IncludeContext):32 pass33 # Enter a parse tree produced by qasm3subParser#globalStatement.34 def enterGlobalStatement(self, ctx:qasm3subParser.GlobalStatementContext):35 pass36 # Exit a parse tree produced by qasm3subParser#globalStatement.37 def exitGlobalStatement(self, ctx:qasm3subParser.GlobalStatementContext):38 pass39 # Enter a parse tree produced by qasm3subParser#statement.40 def enterStatement(self, ctx:qasm3subParser.StatementContext):41 pass42 # Exit a parse tree produced by qasm3subParser#statement.43 def exitStatement(self, ctx:qasm3subParser.StatementContext):44 pass45 # Enter a parse tree produced by qasm3subParser#quantumDeclarationStatement.46 def enterQuantumDeclarationStatement(self, ctx:qasm3subParser.QuantumDeclarationStatementContext):47 pass48 # Exit a parse tree produced by qasm3subParser#quantumDeclarationStatement.49 def exitQuantumDeclarationStatement(self, ctx:qasm3subParser.QuantumDeclarationStatementContext):50 pass51 # Enter a parse tree produced by qasm3subParser#classicalDeclarationStatement.52 def enterClassicalDeclarationStatement(self, ctx:qasm3subParser.ClassicalDeclarationStatementContext):53 pass54 # Exit a parse tree produced by qasm3subParser#classicalDeclarationStatement.55 def exitClassicalDeclarationStatement(self, ctx:qasm3subParser.ClassicalDeclarationStatementContext):56 pass57 # Enter a parse tree produced by qasm3subParser#classicalAssignment.58 def enterClassicalAssignment(self, ctx:qasm3subParser.ClassicalAssignmentContext):59 pass60 # Exit a parse tree produced by qasm3subParser#classicalAssignment.61 def exitClassicalAssignment(self, ctx:qasm3subParser.ClassicalAssignmentContext):62 pass63 # Enter a parse tree produced by qasm3subParser#assignmentStatement.64 def enterAssignmentStatement(self, ctx:qasm3subParser.AssignmentStatementContext):65 pass66 # Exit a parse tree produced by qasm3subParser#assignmentStatement.67 def exitAssignmentStatement(self, ctx:qasm3subParser.AssignmentStatementContext):68 pass69 # Enter a parse tree produced by qasm3subParser#returnSignature.70 def enterReturnSignature(self, ctx:qasm3subParser.ReturnSignatureContext):71 pass72 # Exit a parse tree produced by qasm3subParser#returnSignature.73 def exitReturnSignature(self, ctx:qasm3subParser.ReturnSignatureContext):74 pass75 # Enter a parse tree produced by qasm3subParser#designator.76 def enterDesignator(self, ctx:qasm3subParser.DesignatorContext):77 pass78 # Exit a parse tree produced by qasm3subParser#designator.79 def exitDesignator(self, ctx:qasm3subParser.DesignatorContext):80 pass81 # Enter a parse tree produced by qasm3subParser#doubleDesignator.82 def enterDoubleDesignator(self, ctx:qasm3subParser.DoubleDesignatorContext):83 pass84 # Exit a parse tree produced by qasm3subParser#doubleDesignator.85 def exitDoubleDesignator(self, ctx:qasm3subParser.DoubleDesignatorContext):86 pass87 # Enter a parse tree produced by qasm3subParser#identifierList.88 def enterIdentifierList(self, ctx:qasm3subParser.IdentifierListContext):89 pass90 # Exit a parse tree produced by qasm3subParser#identifierList.91 def exitIdentifierList(self, ctx:qasm3subParser.IdentifierListContext):92 pass93 # Enter a parse tree produced by qasm3subParser#association.94 def enterAssociation(self, ctx:qasm3subParser.AssociationContext):95 pass96 # Exit a parse tree produced by qasm3subParser#association.97 def exitAssociation(self, ctx:qasm3subParser.AssociationContext):98 pass99 # Enter a parse tree produced by qasm3subParser#quantumType.100 def enterQuantumType(self, ctx:qasm3subParser.QuantumTypeContext):101 pass102 # Exit a parse tree produced by qasm3subParser#quantumType.103 def exitQuantumType(self, ctx:qasm3subParser.QuantumTypeContext):104 pass105 # Enter a parse tree produced by qasm3subParser#quantumDeclaration.106 def enterQuantumDeclaration(self, ctx:qasm3subParser.QuantumDeclarationContext):107 pass108 # Exit a parse tree produced by qasm3subParser#quantumDeclaration.109 def exitQuantumDeclaration(self, ctx:qasm3subParser.QuantumDeclarationContext):110 pass111 # Enter a parse tree produced by qasm3subParser#quantumArgument.112 def enterQuantumArgument(self, ctx:qasm3subParser.QuantumArgumentContext):113 pass114 # Exit a parse tree produced by qasm3subParser#quantumArgument.115 def exitQuantumArgument(self, ctx:qasm3subParser.QuantumArgumentContext):116 pass117 # Enter a parse tree produced by qasm3subParser#quantumArgumentList.118 def enterQuantumArgumentList(self, ctx:qasm3subParser.QuantumArgumentListContext):119 pass120 # Exit a parse tree produced by qasm3subParser#quantumArgumentList.121 def exitQuantumArgumentList(self, ctx:qasm3subParser.QuantumArgumentListContext):122 pass123 # Enter a parse tree produced by qasm3subParser#bitType.124 def enterBitType(self, ctx:qasm3subParser.BitTypeContext):125 pass126 # Exit a parse tree produced by qasm3subParser#bitType.127 def exitBitType(self, ctx:qasm3subParser.BitTypeContext):128 pass129 # Enter a parse tree produced by qasm3subParser#singleDesignatorType.130 def enterSingleDesignatorType(self, ctx:qasm3subParser.SingleDesignatorTypeContext):131 pass132 # Exit a parse tree produced by qasm3subParser#singleDesignatorType.133 def exitSingleDesignatorType(self, ctx:qasm3subParser.SingleDesignatorTypeContext):134 pass135 # Enter a parse tree produced by qasm3subParser#doubleDesignatorType.136 def enterDoubleDesignatorType(self, ctx:qasm3subParser.DoubleDesignatorTypeContext):137 pass138 # Exit a parse tree produced by qasm3subParser#doubleDesignatorType.139 def exitDoubleDesignatorType(self, ctx:qasm3subParser.DoubleDesignatorTypeContext):140 pass141 # Enter a parse tree produced by qasm3subParser#noDesignatorType.142 def enterNoDesignatorType(self, ctx:qasm3subParser.NoDesignatorTypeContext):143 pass144 # Exit a parse tree produced by qasm3subParser#noDesignatorType.145 def exitNoDesignatorType(self, ctx:qasm3subParser.NoDesignatorTypeContext):146 pass147 # Enter a parse tree produced by qasm3subParser#classicalType.148 def enterClassicalType(self, ctx:qasm3subParser.ClassicalTypeContext):149 pass150 # Exit a parse tree produced by qasm3subParser#classicalType.151 def exitClassicalType(self, ctx:qasm3subParser.ClassicalTypeContext):152 pass153 # Enter a parse tree produced by qasm3subParser#constantDeclaration.154 def enterConstantDeclaration(self, ctx:qasm3subParser.ConstantDeclarationContext):155 pass156 # Exit a parse tree produced by qasm3subParser#constantDeclaration.157 def exitConstantDeclaration(self, ctx:qasm3subParser.ConstantDeclarationContext):158 pass159 # Enter a parse tree produced by qasm3subParser#singleDesignatorDeclaration.160 def enterSingleDesignatorDeclaration(self, ctx:qasm3subParser.SingleDesignatorDeclarationContext):161 pass162 # Exit a parse tree produced by qasm3subParser#singleDesignatorDeclaration.163 def exitSingleDesignatorDeclaration(self, ctx:qasm3subParser.SingleDesignatorDeclarationContext):164 pass165 # Enter a parse tree produced by qasm3subParser#doubleDesignatorDeclaration.166 def enterDoubleDesignatorDeclaration(self, ctx:qasm3subParser.DoubleDesignatorDeclarationContext):167 pass168 # Exit a parse tree produced by qasm3subParser#doubleDesignatorDeclaration.169 def exitDoubleDesignatorDeclaration(self, ctx:qasm3subParser.DoubleDesignatorDeclarationContext):170 pass171 # Enter a parse tree produced by qasm3subParser#noDesignatorDeclaration.172 def enterNoDesignatorDeclaration(self, ctx:qasm3subParser.NoDesignatorDeclarationContext):173 pass174 # Exit a parse tree produced by qasm3subParser#noDesignatorDeclaration.175 def exitNoDesignatorDeclaration(self, ctx:qasm3subParser.NoDesignatorDeclarationContext):176 pass177 # Enter a parse tree produced by qasm3subParser#bitDeclaration.178 def enterBitDeclaration(self, ctx:qasm3subParser.BitDeclarationContext):179 pass180 # Exit a parse tree produced by qasm3subParser#bitDeclaration.181 def exitBitDeclaration(self, ctx:qasm3subParser.BitDeclarationContext):182 pass183 # Enter a parse tree produced by qasm3subParser#classicalDeclaration.184 def enterClassicalDeclaration(self, ctx:qasm3subParser.ClassicalDeclarationContext):185 pass186 # Exit a parse tree produced by qasm3subParser#classicalDeclaration.187 def exitClassicalDeclaration(self, ctx:qasm3subParser.ClassicalDeclarationContext):188 pass189 # Enter a parse tree produced by qasm3subParser#classicalArgument.190 def enterClassicalArgument(self, ctx:qasm3subParser.ClassicalArgumentContext):191 pass192 # Exit a parse tree produced by qasm3subParser#classicalArgument.193 def exitClassicalArgument(self, ctx:qasm3subParser.ClassicalArgumentContext):194 pass195 # Enter a parse tree produced by qasm3subParser#classicalArgumentList.196 def enterClassicalArgumentList(self, ctx:qasm3subParser.ClassicalArgumentListContext):197 pass198 # Exit a parse tree produced by qasm3subParser#classicalArgumentList.199 def exitClassicalArgumentList(self, ctx:qasm3subParser.ClassicalArgumentListContext):200 pass201 # Enter a parse tree produced by qasm3subParser#aliasStatement.202 def enterAliasStatement(self, ctx:qasm3subParser.AliasStatementContext):203 pass204 # Exit a parse tree produced by qasm3subParser#aliasStatement.205 def exitAliasStatement(self, ctx:qasm3subParser.AliasStatementContext):206 pass207 # Enter a parse tree produced by qasm3subParser#indexIdentifier.208 def enterIndexIdentifier(self, ctx:qasm3subParser.IndexIdentifierContext):209 pass210 # Exit a parse tree produced by qasm3subParser#indexIdentifier.211 def exitIndexIdentifier(self, ctx:qasm3subParser.IndexIdentifierContext):212 pass213 # Enter a parse tree produced by qasm3subParser#indexIdentifierList.214 def enterIndexIdentifierList(self, ctx:qasm3subParser.IndexIdentifierListContext):215 pass216 # Exit a parse tree produced by qasm3subParser#indexIdentifierList.217 def exitIndexIdentifierList(self, ctx:qasm3subParser.IndexIdentifierListContext):218 pass219 # Enter a parse tree produced by qasm3subParser#indexEqualsAssignmentList.220 def enterIndexEqualsAssignmentList(self, ctx:qasm3subParser.IndexEqualsAssignmentListContext):221 pass222 # Exit a parse tree produced by qasm3subParser#indexEqualsAssignmentList.223 def exitIndexEqualsAssignmentList(self, ctx:qasm3subParser.IndexEqualsAssignmentListContext):224 pass225 # Enter a parse tree produced by qasm3subParser#rangeDefinition.226 def enterRangeDefinition(self, ctx:qasm3subParser.RangeDefinitionContext):227 pass228 # Exit a parse tree produced by qasm3subParser#rangeDefinition.229 def exitRangeDefinition(self, ctx:qasm3subParser.RangeDefinitionContext):230 pass231 # Enter a parse tree produced by qasm3subParser#quantumGateDefinition.232 def enterQuantumGateDefinition(self, ctx:qasm3subParser.QuantumGateDefinitionContext):233 pass234 # Exit a parse tree produced by qasm3subParser#quantumGateDefinition.235 def exitQuantumGateDefinition(self, ctx:qasm3subParser.QuantumGateDefinitionContext):236 pass237 # Enter a parse tree produced by qasm3subParser#quantumGateSignature.238 def enterQuantumGateSignature(self, ctx:qasm3subParser.QuantumGateSignatureContext):239 pass240 # Exit a parse tree produced by qasm3subParser#quantumGateSignature.241 def exitQuantumGateSignature(self, ctx:qasm3subParser.QuantumGateSignatureContext):242 pass243 # Enter a parse tree produced by qasm3subParser#quantumBlock.244 def enterQuantumBlock(self, ctx:qasm3subParser.QuantumBlockContext):245 pass246 # Exit a parse tree produced by qasm3subParser#quantumBlock.247 def exitQuantumBlock(self, ctx:qasm3subParser.QuantumBlockContext):248 pass249 # Enter a parse tree produced by qasm3subParser#quantumLoop.250 def enterQuantumLoop(self, ctx:qasm3subParser.QuantumLoopContext):251 pass252 # Exit a parse tree produced by qasm3subParser#quantumLoop.253 def exitQuantumLoop(self, ctx:qasm3subParser.QuantumLoopContext):254 pass255 # Enter a parse tree produced by qasm3subParser#quantumLoopBlock.256 def enterQuantumLoopBlock(self, ctx:qasm3subParser.QuantumLoopBlockContext):257 pass258 # Exit a parse tree produced by qasm3subParser#quantumLoopBlock.259 def exitQuantumLoopBlock(self, ctx:qasm3subParser.QuantumLoopBlockContext):260 pass261 # Enter a parse tree produced by qasm3subParser#quantumStatement.262 def enterQuantumStatement(self, ctx:qasm3subParser.QuantumStatementContext):263 pass264 # Exit a parse tree produced by qasm3subParser#quantumStatement.265 def exitQuantumStatement(self, ctx:qasm3subParser.QuantumStatementContext):266 pass267 # Enter a parse tree produced by qasm3subParser#quantumInstruction.268 def enterQuantumInstruction(self, ctx:qasm3subParser.QuantumInstructionContext):269 pass270 # Exit a parse tree produced by qasm3subParser#quantumInstruction.271 def exitQuantumInstruction(self, ctx:qasm3subParser.QuantumInstructionContext):272 pass273 # Enter a parse tree produced by qasm3subParser#quantumPhase.274 def enterQuantumPhase(self, ctx:qasm3subParser.QuantumPhaseContext):275 pass276 # Exit a parse tree produced by qasm3subParser#quantumPhase.277 def exitQuantumPhase(self, ctx:qasm3subParser.QuantumPhaseContext):278 pass279 # Enter a parse tree produced by qasm3subParser#quantumMeasurement.280 def enterQuantumMeasurement(self, ctx:qasm3subParser.QuantumMeasurementContext):281 pass282 # Exit a parse tree produced by qasm3subParser#quantumMeasurement.283 def exitQuantumMeasurement(self, ctx:qasm3subParser.QuantumMeasurementContext):284 pass285 # Enter a parse tree produced by qasm3subParser#quantumMeasurementAssignment.286 def enterQuantumMeasurementAssignment(self, ctx:qasm3subParser.QuantumMeasurementAssignmentContext):287 pass288 # Exit a parse tree produced by qasm3subParser#quantumMeasurementAssignment.289 def exitQuantumMeasurementAssignment(self, ctx:qasm3subParser.QuantumMeasurementAssignmentContext):290 pass291 # Enter a parse tree produced by qasm3subParser#quantumBarrier.292 def enterQuantumBarrier(self, ctx:qasm3subParser.QuantumBarrierContext):293 pass294 # Exit a parse tree produced by qasm3subParser#quantumBarrier.295 def exitQuantumBarrier(self, ctx:qasm3subParser.QuantumBarrierContext):296 pass297 # Enter a parse tree produced by qasm3subParser#quantumGateModifier.298 def enterQuantumGateModifier(self, ctx:qasm3subParser.QuantumGateModifierContext):299 pass300 # Exit a parse tree produced by qasm3subParser#quantumGateModifier.301 def exitQuantumGateModifier(self, ctx:qasm3subParser.QuantumGateModifierContext):302 pass303 # Enter a parse tree produced by qasm3subParser#quantumGateCall.304 def enterQuantumGateCall(self, ctx:qasm3subParser.QuantumGateCallContext):305 pass306 # Exit a parse tree produced by qasm3subParser#quantumGateCall.307 def exitQuantumGateCall(self, ctx:qasm3subParser.QuantumGateCallContext):308 pass309 # Enter a parse tree produced by qasm3subParser#quantumGateName.310 def enterQuantumGateName(self, ctx:qasm3subParser.QuantumGateNameContext):311 pass312 # Exit a parse tree produced by qasm3subParser#quantumGateName.313 def exitQuantumGateName(self, ctx:qasm3subParser.QuantumGateNameContext):314 pass315 # Enter a parse tree produced by qasm3subParser#unaryOperator.316 def enterUnaryOperator(self, ctx:qasm3subParser.UnaryOperatorContext):317 pass318 # Exit a parse tree produced by qasm3subParser#unaryOperator.319 def exitUnaryOperator(self, ctx:qasm3subParser.UnaryOperatorContext):320 pass321 # Enter a parse tree produced by qasm3subParser#relationalOperator.322 def enterRelationalOperator(self, ctx:qasm3subParser.RelationalOperatorContext):323 pass324 # Exit a parse tree produced by qasm3subParser#relationalOperator.325 def exitRelationalOperator(self, ctx:qasm3subParser.RelationalOperatorContext):326 pass327 # Enter a parse tree produced by qasm3subParser#logicalOperator.328 def enterLogicalOperator(self, ctx:qasm3subParser.LogicalOperatorContext):329 pass330 # Exit a parse tree produced by qasm3subParser#logicalOperator.331 def exitLogicalOperator(self, ctx:qasm3subParser.LogicalOperatorContext):332 pass333 # Enter a parse tree produced by qasm3subParser#expressionStatement.334 def enterExpressionStatement(self, ctx:qasm3subParser.ExpressionStatementContext):335 pass336 # Exit a parse tree produced by qasm3subParser#expressionStatement.337 def exitExpressionStatement(self, ctx:qasm3subParser.ExpressionStatementContext):338 pass339 # Enter a parse tree produced by qasm3subParser#expression.340 def enterExpression(self, ctx:qasm3subParser.ExpressionContext):341 pass342 # Exit a parse tree produced by qasm3subParser#expression.343 def exitExpression(self, ctx:qasm3subParser.ExpressionContext):344 pass345 # Enter a parse tree produced by qasm3subParser#xOrExpression.346 def enterXOrExpression(self, ctx:qasm3subParser.XOrExpressionContext):347 pass348 # Exit a parse tree produced by qasm3subParser#xOrExpression.349 def exitXOrExpression(self, ctx:qasm3subParser.XOrExpressionContext):350 pass351 # Enter a parse tree produced by qasm3subParser#bitAndExpression.352 def enterBitAndExpression(self, ctx:qasm3subParser.BitAndExpressionContext):353 pass354 # Exit a parse tree produced by qasm3subParser#bitAndExpression.355 def exitBitAndExpression(self, ctx:qasm3subParser.BitAndExpressionContext):356 pass357 # Enter a parse tree produced by qasm3subParser#bitShiftExpression.358 def enterBitShiftExpression(self, ctx:qasm3subParser.BitShiftExpressionContext):359 pass360 # Exit a parse tree produced by qasm3subParser#bitShiftExpression.361 def exitBitShiftExpression(self, ctx:qasm3subParser.BitShiftExpressionContext):362 pass363 # Enter a parse tree produced by qasm3subParser#additiveExpression.364 def enterAdditiveExpression(self, ctx:qasm3subParser.AdditiveExpressionContext):365 pass366 # Exit a parse tree produced by qasm3subParser#additiveExpression.367 def exitAdditiveExpression(self, ctx:qasm3subParser.AdditiveExpressionContext):368 pass369 # Enter a parse tree produced by qasm3subParser#multiplicativeExpression.370 def enterMultiplicativeExpression(self, ctx:qasm3subParser.MultiplicativeExpressionContext):371 pass372 # Exit a parse tree produced by qasm3subParser#multiplicativeExpression.373 def exitMultiplicativeExpression(self, ctx:qasm3subParser.MultiplicativeExpressionContext):374 pass375 # Enter a parse tree produced by qasm3subParser#unaryExpression.376 def enterUnaryExpression(self, ctx:qasm3subParser.UnaryExpressionContext):377 pass378 # Exit a parse tree produced by qasm3subParser#unaryExpression.379 def exitUnaryExpression(self, ctx:qasm3subParser.UnaryExpressionContext):380 pass381 # Enter a parse tree produced by qasm3subParser#expressionTerminator.382 def enterExpressionTerminator(self, ctx:qasm3subParser.ExpressionTerminatorContext):383 pass384 # Exit a parse tree produced by qasm3subParser#expressionTerminator.385 def exitExpressionTerminator(self, ctx:qasm3subParser.ExpressionTerminatorContext):386 pass387 # Enter a parse tree produced by qasm3subParser#incrementor.388 def enterIncrementor(self, ctx:qasm3subParser.IncrementorContext):389 pass390 # Exit a parse tree produced by qasm3subParser#incrementor.391 def exitIncrementor(self, ctx:qasm3subParser.IncrementorContext):392 pass393 # Enter a parse tree produced by qasm3subParser#builtInCall.394 def enterBuiltInCall(self, ctx:qasm3subParser.BuiltInCallContext):395 pass396 # Exit a parse tree produced by qasm3subParser#builtInCall.397 def exitBuiltInCall(self, ctx:qasm3subParser.BuiltInCallContext):398 pass399 # Enter a parse tree produced by qasm3subParser#builtInMath.400 def enterBuiltInMath(self, ctx:qasm3subParser.BuiltInMathContext):401 pass402 # Exit a parse tree produced by qasm3subParser#builtInMath.403 def exitBuiltInMath(self, ctx:qasm3subParser.BuiltInMathContext):404 pass405 # Enter a parse tree produced by qasm3subParser#castOperator.406 def enterCastOperator(self, ctx:qasm3subParser.CastOperatorContext):407 pass408 # Exit a parse tree produced by qasm3subParser#castOperator.409 def exitCastOperator(self, ctx:qasm3subParser.CastOperatorContext):410 pass411 # Enter a parse tree produced by qasm3subParser#expressionList.412 def enterExpressionList(self, ctx:qasm3subParser.ExpressionListContext):413 pass414 # Exit a parse tree produced by qasm3subParser#expressionList.415 def exitExpressionList(self, ctx:qasm3subParser.ExpressionListContext):416 pass417 # Enter a parse tree produced by qasm3subParser#booleanExpression.418 def enterBooleanExpression(self, ctx:qasm3subParser.BooleanExpressionContext):419 pass420 # Exit a parse tree produced by qasm3subParser#booleanExpression.421 def exitBooleanExpression(self, ctx:qasm3subParser.BooleanExpressionContext):422 pass423 # Enter a parse tree produced by qasm3subParser#comparisonExpression.424 def enterComparisonExpression(self, ctx:qasm3subParser.ComparisonExpressionContext):425 pass426 # Exit a parse tree produced by qasm3subParser#comparisonExpression.427 def exitComparisonExpression(self, ctx:qasm3subParser.ComparisonExpressionContext):428 pass429 # Enter a parse tree produced by qasm3subParser#equalsExpression.430 def enterEqualsExpression(self, ctx:qasm3subParser.EqualsExpressionContext):431 pass432 # Exit a parse tree produced by qasm3subParser#equalsExpression.433 def exitEqualsExpression(self, ctx:qasm3subParser.EqualsExpressionContext):434 pass435 # Enter a parse tree produced by qasm3subParser#assignmentOperator.436 def enterAssignmentOperator(self, ctx:qasm3subParser.AssignmentOperatorContext):437 pass438 # Exit a parse tree produced by qasm3subParser#assignmentOperator.439 def exitAssignmentOperator(self, ctx:qasm3subParser.AssignmentOperatorContext):440 pass441 # Enter a parse tree produced by qasm3subParser#equalsAssignmentList.442 def enterEqualsAssignmentList(self, ctx:qasm3subParser.EqualsAssignmentListContext):443 pass444 # Exit a parse tree produced by qasm3subParser#equalsAssignmentList.445 def exitEqualsAssignmentList(self, ctx:qasm3subParser.EqualsAssignmentListContext):446 pass447 # Enter a parse tree produced by qasm3subParser#membershipTest.448 def enterMembershipTest(self, ctx:qasm3subParser.MembershipTestContext):449 pass450 # Exit a parse tree produced by qasm3subParser#membershipTest.451 def exitMembershipTest(self, ctx:qasm3subParser.MembershipTestContext):452 pass453 # Enter a parse tree produced by qasm3subParser#setDeclaration.454 def enterSetDeclaration(self, ctx:qasm3subParser.SetDeclarationContext):455 pass456 # Exit a parse tree produced by qasm3subParser#setDeclaration.457 def exitSetDeclaration(self, ctx:qasm3subParser.SetDeclarationContext):458 pass459 # Enter a parse tree produced by qasm3subParser#programBlock.460 def enterProgramBlock(self, ctx:qasm3subParser.ProgramBlockContext):461 pass462 # Exit a parse tree produced by qasm3subParser#programBlock.463 def exitProgramBlock(self, ctx:qasm3subParser.ProgramBlockContext):464 pass465 # Enter a parse tree produced by qasm3subParser#branchingStatement.466 def enterBranchingStatement(self, ctx:qasm3subParser.BranchingStatementContext):467 pass468 # Exit a parse tree produced by qasm3subParser#branchingStatement.469 def exitBranchingStatement(self, ctx:qasm3subParser.BranchingStatementContext):470 pass471 # Enter a parse tree produced by qasm3subParser#loopSignature.472 def enterLoopSignature(self, ctx:qasm3subParser.LoopSignatureContext):473 pass474 # Exit a parse tree produced by qasm3subParser#loopSignature.475 def exitLoopSignature(self, ctx:qasm3subParser.LoopSignatureContext):476 pass477 # Enter a parse tree produced by qasm3subParser#loopStatement.478 def enterLoopStatement(self, ctx:qasm3subParser.LoopStatementContext):479 pass480 # Exit a parse tree produced by qasm3subParser#loopStatement.481 def exitLoopStatement(self, ctx:qasm3subParser.LoopStatementContext):482 pass483 # Enter a parse tree produced by qasm3subParser#controlDirectiveStatement.484 def enterControlDirectiveStatement(self, ctx:qasm3subParser.ControlDirectiveStatementContext):485 pass486 # Exit a parse tree produced by qasm3subParser#controlDirectiveStatement.487 def exitControlDirectiveStatement(self, ctx:qasm3subParser.ControlDirectiveStatementContext):488 pass489 # Enter a parse tree produced by qasm3subParser#controlDirective.490 def enterControlDirective(self, ctx:qasm3subParser.ControlDirectiveContext):491 pass492 # Exit a parse tree produced by qasm3subParser#controlDirective.493 def exitControlDirective(self, ctx:qasm3subParser.ControlDirectiveContext):494 pass495 # Enter a parse tree produced by qasm3subParser#subroutineDefinition.496 def enterSubroutineDefinition(self, ctx:qasm3subParser.SubroutineDefinitionContext):497 pass498 # Exit a parse tree produced by qasm3subParser#subroutineDefinition.499 def exitSubroutineDefinition(self, ctx:qasm3subParser.SubroutineDefinitionContext):500 pass501 # Enter a parse tree produced by qasm3subParser#returnStatement.502 def enterReturnStatement(self, ctx:qasm3subParser.ReturnStatementContext):503 pass504 # Exit a parse tree produced by qasm3subParser#returnStatement.505 def exitReturnStatement(self, ctx:qasm3subParser.ReturnStatementContext):506 pass507 # Enter a parse tree produced by qasm3subParser#subroutineBlock.508 def enterSubroutineBlock(self, ctx:qasm3subParser.SubroutineBlockContext):509 pass510 # Exit a parse tree produced by qasm3subParser#subroutineBlock.511 def exitSubroutineBlock(self, ctx:qasm3subParser.SubroutineBlockContext):512 pass513 # Enter a parse tree produced by qasm3subParser#subroutineCall.514 def enterSubroutineCall(self, ctx:qasm3subParser.SubroutineCallContext):515 pass516 # Exit a parse tree produced by qasm3subParser#subroutineCall.517 def exitSubroutineCall(self, ctx:qasm3subParser.SubroutineCallContext):518 pass519 # Enter a parse tree produced by qasm3subParser#pragma.520 def enterPragma(self, ctx:qasm3subParser.PragmaContext):521 pass522 # Exit a parse tree produced by qasm3subParser#pragma.523 def exitPragma(self, ctx:qasm3subParser.PragmaContext):524 pass...

Full Screen

Full Screen

tsmells2gdfTest.py

Source:tsmells2gdfTest.py Github

copy

Full Screen

...27SMELL_NODE_COLOR = "red"28class RootTest(TestCase):29 ''' abstract root test'''30 def verifyParse(self, parser, toParse, key, location):31 parser.parse(toParse)32 self.assertTrue(parser.hasKey(key))33 self.assertEquals(location, parser.getLocation(key))34 def verifyGenerateNodes(self, generator, expNode):35 generator.parse(self.toParse)36 nodes = generator.generateNodes()37 self.assertEquals(1, len(nodes))38 self.assertTrue(expNode in nodes)39 def verifyGenerateMultiNodes(self, generator, expNode, expNode2, line1, line2):40 generator.parse(line1)41 generator.parse(line2)42 nodes = generator.generateNodes()43 self.assertEquals(2, len(nodes))44 self.assertTrue(expNode in nodes)45 self.assertTrue(expNode2 in nodes)46 def verifyAppendLocationInfo(self, generator, key, toParse, location):47 generator.parse(toParse)48 srcDict = {}49 generator.appendLocationInfo(srcDict)50 self.assertEqual(1, len(srcDict))51 self.assertTrue(key in srcDict)52 self.assertTrue(self.location in srcDict[key])53 def verifyAppendMetricsInfo(self, generator, identif, toParse, metricVal):54 generator.parse(self.toParse)55 metricDict = self.setupMetricDict()56 generator.appendMetricInfo(metricDict)57 self.assertTrue(identif in metricDict)58 metrics = metricDict[identif]59 self.assertEquals(1, len(metrics), \60 "Should contain a single indentedtest metric dict")61 self.assertTrue(identif + "0" in metrics)62 metrics = metrics[identif + "0"]63 for name, val in metricVal:64 self.assertEquals(val, metrics[name]) 65 def setupMetricDict(self):66 metricDict = {}67 metricDict['Translation'] = {}68 return metricDict69 70class TestCasesTest(RootTest):71 def setUp(self):72 self.cases = TestCases()73 self.toParse = ["TestCase","FooTest","FooTest.java","2"]74 self.key = "FooTest"75 self.location = ("FooTest.java", 2)76 self.edgeColor = "lightgray"77 self.expNode = Node(name=self.key, color="black",\78 label=self.key, entity="testcase", \79 style=1, isSrcEnt=1)80 def testParse(self):81 self.verifyParse(self.cases, self.toParse, self.key, self.location)82 def testParsePkged(self):83 toParse = ["TestCase","pkg::FooTest","pkg/FooTest.java","2"]84 key = "pkg::FooTest"85 location = ("pkg/FooTest.java", 2)86 self.cases.parse(toParse)87 self.assertTrue(self.cases.pkgDict.has_key('pkg'))88 self.assertEquals(['pkg::FooTest'], self.cases.pkgDict['pkg'])89 def testParseDefaultPkg(self):90 self.verifyParseModule('FooTest', 'FooTest.java', 'default')91 def testParseModule(self):92 self.verifyParseModule('FooTest', "module/FooTest.cpp", 'module')93 def testParseModule2(self):94 self.verifyParseModule('FooTest', "testmessenger/FooTest.java", 'testmessenger')95 def testParseMultiLevelModule(self):96 self.verifyParseModule('FooTest', 'module/test/stuff/FooTest.cpp', 'module::test::stuff')97 def testParseModuleSkipSrc(self):98 # remove trailing 'src' from a module99 self.verifyParseModule('FooTest', 'module/test/src/FooTest.cpp', 'module::test')100 def verifyParseModule(self, clazz, file, module):101 self.toParse[2] = file102 self.cases.parse(self.toParse)103 self.assertTrue(self.cases.pkgDict.has_key(module), \104 module + " not in " + str(self.cases.pkgDict))105 self.assertEquals([clazz], self.cases.pkgDict[module])106 def buildDefaultPkgNode(self):107 return Node('default', 'black', 'package', 'default', 1)108 def testGenerateNodes(self):109 self.cases.parse(self.toParse)110 nodes = self.cases.generateNodes()111 self.assertEquals(2, len(nodes))112 self.assertTrue(self.expNode in nodes)113 self.assertTrue(self.buildDefaultPkgNode() in nodes)114 115 def testGenerateNodesMulti(self):116 self.cases.parse(self.toParse)117 toParse2 = ["TestCase","BarTest","BarTest.java","3"]118 self.cases.parse(toParse2)119 toParse3 = ["TestCase","BazTest","BazTest.java","5"] 120 self.cases.parse(toParse3)121 nodes = self.cases.generateNodes()122 self.assertEquals(4, len(nodes), str([str(node) for node in nodes]))123 self.assertTrue(self.expNode in nodes)124 expNode2 = Node("BarTest", "black", \125 "testcase", "BarTest", 1, isSrcEnt=1)126 expNode3 = Node("BazTest", "black", \127 "testcase","BazTest", 1, isSrcEnt=1)128 self.assertTrue(expNode2 in nodes)129 self.assertTrue(expNode3 in nodes)130 self.assertTrue(self.buildDefaultPkgNode() in nodes)131 def testAppendLocationInfo(self):132 self.verifyAppendLocationInfo(self.cases, self.key, self.toParse, self.location)133class TestCommandsTest(RootTest):134 def setUp(self):135 self.commands = TestCommands()136 self.key = "FooTest.testFoo()"137 self.toParse = ["TestCommand", self.key, "FooTest.java", "10", "FooTest", "4"]138 self.expNode = Node(name=self.key, color="black", label="testFoo()", \139 entity="testcommand", style=2, isSrcEnt=1)140 def testParse(self):141 location = ("FooTest.java", 10)142 self.verifyParse(self.commands, self.toParse, self.key, location)143 self.assertEquals("FooTest", self.commands.getOwner(self.key))144 def testParseMulti(self):145 location = ("FooTest.java", 10)146 self.verifyParse(self.commands, self.toParse, self.key, location)147 148 toParse2 = ["TestCommand", "BazTest.tesBaz()", "BazTest.java", "15", "BazTest", "8"]149 key2 = "BazTest.tesBaz()"150 location2 = ("BazTest.java", 15)151 self.verifyParse(self.commands, toParse2, key2, location2)152 self.assertTrue(self.commands.hasKey(self.key))153 self.assertEquals(location, self.commands.getLocation(self.key))154 self.assertEquals("FooTest", self.commands.getOwner(self.key))155 self.assertEquals("BazTest", self.commands.getOwner(key2))156 def testGenerateNodes(self):157 self.verifyGenerateNodes(self.commands, self.expNode)158class TestHelpersTest(RootTest):159 def setUp(self):160 self.helpers = TestHelpers()161 162 def testParse(self):163 toParse = ["TestHelper", "FooTest.helper()", "FooTest.java", "15", "FooTest", "4"]164 key = "FooTest.helper()"165 location = ("FooTest.java", 15)166 self.verifyParse(self.helpers, toParse, key, location)167 self.assertEquals("FooTest", self.helpers.getOwner(key))168 def testParseParams(self):169 toParse = ["TestHelper", "FooTest.construct(String,Integer)", "FooTest.java", "15", "FooTest", "11"]170 key = "FooTest.construct(String;Integer)"171 location = ("FooTest.java", 15)172 self.verifyParse(self.helpers, toParse, key, location)173 self.assertEquals("FooTest", self.helpers.getOwner(key))174class TestSetupsTest(RootTest):175 def setUp(self):176 self.setups = TestSetups()177 def testParse(self):178 toParse = ["TestSetup", "FooTest.setUp()", "FooTest.java", "15", "FooTest", "15"]179 key = "FooTest.setUp()"180 location = ("FooTest.java", 15)181 self.verifyParse(self.setups, toParse, key, location)182 self.assertEquals("FooTest", self.setups.getOwner(key))183class TestTeardownsTest(RootTest):184 def setUp(self):185 self.teardowns = TestTeardowns()186 def testParse(self):187 toParse = ["TestTeardown", "FooTest.tearDown()", "FooTest.java", "15", "FooTest", "12"]188 key = "FooTest.tearDown()"189 location = ("FooTest.java", 15)190 self.verifyParse(self.teardowns, toParse, key, location)191 self.assertEquals("FooTest", self.teardowns.getOwner(key))192class AssertionLesssTest(RootTest):193 def setUp(self):194 self.assertionlesss = AssertionLesss()195 self.key = "FooTest.testFoo()" 196 self.toParse = ["AssertionLess", self.key, "FooTest.java", "25"]197 self.expNode = Node(name="AssertionLess0", color=SMELL_NODE_COLOR,\198 label="AssertionLess", entity="smell", \199 style=3)200 def testParse(self):201 location = ("FooTest.java", 25)202 self.verifyParse(self.assertionlesss, self.toParse, self.key, location)203 def testGenerateNodes(self):204 self.verifyGenerateNodes(self.assertionlesss, self.expNode)205class AssertionRoulettesTest(RootTest):206 def setUp(self):207 self.assertionroulettes = AssertionRoulettes()208 self.AR = 'AssertionRoulette'209 self.toParse = [ self.AR , "TC", "FooTest.testFoo()", "10", "8", "FooTest.java", "228"]210 211 def testParse(self):212 key = "FooTest.testFoo()"213 location = ("FooTest.java", 228)214 self.verifyParse(self.assertionroulettes, self.toParse, key, location)215 self.assertEquals(10, self.assertionroulettes.getTotalAsserts(key))216 self.assertEquals(8, self.assertionroulettes.getDescriptionlessAsserts(key))217 def testAppendMetrics(self):218 self.verifyAppendMetricsInfo(self.assertionroulettes, self.AR, self.toParse, [('NrA', 10),('NrDA', 8)])219 def testAppendMultiMetrics(self):220 self.assertionroulettes.parse(self.toParse)221 self.toParse2 = [ self.AR, "TH", "BarTest.testBar()", "15", "5", "BarTest.java", "220"]222 self.assertionroulettes.parse(self.toParse)223 self.assertionroulettes.parse(self.toParse2)224 metricDict = self.setupMetricDict()225 self.assertionroulettes.appendMetricInfo(metricDict)226 self.assertTrue(self.AR in metricDict)227 metrics = metricDict[self.AR]228 self.assertEquals(2, len(metrics), str(metrics))229 self.assertEquals({'NrA':10, 'NrDA':8}, metrics[self.AR + '0'])230 self.assertEquals({'NrA':15, 'NrDA':5}, metrics[self.AR + '1'])231class DuplicatedCodesTest(TestCase):232 def setUp(self):233 # GeneralFixture :))234 self.DP = "DuplicatedCode"235 self.duplicatedcodes = DuplicatedCodes()236 self.mtd1 = "BtPieceMessageTest.testChokingEvent_inAmAllowedIndexSet()"237 self.mtd2 = "BtPieceMessageTest.testChokingEvent_somwhere()"238 self.dupLoc1 = ("BtPieceMessageTest.cc", 197, 206)239 self.dupLoc2 = ("BtPieceMessageTest.cc", 183, 193)240 self.toParse = ["DuplicatedCode",\241 self.mtd1, "BtPieceMessageTest.cc", "197", "206", 242 self.mtd2, "BtPieceMessageTest.cc", "183", "193"]243 self.mtd21 = "Faz.testFaz()"244 self.mtd22 = "Boo.testBoo()"245 self.dupLoc21 = ("Faz.cpp", 20, 25)246 self.dupLoc22 = ("Boo.cpp", 30, 35)247 self.toParse2 = ["DuplicatedCode",\248 self.mtd21, "Faz.cpp", 20, 25,\249 self.mtd22, "Boo.cpp", 30, 35]250 def testParse(self):251 self.duplicatedcodes.parse(self.toParse)252 self.assertEquals(1, len(self.duplicatedcodes.duplicates))253 def testParseMulti(self):254 self.duplicatedcodes.parse(self.toParse)255 self.duplicatedcodes.parse(self.toParse2)256 self.assertEquals(2, len(self.duplicatedcodes.duplicates))257 def testAppendLocationInfo(self):258 self.duplicatedcodes.parse(self.toParse)259 locInfo = {}260 self.duplicatedcodes.appendLocationInfo(locInfo)261 self.assertEqual(1, len(locInfo), "Should have a single entry")262 self.assertTrue("DuplicatedCode0" in locInfo)263 entry = locInfo["DuplicatedCode0"]264 self.assertEqual(2, len(entry))265 self.assertTrue(self.dupLoc1 in entry)266 self.assertTrue(self.dupLoc2 in entry)267 def testAppendLocationInfoQuad(self):268 self.mtd3 = "FooTest.testFoo()"269 self.dupLoc3 = ("FooTest.cpp", 20, 25)270 self.mtd4 = "BazTest.testBaz()"271 self.dupLoc4 = ("BazTest.cpp", 30, 35)272 self.toParse.extend([self.mtd3, "FooTest.cpp", 20, 25,\273 self.mtd4, "BazTest.cpp", 30, 35])274 self.duplicatedcodes.parse(self.toParse)275 locInfo = {}276 self.duplicatedcodes.appendLocationInfo(locInfo)277 self.assertEqual(1, len(locInfo))278 self.assertTrue("DuplicatedCode0" in locInfo)279 entry = locInfo["DuplicatedCode0"]280 self.assertEqual(4, len(entry))281 self.assertTrue(self.dupLoc1 in entry)282 self.assertTrue(self.dupLoc2 in entry)283 self.assertTrue(self.dupLoc3 in entry)284 self.assertTrue(self.dupLoc4 in entry)285 def testAppendLocationInfo2Nodes(self):286 self.duplicatedcodes.parse(self.toParse)287 self.duplicatedcodes.parse(self.toParse2)288 locInfo = {}289 self.duplicatedcodes.appendLocationInfo(locInfo)290 self.assertEquals(2, len(locInfo))291 entry0 = locInfo["DuplicatedCode0"]292 entry1 = locInfo["DuplicatedCode1"]293 self.assertEqual(2, len(entry0), "Should be a two-way duplicate")294 self.assertTrue(self.dupLoc1 in entry0)295 self.assertTrue(self.dupLoc2 in entry0)296 self.assertEqual(2, len(entry1), "Should be a two-way duplicate")297 self.assertTrue(self.dupLoc21 in entry1)298 self.assertTrue(self.dupLoc22 in entry1)299 def setUpEdges(self):300 self.edge1 = Edge(self.mtd1, "DuplicatedCode0")301 self.edge2 = Edge(self.mtd2, "DuplicatedCode0")302 def testGenerateEdgesSingleMtd(self):303 self.setUpEdges()304 self.toParse[5] = self.mtd1305 self.duplicatedcodes.parse(self.toParse)306 edges = self.duplicatedcodes.generateEdges()307 self.assertEqual(1, len(edges))308 self.assertTrue(self.edge1 in edges)309 def testGenerateEdgesMultiMtd(self):310 self.setUpEdges()311 self.duplicatedcodes.parse(self.toParse)312 edges = self.duplicatedcodes.generateEdges()313 314 self.assertEqual(2, len(edges))315 self.assertTrue(self.edge1 in edges,\316 str(self.edge1) + "should be in" +str([str(edge) for edge in edges]))317 self.assertTrue(self.edge2 in edges)318 def testCalculateANrSLSingle(self):319 self.dupli = [self.DP, "Foo.foo()", "Foo.java", 2, 10]320 ANrSL = self.duplicatedcodes.calculateANrSL(self.dupli)321 self.assertEquals(ANrSL, 9)322 def testCalculateANrSLDuo(self):323 self.dupli = [self.DP, "Foo.foo()", "Foo.java", 2, 10, \324 "Bar.bar()", "Bar.java", 10, 18]325 ANrSL = self.duplicatedcodes.calculateANrSL(self.dupli)326 self.assertEquals(ANrSL, 9)327 self.dupli = [self.DP, "Foo.foo()", "Foo.java", 2, 10, \328 "Bar.bar()", "Bar.java", 10, 16]329 ANrSL = self.duplicatedcodes.calculateANrSL(self.dupli)330 self.assertEquals(ANrSL, 8)331 def testCalculateANrSLTriple(self):332 self.dupli = [self.DP, "Foo.foo()", "Foo.java", 2, 10, \333 "Bar.bar()", "Bar.java", 10, 16, \334 "Baz.baz()", "Baz.java", 16, 20]335 ANrSL = self.duplicatedcodes.calculateANrSL(self.dupli)336 self.assertEquals(ANrSL, 7)337 def testAppendMetricInfo(self):338 self.duplicatedcodes.parse(self.toParse)339 metricDict = {}340 metricDict['Translation'] = {}341 self.duplicatedcodes.appendMetricInfo(metricDict)342 self.assertTrue(self.DP in metricDict)343 metrics = metricDict[self.DP]344 self.assertEquals(1, len(metrics), \345 "Should contain a single duplicated code metric dict")346 self.assertTrue(self.DP + "0" in metrics)347 metrics = metrics[self.DP + "0"]348 val = self.duplicatedcodes.calculateANrSL(self.toParse)349 self.assertEquals(val, metrics['ANrSL'])350class ForTestersOnlysTest(RootTest):351 def setUp(self):352 self.fortestersonlys = ForTestersOnlys()353 def testParse(self):354 toParse = ["ForTestersOnly","Request.getReferer()","Request.h","111"]355 key = "Request.getReferer()"356 location = ("Request.h", 111)357 self.verifyParse(self.fortestersonlys, toParse, key, location)358class IndentedTestsTest(RootTest):359 def setUp(self):360 self.indentedtests = IndentedTests()361 self.IT = "IndentedTest"362 self.key = "FileTest.testRemove()"363 self.toParse = ["IndentedTest","TC",self.key,"1","FileTest.cc","78"]364 self.location = ("FileTest.cc", 78)365 def testParse(self):366 self.verifyParse(self.indentedtests, self.toParse, self.key, self.location)367 self.assertEquals("TC", self.indentedtests.getType(self.key))368 self.assertEquals(1, self.indentedtests.getCount(self.key))369 def testGenerateNodes(self):370 self.expNode = Node(name="IndentedTest0", color=SMELL_NODE_COLOR, \371 entity="smell", label="IndentedTest", style=3)372 self.verifyGenerateNodes(self.indentedtests, self.expNode)373 def testGenerateEdges(self):374 self.indentedtests.parse(self.toParse)375 edges = self.indentedtests.generateEdges()376 self.expEdge = Edge(node1=self.key, node2="IndentedTest0")377 self.assertEquals(1, len(edges))378 self.assertTrue(self.expEdge in edges,\379 str(self.expEdge) + " should be in " + str([str(edge) for edge in edges]))380 def testAppendLocationInfo(self):381 self.verifyAppendLocationInfo(self.indentedtests, "IndentedTest0", self.toParse, self.location)382 def testAppendMetricsInfo(self):383 self.verifyAppendMetricsInfo(self.indentedtests, self.IT, self.toParse, [('NrCS', 1)])384class IndirectTestsTest(RootTest):385 def setUp(self):386 self.indirecttests = IndirectTests()387 self.toParse = ["IndirectTest","BtDependencyTest.testResolve()","4","5","BtDependencyTest.cc","57"]388 def testParse(self):389 key = "BtDependencyTest.testResolve()"390 location = ("BtDependencyTest.cc", 57)391 self.verifyParse(self.indirecttests, self.toParse, key, location)392 self.assertEquals(4, self.indirecttests.getTreshold(key))393 self.assertEquals(5, self.indirecttests.getNPTU(key))394 def testAppendMetricsInfo(self):395 self.verifyAppendMetricsInfo(self.indirecttests, 'IndirectTest', self.toParse, [('NPTU', 5)])396class EagerTestsTest(RootTest):397 def setUp(self):398 self.eagertests = EagerTests()399 self.toParse = ["EagerTest","FooTest.testFoo()", "5", "6","FooTest.java","89"]400 self.location = ("FooTest.java", 89)401 def testParse(self):402 key = "FooTest.testFoo()"403 self.verifyParse(self.eagertests, self.toParse, key, self.location)404 self.assertEquals(5, self.eagertests.getTreshold(key))405 self.assertEquals(6, self.eagertests.getPTMI(key))406 def setupExpNode(self):407 self.expNode = Node(name="EagerTest0", color=SMELL_NODE_COLOR, \408 entity="smell", label="EagerTest", style=3)409 def testGenerateNodes(self):410 self.setupExpNode()411 self.verifyGenerateNodes(self.eagertests, self.expNode)412 def testGenerateMultiNodes(self):413 self.setupExpNode()414 self.toParse2 = ["EagerTest","FuuTest.testFuu()", "5", "8","FuuTest.java","90"]415 self.expNode2 = Node(name="EagerTest1", color=SMELL_NODE_COLOR,\416 entity="smell", label="EagerTest", style=3)417 self.verifyGenerateMultiNodes(self.eagertests, self.expNode, self.expNode2, self.toParse, self.toParse2)418 def testAppendLocationInfo(self):419 self.verifyAppendLocationInfo(self.eagertests, "EagerTest0", self.toParse, self.location)420 def testAppendMetricsInfo(self):421 self.verifyAppendMetricsInfo(self.eagertests, 'EagerTest', self.toParse, [('PTMI', 6)])422class SensitiveEqualitysTest(RootTest):423 def setUp(self):424 self.sensitiveequalitys = SensitiveEqualitys()425 self.toParse = ["SensitiveEquality", "TC", "BtInterestedMessageTest.testToString()", "1", "BtInterestedMessageTest.cc", "27"]426 427 def testParse(self):428 key = "BtInterestedMessageTest.testToString()"429 location = ("BtInterestedMessageTest.cc", 27)430 self.verifyParse(self.sensitiveequalitys, self.toParse, key, location)431 self.assertEquals(1, self.sensitiveequalitys.getCount(key))432 self.assertEquals("TC", self.sensitiveequalitys.getType(key))433 def testAppendMetricInfo(self):434 self.verifyAppendMetricsInfo(self.sensitiveequalitys, "SensitiveEquality", self.toParse, [('NrTS', 1)])435 def testAppendMetricInfo2(self):436 self.toParse[3] = "10"437 self.verifyAppendMetricsInfo(self.sensitiveequalitys, "SensitiveEquality", self.toParse, [('NrTS', 10)])438class GeneralFixturesTest(RootTest):439 def setUp(self):440 self.generalfixtures = GeneralFixtures()441 self.toParse = ["GeneralFixture","DefaultPackageTest",442 "5","6","10","DefaultPackageTest.java","0"]443 444 def testParse(self):445 self.key = "DefaultPackageTest"446 self.location = ("DefaultPackageTest.java", 0)447 self.verifyParse(self.generalfixtures, self.toParse, self.key, self.location)448 self.assertEquals(5, self.generalfixtures.getNFOB(self.key))449 self.assertEquals(6, self.generalfixtures.getNFPT(self.key))450 self.assertEquals(10, self.generalfixtures.getNOBU(self.key))451 def testAppendMetricInfo(self):452 self.verifyAppendMetricsInfo(self.generalfixtures, "GeneralFixture", self.toParse, \453 [('NFOB', 5), ('NFPT', 6), ('NOBU', 10)])454 def testAppendMetricInfo2(self):455 self.toParse[2] = "8"456 self.toParse[3] = "3"457 self.toParse[4] = "20"458 self.verifyAppendMetricsInfo(self.generalfixtures, "GeneralFixture", self.toParse, \459 [('NFOB', 8), ('NFPT', 3), ('NOBU', 20)])460class MysteryGuestsTest(TestCase):461 def setUp(self):462 self.mysteryguests = MysteryGuests()463 self.command = "MysteryTest.testSomething()"464 self.commandLocation = ("MysteryTest.java", 5)465 self.target = "MyOtherProductionClass.myOtherMethod(String)"466 self.targetLocation = ("MyOtherProductionClass.java",6)467 self.toParse=["MysteryGuest", self.command , "MysteryTest.java", "5",\468 self.target, "MyOtherProductionClass.java","6","file",\469 "java::io::BufferedReader.readLine()"]470 def testParse(self):471 self.mysteryguests.parse(self.toParse)472 def testAppendLocationInfo(self):473 self.mysteryguests.parse(self.toParse)474 srcDict = {}475 self.mysteryguests.appendLocationInfo(srcDict)476 self.assertEquals(1, len(srcDict))477 self.assertTrue("MysteryGuest0" in srcDict)478 self.assertTrue(2, srcDict["MysteryGuest0"])479 val = srcDict["MysteryGuest0"]480 self.assertTrue(self.commandLocation in val)481 self.assertTrue(self.targetLocation in val)482 #def testGenLocationDirectMystery(self):483 #toParse = self.toParse484 #toParse[4] = self.command485 #toParse[5] = self.commandLocation[0]486 #toParse[6] = str(self.commandLocation[1])487 #self.mysteryguests.parse(toParse)488 #locations = self.mysteryguests.generateLocationNodes()489 #self.assertEqual(1, len(locations))490 #self.assertTrue(self.expCmdLocation in locations)491 #def testGenLocationComma(self):492 #toParse = self.toParse493 #toParse[1] = "MysteryTest.someHelper(String,Integer)"494 #self.mysteryguests.parse(toParse)495 #locations = self.mysteryguests.generateLocationNodes()496 #expLocation = LocationNode("srcloc_MysteryTest.someHelper(String;Integer)", self.commandLocation)497 #self.assertEquals(2, len(locations))498 #print locations[0]499 #print expLocation500 #self.assertTrue(expLocation in locations)501class NodeTest(TestCase):502 def testConstructor(self):503 node = Node(name="TestFoo", color="black", entity="testcase", label="TestFoo", style=1)504 self.assertEquals("TestFoo", node.name)505 self.assertEquals("black", node.color)506 self.assertEquals("testcase", node.entity)507 self.assertEquals("TestFoo", node.label)508 self.assertEquals("1", node.style)...

Full Screen

Full Screen

command_parser_test.py

Source:command_parser_test.py Github

copy

Full Screen

1# Copyright 2016 The TensorFlow Authors. All Rights Reserved.2#3# Licensed under the Apache License, Version 2.0 (the "License");4# you may not use this file except in compliance with the License.5# You may obtain a copy of the License at6#7# http://www.apache.org/licenses/LICENSE-2.08#9# Unless required by applicable law or agreed to in writing, software10# distributed under the License is distributed on an "AS IS" BASIS,11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.12# See the License for the specific language governing permissions and13# limitations under the License.14# ==============================================================================15"""Tests for TensorFlow Debugger command parser."""16from __future__ import absolute_import17from __future__ import division18from __future__ import print_function19import sys20from tensorflow.python.debug.cli import command_parser21from tensorflow.python.framework import test_util22from tensorflow.python.platform import googletest23class ParseCommandTest(test_util.TensorFlowTestCase):24 def testParseNoBracketsOrQuotes(self):25 command = ""26 self.assertEqual([], command_parser.parse_command(command))27 command = "a"28 self.assertEqual(["a"], command_parser.parse_command(command))29 command = "foo bar baz qux"30 self.assertEqual(["foo", "bar", "baz", "qux"],31 command_parser.parse_command(command))32 command = "foo bar\tbaz\t qux"33 self.assertEqual(["foo", "bar", "baz", "qux"],34 command_parser.parse_command(command))35 def testParseLeadingTrailingWhitespaces(self):36 command = " foo bar baz qux "37 self.assertEqual(["foo", "bar", "baz", "qux"],38 command_parser.parse_command(command))39 command = "\nfoo bar baz qux\n"40 self.assertEqual(["foo", "bar", "baz", "qux"],41 command_parser.parse_command(command))42 def testParseCommandsWithBrackets(self):43 command = "pt foo[1, 2, :]"44 self.assertEqual(["pt", "foo[1, 2, :]"],45 command_parser.parse_command(command))46 command = "pt foo[1, 2, :] -a"47 self.assertEqual(["pt", "foo[1, 2, :]", "-a"],48 command_parser.parse_command(command))49 command = "inject_value foo [1, 2,:] 0"50 self.assertEqual(["inject_value", "foo", "[1, 2,:]", "0"],51 command_parser.parse_command(command))52 def testParseCommandWithTwoArgsContainingBrackets(self):53 command = "pt foo[1, :] bar[:, 2]"54 self.assertEqual(["pt", "foo[1, :]", "bar[:, 2]"],55 command_parser.parse_command(command))56 command = "pt foo[] bar[:, 2]"57 self.assertEqual(["pt", "foo[]", "bar[:, 2]"],58 command_parser.parse_command(command))59 def testParseCommandWithUnmatchedBracket(self):60 command = "pt foo[1, 2, :"61 self.assertNotEqual(["pt", "foo[1, 2, :]"],62 command_parser.parse_command(command))63 def testParseCommandsWithQuotes(self):64 command = "inject_value foo \"np.zeros([100, 500])\""65 self.assertEqual(["inject_value", "foo", "np.zeros([100, 500])"],66 command_parser.parse_command(command))67 # The pair of double quotes should have been stripped.68 command = "inject_value foo 'np.zeros([100, 500])'"69 self.assertEqual(["inject_value", "foo", "np.zeros([100, 500])"],70 command_parser.parse_command(command))71 # The pair of single quotes should have been stripped.72 command = "\"command prefix with spaces\" arg1"73 self.assertEqual(["command prefix with spaces", "arg1"],74 command_parser.parse_command(command))75 def testParseCommandWithTwoArgsContainingQuotes(self):76 command = "foo \"bar\" \"qux\""77 self.assertEqual(["foo", "bar", "qux"],78 command_parser.parse_command(command))79 command = "foo \"\" \"qux\""80 self.assertEqual(["foo", "", "qux"],81 command_parser.parse_command(command))82class ExtractOutputFilePathTest(test_util.TensorFlowTestCase):83 def testNoOutputFilePathIsReflected(self):84 args, output_path = command_parser.extract_output_file_path(["pt", "a:0"])85 self.assertEqual(["pt", "a:0"], args)86 self.assertIsNone(output_path)87 def testHasOutputFilePathInOneArgsIsReflected(self):88 args, output_path = command_parser.extract_output_file_path(89 ["pt", "a:0", ">/tmp/foo.txt"])90 self.assertEqual(["pt", "a:0"], args)91 self.assertEqual(output_path, "/tmp/foo.txt")92 def testHasOutputFilePathInTwoArgsIsReflected(self):93 args, output_path = command_parser.extract_output_file_path(94 ["pt", "a:0", ">", "/tmp/foo.txt"])95 self.assertEqual(["pt", "a:0"], args)96 self.assertEqual(output_path, "/tmp/foo.txt")97 def testHasGreaterThanSignButNoFileNameCausesSyntaxError(self):98 with self.assertRaisesRegexp(SyntaxError, "Redirect file path is empty"):99 command_parser.extract_output_file_path(100 ["pt", "a:0", ">"])101 def testOutputPathMergedWithLastArgIsHandledCorrectly(self):102 args, output_path = command_parser.extract_output_file_path(103 ["pt", "a:0>/tmp/foo.txt"])104 self.assertEqual(["pt", "a:0"], args)105 self.assertEqual(output_path, "/tmp/foo.txt")106 def testOutputPathInLastArgGreaterThanInSecondLastIsHandledCorrectly(self):107 args, output_path = command_parser.extract_output_file_path(108 ["pt", "a:0>", "/tmp/foo.txt"])109 self.assertEqual(["pt", "a:0"], args)110 self.assertEqual(output_path, "/tmp/foo.txt")111 def testFlagWithEqualGreaterThanShouldIgnoreIntervalFlags(self):112 args, output_path = command_parser.extract_output_file_path(113 ["lp", "--execution_time=>100ms"])114 self.assertEqual(["lp", "--execution_time=>100ms"], args)115 self.assertIsNone(output_path)116 args, output_path = command_parser.extract_output_file_path(117 ["lp", "--execution_time", ">1.2s"])118 self.assertEqual(["lp", "--execution_time", ">1.2s"], args)119 self.assertIsNone(output_path)120 args, output_path = command_parser.extract_output_file_path(121 ["lp", "-e", ">1200"])122 self.assertEqual(["lp", "-e", ">1200"], args)123 self.assertIsNone(output_path)124 args, output_path = command_parser.extract_output_file_path(125 ["lp", "--foo_value", ">-.2MB"])126 self.assertEqual(["lp", "--foo_value", ">-.2MB"], args)127 self.assertIsNone(output_path)128 args, output_path = command_parser.extract_output_file_path(129 ["lp", "--bar_value", ">-42e3GB"])130 self.assertEqual(["lp", "--bar_value", ">-42e3GB"], args)131 self.assertIsNone(output_path)132 args, output_path = command_parser.extract_output_file_path(133 ["lp", "--execution_time", ">=100ms"])134 self.assertEqual(["lp", "--execution_time", ">=100ms"], args)135 self.assertIsNone(output_path)136 args, output_path = command_parser.extract_output_file_path(137 ["lp", "--execution_time=>=100ms"])138 self.assertEqual(["lp", "--execution_time=>=100ms"], args)139 self.assertIsNone(output_path)140 def testFlagWithEqualGreaterThanShouldRecognizeFilePaths(self):141 args, output_path = command_parser.extract_output_file_path(142 ["lp", ">1.2s"])143 self.assertEqual(["lp"], args)144 self.assertEqual("1.2s", output_path)145 args, output_path = command_parser.extract_output_file_path(146 ["lp", "--execution_time", ">x.yms"])147 self.assertEqual(["lp", "--execution_time"], args)148 self.assertEqual("x.yms", output_path)149 args, output_path = command_parser.extract_output_file_path(150 ["lp", "--memory", ">a.1kB"])151 self.assertEqual(["lp", "--memory"], args)152 self.assertEqual("a.1kB", output_path)153 args, output_path = command_parser.extract_output_file_path(154 ["lp", "--memory", ">e002MB"])155 self.assertEqual(["lp", "--memory"], args)156 self.assertEqual("e002MB", output_path)157 def testOneArgumentIsHandledCorrectly(self):158 args, output_path = command_parser.extract_output_file_path(["lt"])159 self.assertEqual(["lt"], args)160 self.assertIsNone(output_path)161 def testEmptyArgumentIsHandledCorrectly(self):162 args, output_path = command_parser.extract_output_file_path([])163 self.assertEqual([], args)164 self.assertIsNone(output_path)165class ParseTensorNameTest(test_util.TensorFlowTestCase):166 def testParseTensorNameWithoutSlicing(self):167 (tensor_name,168 tensor_slicing) = command_parser.parse_tensor_name_with_slicing(169 "hidden/weights/Variable:0")170 self.assertEqual("hidden/weights/Variable:0", tensor_name)171 self.assertEqual("", tensor_slicing)172 def testParseTensorNameWithSlicing(self):173 (tensor_name,174 tensor_slicing) = command_parser.parse_tensor_name_with_slicing(175 "hidden/weights/Variable:0[:, 1]")176 self.assertEqual("hidden/weights/Variable:0", tensor_name)177 self.assertEqual("[:, 1]", tensor_slicing)178class ValidateSlicingStringTest(test_util.TensorFlowTestCase):179 def testValidateValidSlicingStrings(self):180 self.assertTrue(command_parser.validate_slicing_string("[1]"))181 self.assertTrue(command_parser.validate_slicing_string("[2,3]"))182 self.assertTrue(command_parser.validate_slicing_string("[4, 5, 6]"))183 self.assertTrue(command_parser.validate_slicing_string("[7,:, :]"))184 def testValidateInvalidSlicingStrings(self):185 self.assertFalse(command_parser.validate_slicing_string(""))186 self.assertFalse(command_parser.validate_slicing_string("[1,"))187 self.assertFalse(command_parser.validate_slicing_string("2,3]"))188 self.assertFalse(command_parser.validate_slicing_string("[4, foo()]"))189 self.assertFalse(command_parser.validate_slicing_string("[5, bar]"))190class ParseIndicesTest(test_util.TensorFlowTestCase):191 def testParseValidIndicesStringsWithBrackets(self):192 self.assertEqual([0], command_parser.parse_indices("[0]"))193 self.assertEqual([0], command_parser.parse_indices(" [0] "))194 self.assertEqual([-1, 2], command_parser.parse_indices("[-1, 2]"))195 self.assertEqual([3, 4, -5],196 command_parser.parse_indices("[3,4,-5]"))197 def testParseValidIndicesStringsWithoutBrackets(self):198 self.assertEqual([0], command_parser.parse_indices("0"))199 self.assertEqual([0], command_parser.parse_indices(" 0 "))200 self.assertEqual([-1, 2], command_parser.parse_indices("-1, 2"))201 self.assertEqual([3, 4, -5], command_parser.parse_indices("3,4,-5"))202 def testParseInvalidIndicesStringsWithoutBrackets(self):203 with self.assertRaisesRegexp(204 ValueError, r"invalid literal for int\(\) with base 10: 'a'"):205 self.assertEqual([0], command_parser.parse_indices("0,a"))206 with self.assertRaisesRegexp(207 ValueError, r"invalid literal for int\(\) with base 10: '2\]'"):208 self.assertEqual([0], command_parser.parse_indices("1, 2]"))209 with self.assertRaisesRegexp(210 ValueError, r"invalid literal for int\(\) with base 10: ''"):211 self.assertEqual([0], command_parser.parse_indices("3, 4,"))212class ParseRangesTest(test_util.TensorFlowTestCase):213 INF_VALUE = sys.float_info.max214 def testParseEmptyRangeString(self):215 self.assertEqual([], command_parser.parse_ranges(""))216 self.assertEqual([], command_parser.parse_ranges(" "))217 def testParseSingleRange(self):218 self.assertAllClose([[-0.1, 0.2]],219 command_parser.parse_ranges("[-0.1, 0.2]"))220 self.assertAllClose([[-0.1, self.INF_VALUE]],221 command_parser.parse_ranges("[-0.1, inf]"))222 self.assertAllClose([[-self.INF_VALUE, self.INF_VALUE]],223 command_parser.parse_ranges("[-inf, inf]"))224 def testParseSingleListOfRanges(self):225 self.assertAllClose([[-0.1, 0.2], [10.0, 12.0]],226 command_parser.parse_ranges("[[-0.1, 0.2], [10, 12]]"))227 self.assertAllClose(228 [[-self.INF_VALUE, -1.0], [1.0, self.INF_VALUE]],229 command_parser.parse_ranges("[[-inf, -1.0],[1.0, inf]]"))230 def testParseInvalidRangeString(self):231 with self.assertRaises(SyntaxError):232 command_parser.parse_ranges("[[1,2]")233 with self.assertRaisesRegexp(ValueError,234 "Incorrect number of elements in range"):235 command_parser.parse_ranges("[1,2,3]")236 with self.assertRaisesRegexp(ValueError,237 "Incorrect number of elements in range"):238 command_parser.parse_ranges("[inf]")239 with self.assertRaisesRegexp(ValueError,240 "Incorrect type in the 1st element of range"):241 command_parser.parse_ranges("[1j, 1]")242 with self.assertRaisesRegexp(ValueError,243 "Incorrect type in the 2nd element of range"):244 command_parser.parse_ranges("[1, 1j]")245class ParseReadableSizeStrTest(test_util.TensorFlowTestCase):246 def testParseNoUnitWorks(self):247 self.assertEqual(0, command_parser.parse_readable_size_str("0"))248 self.assertEqual(1024, command_parser.parse_readable_size_str("1024 "))249 self.assertEqual(2000, command_parser.parse_readable_size_str(" 2000 "))250 def testParseKiloBytesWorks(self):251 self.assertEqual(0, command_parser.parse_readable_size_str("0kB"))252 self.assertEqual(1024**2, command_parser.parse_readable_size_str("1024 kB"))253 self.assertEqual(1024**2 * 2,254 command_parser.parse_readable_size_str("2048k"))255 self.assertEqual(1024**2 * 2,256 command_parser.parse_readable_size_str("2048kB"))257 self.assertEqual(1024 / 4, command_parser.parse_readable_size_str("0.25k"))258 def testParseMegaBytesWorks(self):259 self.assertEqual(0, command_parser.parse_readable_size_str("0MB"))260 self.assertEqual(1024**3, command_parser.parse_readable_size_str("1024 MB"))261 self.assertEqual(1024**3 * 2,262 command_parser.parse_readable_size_str("2048M"))263 self.assertEqual(1024**3 * 2,264 command_parser.parse_readable_size_str("2048MB"))265 self.assertEqual(1024**2 / 4,266 command_parser.parse_readable_size_str("0.25M"))267 def testParseGigaBytesWorks(self):268 self.assertEqual(0, command_parser.parse_readable_size_str("0GB"))269 self.assertEqual(1024**4, command_parser.parse_readable_size_str("1024 GB"))270 self.assertEqual(1024**4 * 2,271 command_parser.parse_readable_size_str("2048G"))272 self.assertEqual(1024**4 * 2,273 command_parser.parse_readable_size_str("2048GB"))274 self.assertEqual(1024**3 / 4,275 command_parser.parse_readable_size_str("0.25G"))276 def testParseUnsupportedUnitRaisesException(self):277 with self.assertRaisesRegexp(278 ValueError, "Failed to parsed human-readable byte size str: \"0foo\""):279 command_parser.parse_readable_size_str("0foo")280 with self.assertRaisesRegexp(281 ValueError, "Failed to parsed human-readable byte size str: \"2E\""):282 command_parser.parse_readable_size_str("2EB")283class ParseReadableTimeStrTest(test_util.TensorFlowTestCase):284 def testParseNoUnitWorks(self):285 self.assertEqual(0, command_parser.parse_readable_time_str("0"))286 self.assertEqual(100, command_parser.parse_readable_time_str("100 "))287 self.assertEqual(25, command_parser.parse_readable_time_str(" 25 "))288 def testParseSeconds(self):289 self.assertEqual(1e6, command_parser.parse_readable_time_str("1 s"))290 self.assertEqual(2e6, command_parser.parse_readable_time_str("2s"))291 def testParseMicros(self):292 self.assertEqual(2, command_parser.parse_readable_time_str("2us"))293 def testParseMillis(self):294 self.assertEqual(2e3, command_parser.parse_readable_time_str("2ms"))295 def testParseUnsupportedUnitRaisesException(self):296 with self.assertRaisesRegexp(297 ValueError, r".*float.*2us.*"):298 command_parser.parse_readable_time_str("2uss")299 with self.assertRaisesRegexp(300 ValueError, r".*float.*2m.*"):301 command_parser.parse_readable_time_str("2m")302 with self.assertRaisesRegexp(303 ValueError, r"Invalid time -1. Time value must be positive."):304 command_parser.parse_readable_time_str("-1s")305class ParseInterval(test_util.TensorFlowTestCase):306 def testParseTimeInterval(self):307 self.assertEquals(308 command_parser.Interval(10, True, 1e3, True),309 command_parser.parse_time_interval("[10us, 1ms]"))310 self.assertEquals(311 command_parser.Interval(10, False, 1e3, False),312 command_parser.parse_time_interval("(10us, 1ms)"))313 self.assertEquals(314 command_parser.Interval(10, False, 1e3, True),315 command_parser.parse_time_interval("(10us, 1ms]"))316 self.assertEquals(317 command_parser.Interval(10, True, 1e3, False),318 command_parser.parse_time_interval("[10us, 1ms)"))319 self.assertEquals(command_parser.Interval(0, False, 1e3, True),320 command_parser.parse_time_interval("<=1ms"))321 self.assertEquals(322 command_parser.Interval(1e3, True, float("inf"), False),323 command_parser.parse_time_interval(">=1ms"))324 self.assertEquals(command_parser.Interval(0, False, 1e3, False),325 command_parser.parse_time_interval("<1ms"))326 self.assertEquals(327 command_parser.Interval(1e3, False, float("inf"), False),328 command_parser.parse_time_interval(">1ms"))329 def testParseTimeGreaterLessThanWithInvalidValueStrings(self):330 with self.assertRaisesRegexp(ValueError, "Invalid value string after >= "):331 command_parser.parse_time_interval(">=wms")332 with self.assertRaisesRegexp(ValueError, "Invalid value string after > "):333 command_parser.parse_time_interval(">Yms")334 with self.assertRaisesRegexp(ValueError, "Invalid value string after <= "):335 command_parser.parse_time_interval("<= _ms")336 with self.assertRaisesRegexp(ValueError, "Invalid value string after < "):337 command_parser.parse_time_interval("<-ms")338 def testParseTimeIntervalsWithInvalidValueStrings(self):339 with self.assertRaisesRegexp(ValueError, "Invalid first item in interval:"):340 command_parser.parse_time_interval("[wms, 10ms]")341 with self.assertRaisesRegexp(ValueError,342 "Invalid second item in interval:"):343 command_parser.parse_time_interval("[ 0ms, _ms]")344 with self.assertRaisesRegexp(ValueError, "Invalid first item in interval:"):345 command_parser.parse_time_interval("(xms, _ms]")346 with self.assertRaisesRegexp(ValueError, "Invalid first item in interval:"):347 command_parser.parse_time_interval("((3ms, _ms)")348 def testInvalidTimeIntervalRaisesException(self):349 with self.assertRaisesRegexp(350 ValueError,351 r"Invalid interval format: \[10us, 1ms. Valid formats are: "352 r"\[min, max\], \(min, max\), <max, >min"):353 command_parser.parse_time_interval("[10us, 1ms")354 with self.assertRaisesRegexp(355 ValueError,356 r"Incorrect interval format: \[10us, 1ms, 2ms\]. Interval should "357 r"specify two values: \[min, max\] or \(min, max\)"):358 command_parser.parse_time_interval("[10us, 1ms, 2ms]")359 with self.assertRaisesRegexp(360 ValueError,361 r"Invalid interval \[1s, 1ms\]. Start must be before end of interval."):362 command_parser.parse_time_interval("[1s, 1ms]")363 def testParseMemoryInterval(self):364 self.assertEquals(365 command_parser.Interval(1024, True, 2048, True),366 command_parser.parse_memory_interval("[1k, 2k]"))367 self.assertEquals(368 command_parser.Interval(1024, False, 2048, False),369 command_parser.parse_memory_interval("(1kB, 2kB)"))370 self.assertEquals(371 command_parser.Interval(1024, False, 2048, True),372 command_parser.parse_memory_interval("(1k, 2k]"))373 self.assertEquals(374 command_parser.Interval(1024, True, 2048, False),375 command_parser.parse_memory_interval("[1k, 2k)"))376 self.assertEquals(377 command_parser.Interval(0, False, 2048, True),378 command_parser.parse_memory_interval("<=2k"))379 self.assertEquals(380 command_parser.Interval(11, True, float("inf"), False),381 command_parser.parse_memory_interval(">=11"))382 self.assertEquals(command_parser.Interval(0, False, 2048, False),383 command_parser.parse_memory_interval("<2k"))384 self.assertEquals(385 command_parser.Interval(11, False, float("inf"), False),386 command_parser.parse_memory_interval(">11"))387 def testParseMemoryIntervalsWithInvalidValueStrings(self):388 with self.assertRaisesRegexp(ValueError, "Invalid value string after >= "):389 command_parser.parse_time_interval(">=wM")390 with self.assertRaisesRegexp(ValueError, "Invalid value string after > "):391 command_parser.parse_time_interval(">YM")392 with self.assertRaisesRegexp(ValueError, "Invalid value string after <= "):393 command_parser.parse_time_interval("<= _MB")394 with self.assertRaisesRegexp(ValueError, "Invalid value string after < "):395 command_parser.parse_time_interval("<-MB")396 def testInvalidMemoryIntervalRaisesException(self):397 with self.assertRaisesRegexp(398 ValueError,399 r"Invalid interval \[5k, 3k\]. Start of interval must be less than or "400 "equal to end of interval."):401 command_parser.parse_memory_interval("[5k, 3k]")402 def testIntervalContains(self):403 interval = command_parser.Interval(404 start=1, start_included=True, end=10, end_included=True)405 self.assertTrue(interval.contains(1))406 self.assertTrue(interval.contains(10))407 self.assertTrue(interval.contains(5))408 interval.start_included = False409 self.assertFalse(interval.contains(1))410 self.assertTrue(interval.contains(10))411 interval.end_included = False412 self.assertFalse(interval.contains(1))413 self.assertFalse(interval.contains(10))414 interval.start_included = True415 self.assertTrue(interval.contains(1))416 self.assertFalse(interval.contains(10))417if __name__ == "__main__":...

Full Screen

Full Screen

smellentitiez.py

Source:smellentitiez.py Github

copy

Full Screen

...65 cnt += 166class BasicSmellz(Smellz):67 def __init__(self, smellName):68 Smellz.__init__(self, smellName)69 def parse(self, toParse):70 """71 input is a splitted assertionless dump line, eg72 ["AssertionLess", "FooTest.testFoo()", "FooTest.java", "25"]73 pre:74 toParse[0] == self.smellName75 len(toParse) == 476 isSourceLine(toParse[3])77 post:78 self.hasKey(toParse[1])79 self.getLocation(toParse[1]) == (toParse[2], int(toParse[3]))80 """81 self.dict[toParse[1]] = [(toParse[2], int(toParse[3]))]82class AssertionLesss(BasicSmellz):83 def __init__(self):84 BasicSmellz.__init__(self, "AssertionLess")85class EmptyTests(BasicSmellz):86 def __init__(self):87 BasicSmellz.__init__(self, "EmptyTest")88class ForTestersOnlys(BasicSmellz):89 def __init__(self):90 BasicSmellz.__init__(self, "ForTestersOnly")91 def generateEdges(self):92 # disable the edges, temporarily since guess crashes on non-existant nodes93 return []94class AssertionRoulettes(Smellz):95 def __init__(self):96 Smellz.__init__(self, "AssertionRoulette")97 self.nodeColor = "red"98 self.entityType = "smell"99 self.style = SMELL_STYLE100 def parse(self, toParse):101 """102 input is a splitted assertionroulette dump line, eg103 [ "AssertionRoulette", "TC", "FooTest.testFoo()", "10", "8", "FooTest.java", "228"]104 pre:105 toParse[0] == "AssertionRoulette"106 len(toParse) == 7107 isSourceLine(toParse[6])108 isCount(toParse[3])109 isCount(toParse[4])110 int(toParse[3]) >= int(toParse[4])111 post:112 self.hasKey(toParse[2])113 self.getLocation(toParse[2]) == (toParse[5], int(toParse[6]))114 isCount(self.getTotalAsserts(toParse[2]))115 isCount(self.getDescriptionlessAsserts(toParse[2]))116 """117 self.dict[toParse[2]] = [(toParse[5], int(toParse[6])), int(toParse[3]), int(toParse[4])]118 119 def getTotalAsserts(self, key):120 """121 key is a qualified testmethod name with asertionroulette smell122 pre:123 self.hasKey(key)124 """125 return self.dict[key][1]126 127 def getDescriptionlessAsserts(self, key):128 """129 key is a qualified testmethod name with asertionroulette smell130 pre:131 self.hasKey(key)132 """133 return self.dict[key][2]134 #def appendMetricInfo(self, metricDict):135 #cnt = 0136 #metricDict["AssertionRoulette"] = {}137 #arMtr = metricDict["AssertionRoulette"]138 #for entity in self.dict:139 #key = 'AssertionRoulette' + str(cnt)140 #arMtr[key] = {'NrA' : self.getTotalAsserts(entity), \141 #'NrDA' : self.getDescriptionlessAsserts(entity)}142 #cnt += 1143 def appendMetricInfo(self, metricDict):144 metricDict['Translation']['NrA'] = "Number of assert invocations"145 metricDict['Translation']['NrDA'] = "Number of Descriptionless assert invocations"146 self.appendMetricInfoHelper(metricDict, [('NrA', self.getTotalAsserts), \147 ('NrDA', self.getDescriptionlessAsserts)]) # Number of Control Structures148class TypedSmell(Smellz):149 def __init__(self, smellName):150 Smellz.__init__(self, smellName)151 self.smellName = smellName152 self.nodeColor = "red"153 self.entityType = "smell"154 self.style = SMELL_STYLE155 156 def parse(self, toParse):157 """158 input is a splitted indentedtest dump line, eg159 ["IndentedTest","TC","FileTest.testRemove()","1","FileTest.cc","78"]160 pre:161 toParse[0] == self.smellName162 len(toParse) == 6163 isSourceLine(toParse[5])164 isCount(toParse[3])165 toParse[1] in ["TC", "TH"]166 post:167 self.hasKey(toParse[2])168 self.getLocation(toParse[2]) == (toParse[4], int(toParse[5]))169 self.getType(toParse[2]) == toParse[1]170 self.getCount(toParse[2]) == int(toParse[3])171 """172 self.dict[toParse[2]] = [(toParse[4], int(toParse[5])), int(toParse[3]), toParse[1]]173 def getType(self, testMethod):174 """175 pre:176 self.hasKey(testMethod)177 """178 return self.dict[testMethod][2]179 180 def getCount(self, testMethod):181 """182 pre:183 self.hasKey(testMethod)184 """185 return self.dict[testMethod][1]186class IndentedTests(TypedSmell):187 def __init__(self):188 TypedSmell.__init__(self, "IndentedTest")189 def appendMetricInfo(self, metricDict):190 metricDict['Translation']['NrCS'] = "Number of control structures"191 self.appendMetricInfoHelper(metricDict, [('NrCS', self.getCount)]) # Number of Control Structures192class SensitiveEqualitys(TypedSmell):193 def __init__(self):194 TypedSmell.__init__(self, "SensitiveEquality")195 def appendMetricInfo(self, metricDict):196 metricDict['Translation']['NrTS'] = "Number of toString invocations"197 self.appendMetricInfoHelper(metricDict, [('NrTS', self.getCount)]) # Number of toStrings198class VerboseTests(Smellz):199 def __init__(self):200 Smellz.__init__(self, "VerboseTest")201 def parse(self, toParse):202 """203 input is a splitted indirectests dump line, eg204 ["VerboseTest","FooTest.testFoo()","20","FooTest.java","57"]205 pre:206 toParse[0] == "VerboseTest"207 len(toParse) == 5208 isSourceLine(toParse[4])209 isCount(toParse[2])210 post:211 self.hasKey(toParse[1])212 self.getLocation(toParse[1]) == (toParse[3], int(toParse[4]))213 self.getMetric(toParse[1]) == int(toParse[2])214 """215 self.dict[toParse[1]] = [(toParse[3], int(toParse[4])), int(toParse[2])]216 def getMetric(self, testMethod):217 """218 pre:219 self.hasKey(testMethod)220 """221 return self.dict[testMethod][1]222 def appendMetricInfo(self, metricDict):223 metricDict['Translation']['LOC'] = "Lines of code"224 self.appendMetricInfoHelper(metricDict, [('LOC', self.getMetric)])225class SingleMetricSmellz(Smellz):226 def __init__(self, smellName):227 Smellz.__init__(self, smellName)228 229 def parse(self, toParse):230 """231 input is a splitted indirectests dump line, eg232 ["IndirectTest","BtDependencyTest.testResolve()","4","5","BtDependencyTest.cc","57"]233 pre:234 toParse[0] == self.smellName235 len(toParse) == 6236 isSourceLine(toParse[5])237 isCount(toParse[2])238 isCount(toParse[3])239 post:240 self.hasKey(toParse[1])241 self.getLocation(toParse[1]) == (toParse[4], int(toParse[5]))242 self.getTreshold(toParse[1]) == int(toParse[2])243 self.getMetric(toParse[1]) == int(toParse[3])244 """245 self.dict[toParse[1]] = [(toParse[4], int(toParse[5])), int(toParse[2]), int(toParse[3])]246 def getTreshold(self, testMethod):247 """248 pre:249 self.hasKey(testMethod)250 """251 return self.dict[testMethod][1]252 253 def getMetric(self, testMethod):254 """255 pre:256 self.hasKey(testMethod)257 """258 return self.dict[testMethod][2]259class IndirectTests(SingleMetricSmellz):260 def __init__(self):261 SingleMetricSmellz.__init__(self, "IndirectTest")262 def getNPTU(self, testMethod):263 return self.getMetric(testMethod)264 def appendMetricInfo(self, metricDict):265 metricDict['Translation']['NPTU'] = "Number of production type uses"266 self.appendMetricInfoHelper(metricDict, [('NPTU', self.getNPTU)]) # Number of Production Type Uses267class EagerTests(SingleMetricSmellz):268 def __init__(self):269 SingleMetricSmellz.__init__(self, "EagerTest")270 def getPTMI(self, testMethod):271 return self.getMetric(testMethod)272 def appendMetricInfo(self, metricDict):273 metricDict['Translation']['PTMI'] = "Number of production method invocations"274 self.appendMetricInfoHelper(metricDict, [('PTMI', self.getPTMI)]) # Number of Production Type Method Invocations275class MysteryGuests(object):276 def __init__(self):277 self.mysteries = []278 def generateEdges(self):279 edges = []280 counter = 0281 for mystery in self.mysteries:282 edges.append(Edge(mystery[1], "MysteryGuest" + str(counter)))283 counter += 1284 return edges285 def generateNodes(self):286 nodes = []287 counter = 0288 for mystery in self.mysteries:289 nodes.append(Node(name="MysteryGuest" + str(counter),\290 color="black", label="MysteryGuest", \291 entity="smell", style=SMELL_STYLE ))292 counter += 1293 return nodes294 def appendLocationInfo(self, srcDict):295 counter = 0296 for mystery in self.mysteries:297 srcDict["MysteryGuest" + str(counter)] = [(mystery[2], int(mystery[3])), (mystery[5], int(mystery[6]))]298 counter += 1299 def __isDirectMystery(self, mystery):300 # a mystery guest is direct if the blacklisted method gets called301 # in the testcommand/helper/setup.302 return (mystery[2] == mystery[5]) and (mystery[3] == mystery[6])303 def parse(self, toParse):304 """305 input is a splitted mysteryguest dump line eg306 ["MysteryGuest",307 "MysteryTest.testSomething()", "MysteryTest.java", "5",\308 "MyOtherProductionClass.myOtherMethod(String)","MyOtherProductionClass.java","6",\309 "file","java::io::BufferedReader.readLine()"]310 311 pre:312 toParse[0] == "MysteryGuest"313 isSourceLine(toParse[3])314 isSourceLine(toParse[6])315 """316 self.mysteries.append(toParse)317 def appendMetricInfo(self, metricDict):318 pass319class GeneralFixtures(Smellz):320 def __init__(self):321 Smellz.__init__(self, "GeneralFixture")322 def parse(self, toParse):323 """ ["GeneralFixture","DefaultPackageTest",324 "5","6","10","DefaultPackageTest.java","0"]"""325 self.dict[toParse[1]] = [(toParse[-2], int(toParse[-1])), int(toParse[2]), int(toParse[3]), int(toParse[4])]326 def getNFOB(self, testcase):327 return self.dict[testcase][1]328 def getNFPT(self, testcase):329 return self.dict[testcase][2]330 def getNOBU(self, testcase):331 return self.dict[testcase][3]332 def appendMetricInfo(self, metricDict):333 metricDict['Translation']['NFOB'] = "Number of fixture objects"334 metricDict['Translation']['NFPT'] = "Number of fixture production types"335 metricDict['Translation']['NOBU'] = "Number of object uses"336 self.appendMetricInfoHelper(metricDict, [('NFOB', self.getNFOB),\337 ('NFPT', self.getNFPT),\338 ('NOBU', self.getNOBU)])339class DuplicatedCodes(object):340 def __init__(self):341 self.duplicates = []342 self.smellName = "DuplicatedCode"343 def generateEdges(self):344 edges = []345 counter = 0346 for duplicate in self.duplicates:347 processedMtds = set()348 for i in range(1, len(duplicate), 4):349 currMtd = filterComma(duplicate[i])350 if currMtd in processedMtds: continue351 edges.append(Edge(currMtd, self.smellName + str(counter)))352 processedMtds.add(currMtd)353 counter += 1354 return edges355 def generateNodes(self):356 nodes = []357 counter = 0358 for duplicate in self.duplicates:359 nodes.append(Node(name=self.smellName + str(counter),\360 color="red", label=self.smellName, \361 entity="smell", style=SMELL_STYLE ))362 counter += 1363 return nodes364 def appendLocationInfo(self, srcDict):365 counter = 0366 for duplicate in self.duplicates:367 srcDict[self.smellName + str(counter)] = []368 entry = srcDict[self.smellName + str(counter)]369 for i in range(2, len(duplicate), 4):370 entry.append((duplicate[i], int(duplicate[i+1]), int(duplicate[i+2])))371 counter += 1372 def parse(self, toParse):373 """374 input is a splitted duplicatedcode dump line, eg375 ["DuplicatedCode", \376 "FooTest.testFoo()", "FooTest.java", "197", "206", 377 "BazTest.testBaz()", "BazTest.java", "183", "193"]378 pre:379 toParse[0] == "DuplicatedCode"380 len(toParse) % 4 == 1381 forall(isSourceLine(i) for i in range(3,len(toParse),3))382 forall(isSourceLine(i) for i in range(4,len(toParse),3))383 """384 self.duplicates.append(toParse)385 def calculateANrSL(self, duplicate):386 ''' Average Number of Sourcelines '''...

Full Screen

Full Screen

autopart.py

Source:autopart.py Github

copy

Full Screen

...39class FC3_TestCase(CommandTest):40 command = "autopart"41 def runTest(self):42 # pass43 self.assert_parse("autopart", "autopart\n")44 # fail - on FC3, autopart took no options so this raises a different45 # exception than later releases.46 if self.__class__.__name__ == "FC3_TestCase":47 self.assert_parse_error("autopart --blah")48class F9_TestCase(FC3_TestCase):49 def runTest(self):50 FC3_TestCase.runTest(self)51 # pass52 self.assert_parse("autopart --passphrase=whatever", "autopart\n")53 self.assert_parse("autopart --encrypted", "autopart --encrypted\n")54 self.assert_parse("autopart --encrypted --passphrase=\"whatever\"",55 "autopart --encrypted --passphrase=\"whatever\"\n")56 self.assert_parse("autopart --encrypted --passphrase=whatever",57 "autopart --encrypted --passphrase=\"whatever\"\n")58 # fail59 self.assert_parse_error("autopart --passphrase")60 self.assert_parse_error("autopart --encrypted --passphrase")61 self.assert_parse_error("autopart --encrypted=False")62 self.assert_parse_error("autopart --encrypted=True")63class F12_TestCase(F9_TestCase):64 def runTest(self):65 # Run F9 test case66 F9_TestCase.runTest(self)67 # pass68 self.assert_parse("autopart --escrowcert=\"http://x/y\"", "autopart\n")69 self.assert_parse("autopart --encrypted --backuppassphrase",70 "autopart --encrypted\n")71 self.assert_parse("autopart --encrypted --escrowcert=\"http://x/y\"",72 "autopart --encrypted --escrowcert=\"http://x/y\"\n")73 self.assert_parse("autopart --encrypted --escrowcert=\"http://x/y\" "74 "--backuppassphrase",75 "autopart --encrypted --escrowcert=\"http://x/y\" "76 "--backuppassphrase\n")77 self.assert_parse("autopart --encrypted --escrowcert=http://x/y",78 "autopart --encrypted --escrowcert=\"http://x/y\"\n")79 # fail80 self.assert_parse_error("autopart --escrowcert")81 self.assert_parse_error("autopart --escrowcert --backuppassphrase")82 self.assert_parse_error("autopart --encrypted --escrowcert "83 "--backuppassphrase")84 self.assert_parse_error("autopart --backuppassphrase=False")85 self.assert_parse_error("autopart --backuppassphrase=True")86class RHEL6_TestCase(F12_TestCase):87 def runTest(self):88 F12_TestCase.runTest(self)89 # pass90 self.assert_parse("autopart --cipher=foo", "autopart\n")91 self.assert_parse("autopart --encrypted --cipher=3-rot13",92 "autopart --encrypted --cipher=\"3-rot13\"\n")93 # fail94 self.assert_parse_error("autopart --cipher")95 self.assert_parse_error("autopart --encrypted --cipher")96 # extra test coverage97 cmd = RHEL6_AutoPart()98 self.assertEqual(cmd.__str__(), '')99class RHEL6_Conflict_TestCase(CommandSequenceTest):100 def __init__(self, *args, **kwargs):101 CommandSequenceTest.__init__(self, *args, **kwargs)102 self.version = RHEL6103 def runTest(self):104 self.assert_parse_error("""105part / --size=1024 --fstype=ext4106autopart""")107 self.assert_parse_error("""108raid / --device=md0 --level=0 raid.01109autopart""")110 self.assert_parse_error("""111volgroup vg.01 pv.01 --pesize=70000112autopart""")113 self.assert_parse_error("""114logvol / --size=10240 --name=NAME --vgname=VGNAM115autopart""")116class F16_TestCase(F12_TestCase):117 def runTest(self):118 # Run F12 test case119 F12_TestCase.runTest(self)120 if "--type" not in self.optionList:121 # pass122 self.assert_parse("autopart --nolvm",123 "autopart --nolvm\n")124 # fail125 self.assert_parse_error("autopart --nolvm=asdf")126 self.assert_parse_error("autopart --nolvm True")127 self.assert_parse_error("autopart --nolvm=1")128 self.assert_parse_error("autopart --nolvm 0")129class F17_TestCase(F16_TestCase):130 def runTest(self):131 # Run F16 test case132 F16_TestCase.runTest(self)133 # pass134 self.assert_parse("autopart --type=plain",135 "autopart --type=plain\n")136 self.assert_parse("autopart --type=partition",137 "autopart --type=plain\n")138 self.assert_parse("autopart --type=lvm",139 "autopart --type=lvm\n")140 if self.__class__.__name__ != "RHEL8_TestCase":141 self.assert_parse("autopart --type=btrfs",142 "autopart --type=btrfs\n")143 self.assert_parse("autopart --nolvm",144 "autopart --type=plain\n")145 # don't add --type= if none was specified146 self.assert_parse("autopart",147 "autopart\n")148 # fail149 self.assert_parse_error("autopart --type")150 self.assert_parse_error("autopart --type=blah")151class F18_TestCase(F17_TestCase):152 def runTest(self):153 F17_TestCase.runTest(self)154 # pass155 self.assert_parse("autopart --cipher=foo", "autopart\n")156 self.assert_parse("autopart --encrypted --cipher=3-rot13",157 "autopart --encrypted --cipher=\"3-rot13\"\n")158 # fail159 self.assert_parse_error("autopart --cipher")160 self.assert_parse_error("autopart --encrypted --cipher")161class F20_TestCase(F18_TestCase):162 def runTest(self):163 F18_TestCase.runTest(self)164 self.assert_parse("autopart --type=thinp",165 "autopart --type=thinp\n")166class F21_TestCase(F20_TestCase):167 def runTest(self):168 F20_TestCase.runTest(self)169 # pass170 self.assert_parse("autopart --fstype=ext4",171 'autopart --fstype=ext4\n')172 self.assert_parse("autopart --encrypted --fstype=ext4",173 'autopart --encrypted --fstype=ext4\n')174 self.assert_parse("autopart --type=lvm --fstype=xfs",175 "autopart --type=lvm --fstype=xfs\n")176 # fail177 self.assert_parse_error("autopart --fstype")178 self.assert_parse_error("autopart --fstype=btrfs")179 self.assert_parse_error("autopart --type=btrfs --fstype=xfs")180class F21_Conflict_TestCase(CommandSequenceTest):181 def __init__(self, *args, **kwargs):182 CommandSequenceTest.__init__(self, *args, **kwargs)183 self.version = F21184 def runTest(self):185 self.assert_parse_error("""186part / --size=1024 --fstype=ext4187autopart""")188 self.assert_parse_error("""189raid / --device=md0 --level=0 raid.01190autopart""")191 self.assert_parse_error("""192volgroup vg.01 pv.01 --pesize=70000193autopart""")194 self.assert_parse_error("""195logvol / --size=10240 --name=NAME --vgname=VGNAM196autopart""")197class F23_TestCase(F21_TestCase):198 def runTest(self):199 F21_TestCase.runTest(self)200class F23_Conflict_TestCase(F21_Conflict_TestCase):201 """202 reqpart was added in Fedora 23 but the autopart handler203 wasn't updated. Instead the changes were introduced into204 F20_AutoPart, which wasn't the best thing to do.205 """206 def __init__(self, *args, **kwargs):207 F21_Conflict_TestCase.__init__(self, *args, **kwargs)208 self.version = F23209 def runTest(self):210 F21_Conflict_TestCase.runTest(self)211 self.assert_parse_error("""212reqpart213autopart""")214class RHEL7_TestCase(F21_TestCase):215 def runTest(self):216 F21_TestCase.runTest(self)217 # pass218 self.assert_parse("autopart --nohome",219 "autopart --nohome\n")220 # fail221 self.assert_parse_error("autopart --nohome=xxx")222 self.assert_parse_error("autopart --nohome True")223 self.assert_parse_error("autopart --nohome=1")224 self.assert_parse_error("autopart --nohome 0")225class RHEL7_Conflict_TestCase(CommandSequenceTest):226 def __init__(self, *args, **kwargs):227 CommandSequenceTest.__init__(self, *args, **kwargs)228 self.version = RHEL7229 def runTest(self):230 self.assert_parse_error("""231reqpart232autopart""")233class F26_TestCase(F23_TestCase):234 def runTest(self):235 F23_TestCase.runTest(self)236 # pass237 self.assert_parse("autopart --nohome",238 'autopart --nohome\n')239 self.assert_parse("autopart --noboot",240 'autopart --noboot\n')241 self.assert_parse("autopart --noswap",242 'autopart --noswap\n')243 self.assert_parse("autopart --nohome --noboot --noswap",244 'autopart --nohome --noboot --noswap\n')245 # fail246 self.assert_parse_error("autopart --nohome=xxx")247 self.assert_parse_error("autopart --nohome True")248 self.assert_parse_error("autopart --nohome=1")249 self.assert_parse_error("autopart --nohome 0")250 self.assert_parse_error("autopart --noboot=xxx")251 self.assert_parse_error("autopart --noboot True")252 self.assert_parse_error("autopart --noboot=1")253 self.assert_parse_error("autopart --noboot 0")254 self.assert_parse_error("autopart --noswap=xxx")255 self.assert_parse_error("autopart --noswap True")256 self.assert_parse_error("autopart --noswap=1")257 self.assert_parse_error("autopart --noswap 0")258class F26_Conflict_TestCase(F23_Conflict_TestCase):259 def runTest(self):260 F23_Conflict_TestCase.runTest(self)261class F29_TestCase(F26_TestCase):262 def runTest(self):263 F26_TestCase.runTest(self)264 self.assert_parse("autopart --encrypted --luks-version=luks2",265 "autopart --encrypted --luks-version=luks2\n")266 self.assert_parse("autopart --encrypted --pbkdf=argon2i",267 "autopart --encrypted --pbkdf=argon2i\n")268 self.assert_parse("autopart --encrypted --pbkdf-memory=256",269 "autopart --encrypted --pbkdf-memory=256\n")270 self.assert_parse("autopart --encrypted --pbkdf-time=100",271 "autopart --encrypted --pbkdf-time=100\n")272 self.assert_parse("autopart --encrypted --pbkdf-iterations=1000",273 "autopart --encrypted --pbkdf-iterations=1000\n")274 self.assert_parse_error("autopart --encrypted --pbkdf-time=100 --pbkdf-iterations=1000")275class RHEL8_TestCase(F29_TestCase):276 def runTest(self):277 F29_TestCase.runTest(self)278 self.assert_parse_error("autopart --type=btrfs")279if __name__ == "__main__":...

Full Screen

Full Screen

test_parser_pddl_simple.py

Source:test_parser_pddl_simple.py Github

copy

Full Screen

1#!/usr/bin/python32from pddl.parser import *3from pddl.lisp_parser import parse_lisp_iterator4from pddl.errors import BraceError, ParseError5from py.test import raises6## helper functions7def varListTest(varList):8 assert [k.name for k in varList] == ['?x', '?y', '?z']9 assert len([k for k in varList if k.typed]) == 310 assert [k.types[0] for k in varList] == ['block', 'foo', 'block']11def keywordListTest(keyList):12 assert [k.name for k in keyList] == ['name', 'parameters', 'foo']13## the tests14def test_parseKeywordSimple():15 test = ['(:parameters )']16 iter = parse_lisp_iterator(test)17 key = parse_keyword(next(iter))18 assert key.name == 'parameters'19def test_parseKeywordComplex():20 test = [' ( :name)']21 iter = parse_lisp_iterator(test)22 key = parse_keyword(next(iter))23 assert key.name == 'name'24def test_parseKeywordList():25 test = ['(:name :parameters :foo )']26 iter = parse_lisp_iterator(test)27 keys = parse_keyword_list(iter)28 assert iter.empty()29 keywordListTest(keys)30def test_parseRequirements():31 test = ['(:requirements :name :parameters :foo )']32 iter = parse_lisp_iterator(test)33 req = parse_requirements_stmt(iter)34 assert iter.empty()35 keywordListTest(req.keywords)36def test_parseRequirements2():37 test = ['(:predicates :name :parameters :foo )']38 iter = parse_lisp_iterator(test)39 with raises(ValueError):40 parse_requirements_stmt(iter)41def test_parseVariableNoTyping():42 test = [' ( ?x)']43 iter = parse_lisp_iterator(test)44 key = parse_variable(next(iter))45 assert key.name == '?x'46 assert key.typed == False47 assert key.types == None48def test_parseVariableTyping():49 test = [' ( ?x - block)']50 iter = parse_lisp_iterator(test)51 vlist = parse_typed_var_list(iter)52 assert len(vlist) == 153 assert vlist[0].name == '?x'54 assert vlist[0].typed == True55 assert vlist[0].types[0] == 'block'56def test_parseVariableList():57 test = [' ( ?x - block ?y - foo ?z - block )']58 iter = parse_lisp_iterator(test)59 key = parse_typed_var_list(iter)60 varListTest(key)61def test_parseParameters():62 test = ['(:parameters ( ?x - block ?y - foo ?z - block ))']63 iter = parse_lisp_iterator(test)64 key = parse_parameters(iter)65 varListTest(key)66def test_parseParameters2():67 test = ['(:predicates ( ?x - block ?y - foo ?z - block ))']68 iter = parse_lisp_iterator(test)69 with raises(ValueError):70 parse_parameters(iter)71def test_parseTypes():72 test = ['(:types block plane key)']73 iter = parse_lisp_iterator(test)74 tlist = parse_types_stmt(iter)75 assert [t.name for t in tlist] == ['block', 'plane', 'key']76def test_parseTypesFail():77 test = ['(:types :block plane key)']78 iter = parse_lisp_iterator(test)79 with raises(ValueError):80 parse_types_stmt(iter)81def test_parseTypesFail2():82 test = ['(:predicates :block plane key)']83 iter = parse_lisp_iterator(test)84 with raises(ValueError):85 parse_types_stmt(iter)86def test_parseDomainStatement():87 test = ['(domain supertest-23-v0)']88 iter = parse_lisp_iterator(test)89 dom = parse_domain_stmt(iter)90 assert dom.name == 'supertest-23-v0'91def test_parseDomainStatementFail():92 test = ['(domaiin supertest-23-v0)']93 iter = parse_lisp_iterator(test)94 with raises(ValueError):95 parse_domain_stmt(iter)96def test_parsePredicate():97 test = ['(on ?x ?y)']98 iter = parse_lisp_iterator(test)99 pred = parse_predicate(iter)100 assert pred.name == 'on'101 assert [x.name for x in pred.parameters] == ['?x', '?y']102def test_parsePredicateMixed():103 test = ['(on ?x - block ?y)']104 iter = parse_lisp_iterator(test)105 pred = parse_predicate(iter)106 assert pred.name == 'on'107 assert [x.name for x in pred.parameters] == ['?x', '?y']108 assert [x.types[0] for x in pred.parameters109 if x.types != None] == ['block']110def test_parsePredicateList():111 test = ['((on ?x - block ?y) (put ?x ?z) (true))']112 iter = parse_lisp_iterator(test)113 predlist = parse_predicate_list(iter)114 assert [x.name for x in predlist] == ['on', 'put', 'true']115def test_parseFormula():116 test = ['(and (on ?x table) (true) (free ?x))']117 iter = parse_lisp_iterator(test)118 print(iter)119 formula = parse_formula(iter)120 assert formula.key == 'and'121 assert [c.key for c in formula.children] == ['on', 'true', 'free']122 assert [c.key.name for c in formula.children[0].children123 if c.type == TypeVariable] == ['?x']124 assert [c.key for c in formula.children[0].children125 if c.type == TypeConstant] == ['table']126 assert [c.key.name for c in formula.children[2].children127 if c.type == TypeVariable] == ['?x']128 assert [c for c in formula.children[1].children] == []129def test_parseFormulaFail():130 test = ['(and (on ?x table) (:true) (free ?x))']131 iter = parse_lisp_iterator(test)132 with raises(ValueError):133 parse_formula(iter)134def test_parseFormulaLispFail2():135 test = ['(and (on ?x table) (true) (free( ?x))']136 with raises(ParseError):137 iter = parse_lisp_iterator(test)138def test_parse_variable():139 test = ['(x)']140 iter = parse_lisp_iterator(test)141 with raises(ValueError):142 parse_variable(next(iter))143def test_lisp_parser_start_brace():144 test = ['test string)']145 with raises(ParseError):146 iter = parse_lisp_iterator(test)147def test_parse_keyword_raise():148 test = ['(?test)']149 iter = parse_lisp_iterator(test)150 with raises(ValueError):151 parse_keyword(next(iter))152def test_parse_objects_stmt_fail():153 test = ['(:predicates blubb blubb)']154 iter = parse_lisp_iterator(test)155 with raises(ValueError):156 parse_objects_stmt(iter)157def test_parse_constants_stmt_fail():158 test = ['(:predicates blubb blubb)']159 iter = parse_lisp_iterator(test)160 with raises(ValueError):161 parse_constants_stmt(iter)162def test_parse_problem_domain_stmt_fail():163 test = ['(:predicates blubb blubb)']164 iter = parse_lisp_iterator(test)165 with raises(ValueError):166 parse_problem_domain_stmt(iter)167def test_parse_precondition_stmt_fail():168 test = ['(:predicates blubb blubb)']169 iter = parse_lisp_iterator(test)170 with raises(ValueError):171 parse_precondition_stmt(iter)172def test_parse_effect_stmt_fail():173 test = ['(:predicates blubb blubb)']174 iter = parse_lisp_iterator(test)175 with raises(ValueError):176 parse_effect_stmt(iter)177def test_parse_action_stmt_fail():178 test = ['(:predicates blubb blubb)']179 iter = parse_lisp_iterator(test)180 with raises(ValueError):181 parse_action_stmt(iter)182def test_parse_predicates_stmt_fail():183 test = ['(:actions blubb blubb)']184 iter = parse_lisp_iterator(test)185 with raises(ValueError):186 parse_predicates_stmt(iter)187def test_parse_domain_def_fail():188 test = ['(definiere (domain BLOCKS))']189 iter = parse_lisp_iterator(test)190 with raises(ValueError):191 parse_domain_def(iter)192def test_parse_problem_def_fail():193 test = ['(definiere problem)']194 iter = parse_lisp_iterator(test)195 with raises(ValueError):196 parse_problem_def(iter)197def test_parse_problem_name_fail():198 test = ['(domain test)']199 iter = parse_lisp_iterator(test)200 with raises(ValueError):201 parse_problem_name(iter)202def test_parse_init_stmt_fail():203 test = ['(:goal ssdfsdf)']204 iter = parse_lisp_iterator(test)205 with raises(ValueError):206 parse_init_stmt(iter)207def test_parse_goal_stmt_fail():208 test = ['(:init ssdfsdf)']209 iter = parse_lisp_iterator(test)210 with raises(ValueError):...

Full Screen

Full Screen

test_expressionparser.py

Source:test_expressionparser.py Github

copy

Full Screen

...5from manifestparser import parse6class ExpressionParserTest(unittest.TestCase):7 """Test the conditional expression parser."""8 def test_basic(self):9 self.assertEqual(parse("1"), 1)10 self.assertEqual(parse("100"), 100)11 self.assertEqual(parse("true"), True)12 self.assertEqual(parse("false"), False)13 self.assertEqual('', parse('""'))14 self.assertEqual(parse('"foo bar"'), 'foo bar')15 self.assertEqual(parse("'foo bar'"), 'foo bar')16 self.assertEqual(parse("foo", foo=1), 1)17 self.assertEqual(parse("bar", bar=True), True)18 self.assertEqual(parse("abc123", abc123="xyz"), 'xyz')19 def test_equality(self):20 self.assertTrue(parse("true == true"))21 self.assertTrue(parse("false == false"))22 self.assertTrue(parse("1 == 1"))23 self.assertTrue(parse("100 == 100"))24 self.assertTrue(parse('"some text" == "some text"'))25 self.assertTrue(parse("true != false"))26 self.assertTrue(parse("1 != 2"))27 self.assertTrue(parse('"text" != "other text"'))28 self.assertTrue(parse("foo == true", foo=True))29 self.assertTrue(parse("foo == 1", foo=1))30 self.assertTrue(parse('foo == "bar"', foo='bar'))31 self.assertTrue(parse("foo == bar", foo=True, bar=True))32 self.assertTrue(parse("true == foo", foo=True))33 self.assertTrue(parse("foo != true", foo=False))34 self.assertTrue(parse("foo != 2", foo=1))35 self.assertTrue(parse('foo != "bar"', foo='abc'))36 self.assertTrue(parse("foo != bar", foo=True, bar=False))37 self.assertTrue(parse("true != foo", foo=False))38 self.assertTrue(parse("!false"))39 def test_conjunctures(self):40 self.assertTrue(parse("true && true"))41 self.assertTrue(parse("true || false"))42 self.assertFalse(parse("false || false"))43 self.assertFalse(parse("true && false"))44 self.assertTrue(parse("true || false && false"))45 def test_parentheses(self):46 self.assertTrue(parse("(true)"))47 self.assertEqual(parse("(10)"), 10)48 self.assertEqual(parse('("foo")'), 'foo')49 self.assertEqual(parse("(foo)", foo=1), 1)50 self.assertTrue(parse("(true == true)"), True)51 self.assertTrue(parse("(true != false)"))52 self.assertTrue(parse("(true && true)"))53 self.assertTrue(parse("(true || false)"))54 self.assertTrue(parse("(true && true || false)"))55 self.assertFalse(parse("(true || false) && false"))56 self.assertTrue(parse("(true || false) && true"))57 self.assertTrue(parse("true && (true || false)"))58 self.assertTrue(parse("true && (true || false)"))59 self.assertTrue(parse("(true && false) || (true && (true || false))"))60 def test_comments(self):61 # comments in expressions work accidentally, via an implementation62 # detail - the '#' character doesn't match any of the regular63 # expressions we specify as tokens, and thus are ignored.64 # However, having explicit tests for them means that should the65 # implementation ever change, comments continue to work, even if that66 # means a new implementation must handle them explicitly.67 self.assertTrue(parse("true == true # it does!"))68 self.assertTrue(parse("false == false # it does"))69 self.assertTrue(parse("false != true # it doesnt"))70 self.assertTrue(parse('"string with #" == "string with #" # really, it does'))71 self.assertTrue(parse('"string with #" != "string with # but not the same" # no match!'))72 def test_not(self):73 """74 Test the ! operator.75 """76 self.assertTrue(parse("!false"))77 self.assertTrue(parse("!(false)"))78 self.assertFalse(parse("!true"))79 self.assertFalse(parse("!(true)"))80 self.assertTrue(parse("!true || true)"))81 self.assertTrue(parse("true || !true)"))82 self.assertFalse(parse("!true && true"))83 self.assertFalse(parse("true && !true"))84 def test_lesser_than(self):85 """86 Test the < operator.87 """88 self.assertTrue(parse("1 < 2"))89 self.assertFalse(parse("3 < 2"))90 self.assertTrue(parse("false || (1 < 2)"))91 self.assertTrue(parse("1 < 2 && true"))92 self.assertTrue(parse("true && 1 < 2"))93 self.assertTrue(parse("!(5 < 1)"))94 self.assertTrue(parse("'abc' < 'def'"))95 self.assertFalse(parse("1 < 1"))96 self.assertFalse(parse("'abc' < 'abc'"))97 def test_greater_than(self):98 """99 Test the > operator.100 """101 self.assertTrue(parse("2 > 1"))102 self.assertFalse(parse("2 > 3"))103 self.assertTrue(parse("false || (2 > 1)"))104 self.assertTrue(parse("2 > 1 && true"))105 self.assertTrue(parse("true && 2 > 1"))106 self.assertTrue(parse("!(1 > 5)"))107 self.assertTrue(parse("'def' > 'abc'"))108 self.assertFalse(parse("1 > 1"))109 self.assertFalse(parse("'abc' > 'abc'"))110 def test_lesser_or_equals_than(self):111 """112 Test the <= operator.113 """114 self.assertTrue(parse("1 <= 2"))115 self.assertFalse(parse("3 <= 2"))116 self.assertTrue(parse("false || (1 <= 2)"))117 self.assertTrue(parse("1 < 2 && true"))118 self.assertTrue(parse("true && 1 <= 2"))119 self.assertTrue(parse("!(5 <= 1)"))120 self.assertTrue(parse("'abc' <= 'def'"))121 self.assertTrue(parse("1 <= 1"))122 self.assertTrue(parse("'abc' <= 'abc'"))123 def test_greater_or_equals_than(self):124 """125 Test the > operator.126 """127 self.assertTrue(parse("2 >= 1"))128 self.assertFalse(parse("2 >= 3"))129 self.assertTrue(parse("false || (2 >= 1)"))130 self.assertTrue(parse("2 >= 1 && true"))131 self.assertTrue(parse("true && 2 >= 1"))132 self.assertTrue(parse("!(1 >= 5)"))133 self.assertTrue(parse("'def' >= 'abc'"))134 self.assertTrue(parse("1 >= 1"))135 self.assertTrue(parse("'abc' >= 'abc'"))136if __name__ == '__main__':...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const { parse } = require('playwright/lib/utils/utils');2const { chromium } = require('playwright');3(async () => {4 const browser = await chromium.launch();5 const context = await browser.newContext();6 const page = await context.newPage();7 const html = await page.content();8 const parsed = parse(html);9 console.log(parsed.querySelector('title').textContent);10 await browser.close();11})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const {parse} = require('playwright-internal');2const {chromium} = require('playwright-internal');3const {firefox} = require('playwright-internal');4const {webkit} = require('playwright-internal');5const {android} = require('playwright-internal');6const {ios} = require('playwright-internal');7const {electron} = require('playwright-internal');8const {parse} = require('playwright');9const {chromium} = require('playwright');10const {firefox} = require('playwright');11const {webkit} = require('playwright');12const {android} = require('playwright');13const {ios} = require('playwright');14const {electron} = require('playwright');15const {parse} = require('playwright');16const {chromium} = require('playwright');17const {firefox} = require('playwright');18const {webkit} = require('playwright');19const {android} = require('playwright');20const {ios} = require('playwright');21const {electron} = require('playwright');22const {parse} = require('playwright');23const {chromium} = require('playwright');24const {firefox} = require('playwright');25const {webkit} = require('playwright');26const {android} = require('playwright');27const {ios} = require('playwright');28const {electron} = require('playwright');29const {parse} = require('playwright');30const {chromium} = require('playwright');31const {firefox} = require('playwright');32const {webkit} = require('playwright');33const {android} = require('playwright');34const {ios} = require('playwright');35const {electron} = require('playwright');36const {parse} = require('playwright');37const {chromium} = require('playwright');38const {firefox} = require('playwright');39const {webkit} = require('playwright');40const {android} = require('playwright');41const {ios} = require('playwright');42const {electron} = require('playwright');

Full Screen

Using AI Code Generation

copy

Full Screen

1const { parse } = require('playwright/lib/utils/utils');2const { parse } = require('playwright/lib/utils/utils');3const { parse } = require('playwright/lib/utils/utils');4const { parse } = require('playwright/lib/utils/utils');5const { parse } = require('playwright/lib/utils/utils');6const { parse } = require('playwright/lib/utils/utils');7const { parse } = require('playwright/lib/utils/utils');8const { parse } = require('playwright/lib/utils/utils');9const { parse } = require('playwright/lib/utils/utils');10const { parse } = require('playwright/lib/utils/utils');11const { parse } = require('playwright/lib/utils/utils');12const { parse } = require('playwright/lib/utils/utils');13const { parse } = require('playwright/lib/utils/utils');14const { parse } = require('playwright/lib/utils/utils');15const { parse } = require('playwright/lib/utils/utils');16const { parse } = require('playwright/lib/utils/utils');17const { parse } = require('playwright/lib/utils/utils');18const { parse } = require('playwright/lib/utils/utils');19const { parse } = require('playwright/lib/utils/utils');20const { parse } = require('playwright/lib/utils/utils');21const { parse } = require('playwright/lib/utils/utils');22const { parse } = require('playwright/lib/utils/utils');23const { parse } = require('playwright/lib/utils/utils');24const { parse } = require('playwright/lib/utils/utils');25const { parse } = require('playwright/lib/utils/utils');26const { parse } = require('playwright/lib/utils/utils');27const { parse } = require('playwright/lib/utils/utils');28const { parse } = require('playwright/lib/utils/utils');29const { parse } = require('playwright/lib/utils/utils');30const { parse } = require('playwright/lib/utils/utils

Full Screen

Using AI Code Generation

copy

Full Screen

1const { parse } = require('playwright-internal');2console.log(result);3const { parse } = require('playwright');4console.log(result);5const { parse } = require('playwright');6console.log(result);7const { parse } = require('playwright');8console.log(result);9const { parse } = require('playwright');10console.log(result);11const { parse } = require('playwright');12console.log(result);13const { parse } = require('playwright');14console.log(result);15const { parse } = require('playwright');16console.log(result);17const { parse } = require('playwright');18console.log(result);19const { parse } = require('playwright');20console.log(result);21const { parse } = require('playwright');22console.log(result);23const { parse } = require('playwright');24console.log(result);25const { parse } = require('playwright');26const result = parse('http

Full Screen

Using AI Code Generation

copy

Full Screen

1const { parse } = require('playwright/lib/utils/utils');2const { test } = require('@playwright/test');3const { expect } = require('@playwright/test');4const { chromium } = require('playwright');5const { Page } = require('playwright/lib/page');6const { Browser } = require('playwright/lib/browser');7const { BrowserContext } = require('playwright/lib/browserContext');8const { BrowserServer } = require('playwright/lib/server/browserServer');9const { BrowserType } = require('playwright/lib/server/browserType');10const { ElectronApplication } = require('playwright/lib/server/electron');11const { ElectronApplicationLauncher } = require('playwright/lib/server/electron');12const { FirefoxBrowser } = require('playwright/lib/server/firefox');13const { FirefoxBrowserContext } = require('playwright/lib/server/firefox');14const { FirefoxBrowserServer } = require('playwright/lib/server/firefox');15const { FirefoxBrowserType } = require('playwright/lib/server/firefox');16const { Android } = require('playwright/lib/server/android');17const { AndroidBrowser } = require('playwright/lib/server/android');18const { AndroidBrowserContext } = require('playwright/lib/server/android');19const { AndroidBrowserType } = require('playwright/lib/server/android');20const { AndroidDevice } = require('playwright/lib/server/android');21const { AndroidDeviceLauncher } = require('playwright/lib/server/android');22const { AndroidSocket } = require('playwright/lib/server/android');23const { Connection } = require('playwright/lib/server/connection');24const { CRBrowser } = require('playwright/lib/server/chromium');25const { CRBrowserContext } = require('playwright/lib/server/chromium');26const { CRBrowserServer } = require('playwright/lib/server/chromium');27const { CRBrowserType } = require('playwright/lib/server/chromium');28const { CRSession } = require('playwright/lib/server/chromium');29const { CRConnection } = require('playwright/lib/server/chromium');30const { CRSessionEvents } = require('playwright/lib/server/chromium');31const { CRPage } = require('playwright/lib/server/chromium');32const { CRNetworkManager } = require('playwright/lib/server/chromium');33const { CRNetworkManagerEvents } = require('playwright/lib/server/chromium');34const { CRDialog } = require('playwright/lib/server

Full Screen

Using AI Code Generation

copy

Full Screen

1const { parse } = require('playwright/lib/utils/utils');2const parsedUrl = parse(url);3console.log(parsedUrl);4const { parse } = require('playwright/lib/utils/utils');5const parsedUrl = parse(url);6const hostname = parsedUrl.hostname;7console.log(hostname);8const { parse } = require('playwright/lib/utils/utils');9const parsedUrl = parse(url);10const protocol = parsedUrl.protocol;11console.log(protocol);

Full Screen

Using AI Code Generation

copy

Full Screen

1const parse = require('playwright/lib/utils/parseColor').parse;2const color = parse('#000000');3console.log(color);4console.log(color.r);5console.log(color.g);6console.log(color.b);7const parse = require('playwright/lib/utils/parseColor').parse;8const color = parse('#000000');9console.log(color);10console.log(color.r);11console.log(color.g);12console.log(color.b);13const parse = require('playwright/lib/utils/parseColor').parse;14const color = parse('#000000');15console.log(color);16console.log(color.r);17console.log(color.g);18console.log(color.b);19const parse = require('playwright/lib/utils/parseColor').parse;20const color = parse('#000000');21console.log(color);22console.log(color.r);23console.log(color.g);24console.log(color.b);25const parse = require('playwright/lib/utils/parseColor').parse;26const color = parse('#000000');27console.log(color);28console.log(color.r);29console.log(color.g);30console.log(color.b);31const parse = require('playwright/lib/utils/parseColor

Full Screen

Using AI Code Generation

copy

Full Screen

1const { parse } = require('@playwright/test/lib/utils/utils');2const parsed = parse(url);3console.log(parsed);4const { parse } = require('url');5const parsed = parse(url);6console.log(parsed);7const { parse } = require('url');8const parsed = parse(url);9console.log(parsed);10const { URL } = require('url');11const parsed = new URL(url);12console.log(parsed);

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