Best Python code snippet using gherkin-python
spec.py
Source:spec.py
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]],...
qasm3subListener.py
Source:qasm3subListener.py
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...
tsmells2gdfTest.py
Source:tsmells2gdfTest.py
...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)...
command_parser_test.py
Source:command_parser_test.py
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__":...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!