How to use isMatched method in storybook-root

Best JavaScript code snippet using storybook-root

validate.py

Source:validate.py Github

copy

Full Screen

...93 return ann94## TESTING FUNCTIONS ######################################################95def testClaim(annotation, urn, label, exact, method, negation, rej_statement, rej_reason, rej_comment):96 print "[INFO] begin validating claim..."97 if isMatched("urn", urn, annotation.urn) and isMatched("label", label, annotation.label) and isMatched("exact text", exact, annotation.exact) and isMatched("user entered method", method, annotation.method) and isMatched("negation", negation, annotation.negation) and isMatched("rejected", rej_statement, annotation.rejected_statement) and isMatched("rejected", rej_reason, annotation.rejected_statement_reason) and isMatched("rejected", rej_comment, annotation.rejected_statement_comment):98 print "[TEST] claim is validated" 99 else:100 print "[ERROR] claim is not correct"101def testQualifier(qualifier, qvalue, subject, predicate, object, enantiomer, metabolite):102 print "[INFO] begin validating claim qualifiers..." 103 if isMatched("qualifier", qvalue, qualifier.qvalue) and isMatched("subject", subject, qualifier.subject) and isMatched("predicate", predicate, qualifier.predicate) and isMatched("object", object, qualifier.object) and isMatched("enantiomer", enantiomer, qualifier.enantiomer) and isMatched("metabolite", metabolite, qualifier.metabolite):104 print "[TEST] claim qualifier is validated"105 else:106 print "[ERROR] claim qualifier are not correct"107def testDataRatio(ratioItem, field, value, type, direction, exact):108 print "[INFO] begin validating %s..." % field109 if isMatched("field", field, ratioItem.field) and isMatched("value", value, ratioItem.value) and isMatched("type", type, ratioItem.type) and isMatched("direction", direction, ratioItem.direction) and isMatched("exact text", exact, ratioItem.exact):110 print "[TEST] %s is validated" % (field)111 else:112 print "[ERROR] %s is incorrect" % (field)113def testMaterialDose(doseItem, field, drugname, value, formulation, duration, regimens, exact):114 print "[INFO] begin validating %s..." % field115 if isMatched("dose type", field, doseItem.field) and isMatched("drugname", drugname, doseItem.drugname) and isMatched("value", value, doseItem.value) and isMatched("duration", duration, doseItem.duration) and isMatched("formulation", formulation, doseItem.formulation) and isMatched("regimens", regimens, doseItem.regimens) and isMatched("exact text", exact, doseItem.exact):116 print "[TEST] %s is validated" % (field)117 else:118 print "[ERROR] %s is incorrect" % (field)119def testParticipants(partItem, value, exact):120 print "[INFO] begin validating participants..."121 if isMatched("participants", value, partItem.value) and isMatched("exact", exact, partItem.exact):122 print "[TEST] participants is validated"123 else:124 print "[ERROR] participants is incorrect"125def testEvRelationship(dmRow, value):126 if isMatched("evidence relationship", value, dmRow.ev_supports):127 print "[TEST] evidence relationship is validated"128 else:129 print "[ERROR] evidence relationship is incorrect" 130def testPhenotype(phenoItem, ptype, value, metabolizer, population, exact):131 print "[INFO] begin validating phenotype..."132 if isMatched("phenotype", ptype, phenoItem.ptype) and isMatched("value", value, phenoItem.value) and isMatched("metabolizer", metabolizer, phenoItem.metabolizer) and isMatched("population", population, phenoItem.population) and isMatched("exact", exact, phenoItem.exact):133 print "[TEST] phenotype is validated"134 else:135 print "[ERROR] phenotype is incorrect"136def testDataReviewer(reviewerItem, reviewer, date, total, lackinfo):137 print "[INFO] begin validating data reviewer..."138 if isMatched("reviewer", reviewer, reviewerItem.reviewer) and isMatched("date", date, reviewerItem.date) and isMatched("total", total, reviewerItem.total) and isMatched("lackinfo", lackinfo, reviewerItem.lackinfo):139 print "[TEST] data reviewer is validated"140 else:141 print "[ERROR] data reviewer is incorrect"142def testDataDipsQs(dipsItem, qsDict):143 print "[INFO] begin validating dips questions..."144 annDipsQsDict = dipsItem.getDipsDict()145 if len(annDipsQsDict) == len(qsDict):146 for k,v in qsDict.iteritems():147 if not isMatched("dips " + k, v, annDipsQsDict[k]):148 return149 print "[TEST] dips questions are validated"150 else:151 print "[ERROR] incorrect number of dips questions"152def testEvTypeQuestion(dmRow, grouprandom, parallelgroup):153 print "[INFO] begin validating evidence type questions..."154 if isMatched("grouprandom", grouprandom, dmRow.grouprandom) and isMatched("parallelgroup", parallelgroup, dmRow.parallelgroup):155 print "[TEST] evidence type related questions are validated"156 else:157 print "[ERROR] evidence type related questions are incorrect"158 159def isMatched(field, val1, val2):160 if type(val1) != type(val2):161 print "[ERROR] %s have an incorrect data type" % field162 return False163 if val1 == val2:164 #print "[TEST] %s is validated" % field165 return True166 print "[ERROR] %s is incorrect: val1 (%s) and val2 (%s)" % (field, val1, val2)167 return False 168## TESTING CASES #############################################################169# Validate clinical trial annotation 170# Two data & material items171def test_clinical_trial_1(conn, template):172 print "[INFO] ===== begin test clinical trial annotation 1 ======================"173 annUrn = "test-clinicaltrial-id-1"...

Full Screen

Full Screen

within10ms.py

Source:within10ms.py Github

copy

Full Screen

1import os #for accessing and iterating through directories2import statistics #for calculating standard deviation3import matplotlib.pyplot as plt #for generating histogram4from statsmodels.graphics import tsaplots #for autocorrelation function5import numpy as np #for autocorrelation6import scipy7from scipy import signal8from pandas import read_csv9from statsmodels.graphics.tsaplots import plot_acf10import csv11class Event():12 scope = '' #initialized to null string13 timestamp = 0 #initialized to zero14 voltage = 0 #this is the voltage from the ramp. It is initialized to zero15 isMatched = False #initialized to false because the event hasn't been matched to a corrsponding one yet16 def __init__(self, scp, time, volt): #we will include voltage as soon as we figure out how to record from multiple sources in Waveforms 201517 self.scope = scp18 self.timestamp = time19 self.voltage = volt20#anodeDir = 'C:\\Users\\skyfab\\Documents\\Waveforms\\Data Scenario 2\\anode' #folder path to .csv acquisitions for AD1 in scenario 121#pmtDir = 'C:\\Users\\skyfab\\Documents\\Waveforms\\Data Scenario 2\pmt' #folder path to .csv acquisitions for AD2 in scenario 122#anodeDir = 'C:\\Users\\skyfab\\Documents\\Waveforms\\Data Scenario 1\\AD1 run 27' #folder path to .csv acquisitions for AD1 in scenario 123#pmtDir = 'C:\\Users\\skyfab\\Documents\\Waveforms\\Data Scenario 1\\AD2 run 27' #folder path to .csv acquisitions for AD2 in scenario 124anodeDir = 'C:\\Users\\skyfab\Documents\\Waveforms\\Data Scenario 1 with voltages\\AD1' #folder path to .csv acquisitions for AD1 in scenario 125pmtDir = 'C:\\Users\\skyfab\Documents\\Waveforms\\Data Scenario 1 with voltages\\AD2' #folder path to .csv acquisitions for AD2 in scenario 126anode = []27pmt = []28difsXaxis = [] #number of time differences recorded29for filename in os.listdir(anodeDir):30 name = os.path.join(anodeDir, filename) #store the name of the file in 'name'31 index = len(name) - 5 #len(name) is the number of characters in name, and len(name) - 5 is ones place of the milliseconds in the timestamp 32 #example: name = 'C:\Users\skyfab\Documents\Waveforms\Data\anode\anode12.25.43.116.csv' 33 #the character name[index] corresponds to 6. We use the function int() to cast the character to an integer value34 35 timeStampVal = int(name[index - 8]) * 600000 + int(name[index - 7]) * 60000 + int(name[index - 5]) * 10000 + int(name[index - 4]) * 1000 + int(name[index - 2]) * 100 + int(name[index - 1]) * 10 + int(name[index]) #converting the timestamp to milliseconds36 #anodeTimes.append(timeStampVal) #add timestamp value to anodeTimes37 38 volt = 039 40 with open(name) as f:41 rows = list(csv.reader(f))42 volt += float(rows[21][1])43 44 anode.append(Event("AD1", timeStampVal, volt))45 46for filename in os.listdir(pmtDir):47 name = os.path.join(pmtDir, filename) 48 index = len(name) - 549 50 timeStampVal = int(name[index - 8]) * 600000 + int(name[index - 7]) * 60000 + int(name[index - 5]) * 10000 + int(name[index - 4]) * 1000 + int(name[index - 2]) * 100 + int(name[index - 1]) * 10 + int(name[index]) #converting the timestamp to milliseconds51 #pmtTimes.append(timeStampVal) #add timestamp value to pmtTimes52 volt = 053 54 with open(name) as f:55 rows = list(csv.reader(f))56 volt += float(rows[21][1])57 58 pmt.append(Event("AD2", timeStampVal, volt))59#the following section is supposed to get rid of acquisition duplicates60'''61Evan's within dT = 10 milliseconds algorithm62step 1: determine which oscilloscope took more acquisitions. This is the list we are going to pop aquisitions from63step 2: start at the beginning of the larger list and see if the acquisition across is within 10 seconds.64 if it is, move on to the next acquisition in the larger list.65 If not, check if the next acquisition has a smaller time difference66 if it is, check if the acquisition is within 10 seconds. if not check if the next acquisition has a smaller time difference67 if not, move on to the next acquisition in the larger list 68'''69pairedAnode = [] #these lists will contain the paired acquisitions70pairedPmt = []71numTossed = 0 #number of events removed72anodeLen = len(anode) #73pmtLen = len(pmt)74#for when pmt has more acquisitions than anode 75if(pmtLen > anodeLen):76 for i in range(len(anode)):77 wasMatch = False78 if(i == 0): #if you are looking at the first element in the large list, compare it to the next three acquisitions79 for j in range(3):80 if(abs(anode[i].timestamp - pmt[i + j].timestamp) < 10 and not anode[i].isMatched and not pmt[i+j].isMatched):81 pairedAnode.append(anode[i])82 pairedPmt.append(pmt[i + j])83 anode[i].isMatched = True84 pmt[i + j].isMatched = True85 wasMatch = True86 elif(i == len(anode) - 1): #if you are looking at the last element in the large list, compare it to the next three acquisitions87 for j in range(3):88 if(abs(anode[i].timestamp - pmt[i - j].timestamp) < 10 and not anode[i].isMatched and not pmt[i-j].isMatched):89 pairedAnode.append(anode[i])90 pairedPmt.append(pmt[i - j])91 anode[i].isMatched = True92 pmt[i - j].isMatched = True93 wasMatch = True94 else:95 for j in range(3):96 if(abs(anode[i].timestamp - pmt[i - 1 + j].timestamp) < 10 and not anode[i].isMatched and not pmt[i - 1 + j].isMatched):97 pairedAnode.append(anode[i])98 pairedPmt.append(pmt[i - 1 + j])99 anode[i].isMatched = True100 pmt[i - 1 + j].isMatched = True 101 wasMatch = True102 if(not wasMatch):103 numTossed += 1104#for when anode has more acquisitions than pmt105if(anodeLen > pmtLen):106 for i in range(len(pmt)):107 wasMatch = False108 if(i == 0): #if you are looking at the first element in the large list, compare it to the next three acquisitions109 for j in range(3):110 if(abs(pmt[i].timestamp - anode[i + j].timestamp) < 10 and not pmt[i].isMatched and not anode[i+j].isMatched):111 pairedPmt.append(pmt[i])112 pairedAnode.append(anode[i + j])113 pmt[i].isMatched = True114 anode[i + j].isMatched = True115 wasMatch = True116 elif(i == len(pmt) - 1): #if you are looking at the last element in the large list, compare it to the next three acquisitions117 for j in range(3):118 if(abs(pmt[i].timestamp - anode[i - j].timestamp) < 10 and not pmt[i].isMatched and not anode[i-j].isMatched):119 pairedPmt.append(pmt[i])120 pairedAnode.append(anode[i - j])121 pmt[i].isMatched = True122 anode[i - j].isMatched = True123 wasMatch = True124 else:125 for j in range(3):126 if(abs(pmt[i].timestamp - anode[i - 1 + j].timestamp) < 10 and not pmt[i].isMatched and not anode[i - 1 + j].isMatched):127 pairedPmt.append(pmt[i])128 pairedAnode.append(anode[i - 1 + j])129 pmt[i].isMatched = True130 anode[i - 1 + j].isMatched = True 131 wasMatch = True132 133 if(not wasMatch):134 numTossed += 1135'''136if(anodeLen > pmtLen):137 for i in range(len(anode):138 isMatched = False139 for j in range(3):140 if(abs(anode[i].timestamp - pmt[i +j].timestamp) < 10 and not isMatched):141 pairedAnode.append(anode[i])142 pairedPmt.append(pmt[i + j])143 isMatched = True144elif(pmtLen > anodeLen):145 for i in range(len(pmt)):146 isMatched = False147 for j in range(3):148 if(abs(pmt[i].timestamp - anode[i+ j].timestamp) < 10 and not isMatched):149 pairedPmt.append(pmt[i])150 pairedAnode.append(anode[i+j])151 isMatched = True 152''' 153 154 155#The following section can be uncommented to display the timestamp values in anodeTimes and pmtTimes156#This process slows down the program157'''158print("-------------------- now displaying anodeTimes --------------") 159for i in range(len(anodeTimes)): #iterate through and print timestamp values of anodeTimes160 print(anodeTimes[i])161 print('\n')162print("-------------------- now displaying pmtTimes --------------")163 164for i in range(len(pmtTimes)): #iterate through and print timestamp values of pmtTimes165 print(pmtTimes[i])166 print('\n')167'''168timeDifs = [] #difference between timestamps is stored here169voltDifs = [] #difference between voltages is stored here170count = 1 #serves as an index for the time differences171#for a, p in zip(anodeTimes, pmtTimes): 172for a, p in zip(pairedAnode, pairedPmt):173 #timeDifs.append( abs(a - p) )174 timeDifs.append(abs(a.timestamp - p.timestamp))175 voltDifs.append(abs(a.voltage - p.voltage))176 print("%1d %10d %20s %10f %20s %f %20s %10d" % (count, abs(a.timestamp - p.timestamp), "anode voltage: ", a.voltage, "pmt voltage: ", p.voltage, "voltage diff: ", abs(a.voltage - p.voltage)))177 difsXaxis.append(count)178 count += 1179print("\n")180print("The average time difference between the two oscilloscopes is: ")181print(sum(timeDifs) / len(timeDifs)) #print average182print("\n")183print("the standard deviation is:") #print standard deviation184print(statistics.stdev(timeDifs))185print("\n")186print("the median is:")187print(statistics.median(timeDifs)) #print median188print('\n\n')189print("The average voltage difference between the two oscilloscopes is: ") #not sure if I want to plot this yet190print(sum(voltDifs) / len(voltDifs)) #print average191print("\n")192print("the standard deviation is:") #print standard deviation193print(statistics.stdev(voltDifs))194print("\n")195print("the median is:")196print(statistics.median(voltDifs)) 197print('\n\n')198print("the number of acquisitions for AD1 is:") #print number of acquisitions199print(len(pairedAnode))200print("the number of acquisitions for AD2 is:")201print(len(pairedPmt))202print('\n\n')203print("The number of acquisitions tossed is:")204print(numTossed)205#figure something out for bipolar distributions206#The following lines generate a histogram in a popup window207fig, (ax1, ax2, ax3, ax4) = plt.subplots(4) # create figure and axes208ax1.hist(timeDifs, bins = 'auto') #figure out how to make bin width 1 ms209ax1.set_title('Time Differences')210ax1.set_xlabel('Time Difference in Milliseconds')211ax1.set_ylabel('Frequency')212count = 1213anodeXaxis = []214pmtXaxis = []215while(count <= len(pairedAnode)):216 anodeXaxis.append(count)217 count += 1218count = 1219#while(count <= len(pmtTimes)):220while(count <= len(pairedPmt)):221 pmtXaxis.append(count)222 count += 1223#ax2.scatter(anodeXaxis, anodeTimes, color="b")224#ax2.scatter(pmtXaxis, pmtTimes, color="r", marker="P")225anodeTimes = []226pmtTimes = []227for i in range(len(pairedAnode)):228 anodeTimes.append(pairedAnode[i].timestamp)229for i in range(len(pairedPmt)):230 pmtTimes.append(pairedPmt[i].timestamp)231ax2.scatter(anodeXaxis, anodeTimes, color="b")232ax2.scatter(pmtXaxis, pmtTimes, color="r", marker="P")233ax2.set_xlabel('acquisition number')234ax2.set_ylabel('Time in miliseconds') 235ax3.scatter(difsXaxis, timeDifs)236ax3.set_xlabel('acq number')237ax3.set_ylabel('Time difs in miliseconds') 238#corr = signal.correlate(anodeTimes, pmtTimes, mode = 'full', method = 'auto')239corr = signal.correlate(anodeTimes, pmtTimes, mode = 'full', method = 'auto')240ax4.plot(corr)241'''242autocorr = np.correlate(anodeTimes, pmtTimes, mode = 'valid')243print('\n\n')244for i in range(len(autocorr)):245 print(autocorr[i])246'''247plt.show()248#pmt folder usually has one more acquisition than the anode folder. This can cause l#arge discrepancies when 249#multiple acquisitions runs are kept in the same folder as non-corresponding acquisitions are subtracted...

Full Screen

Full Screen

schulte.ts

Source:schulte.ts Github

copy

Full Screen

1import { defineStore } from 'pinia'2// 定义数据仓库3import axios from 'axios'45export const useSchulteStore = defineStore('schulte', {6 state: () => {7 return {8 numbers5x5: [9 { id: 1, value: 1, isChecked: false, isMatched: false },10 { id: 2, value: 2, isChecked: false, isMatched: false },11 { id: 3, value: 3, isChecked: false, isMatched: false },12 { id: 4, value: 4, isChecked: false, isMatched: false },13 { id: 5, value: 5, isChecked: false, isMatched: false },14 { id: 6, value: 6, isChecked: false, isMatched: false },15 { id: 7, value: 7, isChecked: false, isMatched: false },16 { id: 8, value: 8, isChecked: false, isMatched: false },17 { id: 9, value: 9, isChecked: false, isMatched: false },18 { id: 10, value: 10, isChecked: false, isMatched: false },19 { id: 11, value: 11, isChecked: false, isMatched: false },20 { id: 12, value: 12, isChecked: false, isMatched: false },21 { id: 13, value: 13, isChecked: false, isMatched: false },22 { id: 14, value: 14, isChecked: false, isMatched: false },23 { id: 15, value: 15, isChecked: false, isMatched: false },24 { id: 16, value: 16, isChecked: false, isMatched: false },25 { id: 17, value: 17, isChecked: false, isMatched: false },26 { id: 18, value: 18, isChecked: false, isMatched: false },27 { id: 19, value: 19, isChecked: false, isMatched: false },28 { id: 20, value: 20, isChecked: false, isMatched: false },29 { id: 21, value: 21, isChecked: false, isMatched: false },30 { id: 22, value: 22, isChecked: false, isMatched: false },31 { id: 23, value: 23, isChecked: false, isMatched: false },32 { id: 24, value: 24, isChecked: false, isMatched: false },33 { id: 25, value: 25, isChecked: false, isMatched: false },34 ],35 number3x3: [36 { id: 1, value: 1, isChecked: false, isMatched: false },37 { id: 2, value: 2, isChecked: false, isMatched: false },38 { id: 3, value: 3, isChecked: false, isMatched: false },39 { id: 4, value: 4, isChecked: false, isMatched: false },40 { id: 5, value: 5, isChecked: false, isMatched: false },41 { id: 6, value: 6, isChecked: false, isMatched: false },42 { id: 7, value: 7, isChecked: false, isMatched: false },43 { id: 8, value: 8, isChecked: false, isMatched: false },44 { id: 9, value: 9, isChecked: false, isMatched: false },45 ],46 number4x4: [47 { id: 1, value: 1, isChecked: false, isMatched: false },48 { id: 2, value: 2, isChecked: false, isMatched: false },49 { id: 3, value: 3, isChecked: false, isMatched: false },50 { id: 4, value: 4, isChecked: false, isMatched: false },51 { id: 5, value: 5, isChecked: false, isMatched: false },52 { id: 6, value: 6, isChecked: false, isMatched: false },53 { id: 7, value: 7, isChecked: false, isMatched: false },54 { id: 8, value: 8, isChecked: false, isMatched: false },55 { id: 9, value: 9, isChecked: false, isMatched: false },56 { id: 10, value: 10, isChecked: false, isMatched: false },57 { id: 11, value: 11, isChecked: false, isMatched: false },58 { id: 12, value: 12, isChecked: false, isMatched: false },59 { id: 13, value: 13, isChecked: false, isMatched: false },60 { id: 14, value: 14, isChecked: false, isMatched: false },61 { id: 15, value: 15, isChecked: false, isMatched: false },62 { id: 16, value: 16, isChecked: false, isMatched: false },63 ], 64 letter5x6: [65 { id: 1, value: 'A', isChecked: false, isMatched: false },66 { id: 2, value: 'B', isChecked: false, isMatched: false },67 { id: 3, value: 'C', isChecked: false, isMatched: false },68 { id: 4, value: 'D', isChecked: false, isMatched: false },69 { id: 5, value: 'E', isChecked: false, isMatched: false },70 { id: 6, value: 'F', isChecked: false, isMatched: false },71 { id: 7, value: 'G', isChecked: false, isMatched: false },72 { id: 8, value: 'H', isChecked: false, isMatched: false },73 { id: 9, value: 'I', isChecked: false, isMatched: false },74 { id: 10, value: 'J', isChecked: false, isMatched: false },75 { id: 11, value: 'K', isChecked: false, isMatched: false },76 { id: 12, value: 'L', isChecked: false, isMatched: false },77 { id: 13, value: 'M', isChecked: false, isMatched: false },78 { id: 14, value: 'N', isChecked: false, isMatched: false },79 { id: 15, value: 'O', isChecked: false, isMatched: false },80 { id: 16, value: 'P', isChecked: false, isMatched: false },81 { id: 17, value: 'Q', isChecked: false, isMatched: false },82 { id: 18, value: 'R', isChecked: false, isMatched: false },83 { id: 19, value: 'S', isChecked: false, isMatched: false },84 { id: 20, value: 'T', isChecked: false, isMatched: false },85 { id: 21, value: 'U', isChecked: false, isMatched: false },86 { id: 22, value: 'V', isChecked: false, isMatched: false },87 { id: 23, value: 'W', isChecked: false, isMatched: false },88 { id: 24, value: 'X', isChecked: false, isMatched: false },89 { id: 25, value: 'Y', isChecked: false, isMatched: false },90 { id: 26, value: 'Z', isChecked: false, isMatched: false },91 ], 92 zhcn5x6: [93 { id: 1, value: '日', isChecked: false, isMatched: false },94 { id: 2, value: '照', isChecked: false, isMatched: false },95 { id: 3, value: '香', isChecked: false, isMatched: false },96 { id: 4, value: '炉', isChecked: false, isMatched: false },97 { id: 5, value: '生', isChecked: false, isMatched: false },98 { id: 6, value: '紫', isChecked: false, isMatched: false },99 { id: 7, value: '烟', isChecked: false, isMatched: false },100 { id: 8, value: '遥', isChecked: false, isMatched: false },101 { id: 9, value: '看', isChecked: false, isMatched: false },102 { id: 10, value: '瀑', isChecked: false, isMatched: false },103 { id: 11, value: '布', isChecked: false, isMatched: false },104 { id: 12, value: '挂', isChecked: false, isMatched: false },105 { id: 13, value: '前', isChecked: false, isMatched: false },106 { id: 14, value: '川', isChecked: false, isMatched: false },107 { id: 15, value: '飞', isChecked: false, isMatched: false },108 { id: 16, value: '流', isChecked: false, isMatched: false },109 { id: 17, value: '直', isChecked: false, isMatched: false },110 { id: 18, value: '下', isChecked: false, isMatched: false },111 { id: 19, value: '三', isChecked: false, isMatched: false },112 { id: 20, value: '千', isChecked: false, isMatched: false },113 { id: 21, value: '尺', isChecked: false, isMatched: false },114 { id: 22, value: '疑', isChecked: false, isMatched: false },115 { id: 23, value: '是', isChecked: false, isMatched: false },116 { id: 24, value: '银', isChecked: false, isMatched: false },117 { id: 25, value: '河', isChecked: false, isMatched: false },118 { id: 26, value: '落', isChecked: false, isMatched: false },119 { id: 27, value: '九', isChecked: false, isMatched: false },120 { id: 28, value: '天', isChecked: false, isMatched: false },121 ], 122 }123 },124 getters: {125 square3x3: (state) => {126 const shuffle = arr => arr.sort(() => 0.5 - Math.random())127 return shuffle(state.number3x3)128 },129130 square4x4: (state) => {131 const shuffle = arr => arr.sort(() => 0.5 - Math.random())132 return shuffle(state.number4x4)133 },134 square5x5N: (state) => {135 const shuffle = arr => arr.sort(() => 0.5 - Math.random())136 return shuffle(state.numbers5x5)137 },138 square5x6L: (state) => {139 const shuffle = arr => arr.sort(() => 0.5 - Math.random())140 return shuffle(state.letter5x6)141 },142 square5x6CN: (state) => {143 const shuffle = arr => arr.sort(() => 0.5 - Math.random())144 return shuffle(state.zhcn5x6)145 },146147 },148 actions: {149 handleClick() {150 this.isChecked = !this.isChecked151152 },153154 }, ...

Full Screen

Full Screen

video-game.functions.spec.ts

Source:video-game.functions.spec.ts Github

copy

Full Screen

1import { createDefaultVideoGameFilters, IVideoGameFilters } from '../video-game-listing';2import { IVideoGame } from './video-game.interface';3import {4 videoGameMatchesFavoritesFilter,5 videoGameMatchesPlatformFilter,6 videoGameMatchesSearchQuery7} from './video-game.functions';8describe('with Super Mario Odyssey', () => {9 let superMarioOdyssey: IVideoGame;10 beforeEach(() => {11 superMarioOdyssey = {12 id: '1',13 title: 'Super Mario Odyssey',14 description: 'description',15 platform: 'Nintendo Switch',16 youtubeUrl: 'youtube.com',17 favorite: false,18 };19 });20 describe('videoGameMatchesSearchQuery(superMarioOdyssey, "Super")', () => {21 it('returns true', () => {22 const isMatched = videoGameMatchesSearchQuery(superMarioOdyssey, 'Super');23 expect(isMatched).toEqual(true);24 });25 });26 describe('videoGameMatchesSearchQuery(superMarioOdyssey, "Zelda")', () => {27 it('returns false', () => {28 const isMatched = videoGameMatchesSearchQuery(superMarioOdyssey, 'Zelda');29 expect(isMatched).toEqual(false);30 });31 });32 describe('videoGameMatchesSearchQuery(superMarioOdyssey, "")', () => {33 it('returns true', () => {34 const isMatched = videoGameMatchesSearchQuery(superMarioOdyssey, '');35 expect(isMatched).toEqual(true);36 });37 });38 describe('videoGameMatchesSearchQuery(superMarioOdyssey, falsy)', () => {39 it('returns true', () => {40 const isMatched = videoGameMatchesSearchQuery(superMarioOdyssey, null);41 expect(isMatched).toEqual(true);42 });43 });44 describe('videoGameMatchesPlatformFilter(superMarioOdyssey, nintendoSwitch)', () => {45 it('returns true', () => {46 const nintendoSwitch: IVideoGameFilters = {47 ...createDefaultVideoGameFilters(),48 platform: 'Nintendo Switch',49 };50 const isMatched = videoGameMatchesPlatformFilter(superMarioOdyssey, nintendoSwitch);51 expect(isMatched).toEqual(true);52 });53 });54 describe('videoGameMatchesPlatformFilter(superMarioOdyssey, nintendoSwitch)', () => {55 it('returns true', () => {56 const nintendoSwitch: IVideoGameFilters = {57 ...createDefaultVideoGameFilters(),58 platform: 'Nintendo Switch',59 };60 const isMatched = videoGameMatchesPlatformFilter(superMarioOdyssey, nintendoSwitch);61 expect(isMatched).toEqual(true);62 });63 });64 describe('videoGameMatchesPlatformFilter(superMarioOdyssey, pc)', () => {65 it('returns false', () => {66 const pc: IVideoGameFilters = {67 ...createDefaultVideoGameFilters(),68 platform: 'PC',69 };70 const isMatched = videoGameMatchesPlatformFilter(superMarioOdyssey, pc);71 expect(isMatched).toEqual(false);72 });73 });74 describe('videoGameMatchesPlatformFilter(superMarioOdyssey, falsy)', () => {75 it('returns true', () => {76 const isMatched = videoGameMatchesPlatformFilter(superMarioOdyssey, null);77 expect(isMatched).toEqual(true);78 });79 });80 describe('and it is favourited', () => {81 beforeEach(() => {82 superMarioOdyssey = { ...superMarioOdyssey, favorite: true };83 });84 describe('videoGameMatchesFavoritesFilter(superMarioOdyssey, favorites:true)', () => {85 it('returns true', () => {86 const showFavorites: IVideoGameFilters = {87 ...createDefaultVideoGameFilters(),88 favorites: true,89 };90 const isMatched = videoGameMatchesFavoritesFilter(superMarioOdyssey, showFavorites);91 expect(isMatched).toEqual(true);92 });93 });94 describe('videoGameMatchesFavoritesFilter(superMarioOdyssey, favorites:false)', () => {95 it('returns true', () => {96 const showFavorites: IVideoGameFilters = {97 ...createDefaultVideoGameFilters(),98 favorites: false,99 };100 const isMatched = videoGameMatchesFavoritesFilter(superMarioOdyssey, showFavorites);101 expect(isMatched).toEqual(true);102 });103 });104 });105 describe('and it is not favourited', () => {106 beforeEach(() => {107 superMarioOdyssey = { ...superMarioOdyssey, favorite: false };108 });109 describe('videoGameMatchesFavoritesFilter(superMarioOdyssey, favorites:true)', () => {110 it('returns false', () => {111 const filters: IVideoGameFilters = {112 ...createDefaultVideoGameFilters(),113 favorites: true,114 };115 const isMatched = videoGameMatchesFavoritesFilter(superMarioOdyssey, filters);116 expect(isMatched).toEqual(false);117 });118 });119 describe('videoGameMatchesFavoritesFilter(superMarioOdyssey, favorites:false)', () => {120 it('returns true', () => {121 const filters: IVideoGameFilters = {122 ...createDefaultVideoGameFilters(),123 favorites: false,124 };125 const isMatched = videoGameMatchesFavoritesFilter(superMarioOdyssey, filters);126 expect(isMatched).toEqual(true);127 });128 });129 });130});131describe('when the game is falsy', () => {132 describe('videoGameMatchesSearchQuery(falsy, "Super")', () => {133 it('returns false', () => {134 const isMatched = videoGameMatchesSearchQuery(null, 'Super');135 expect(isMatched).toEqual(false);136 });137 });138 describe('videoGameMatchesPlatformFilter(falsy, "Nintendo Switch")', () => {139 const nintendoSwitch: IVideoGameFilters = {140 ...createDefaultVideoGameFilters(),141 platform: 'Nintendo Switch'142 };143 it('returns false', () => {144 const isMatched = videoGameMatchesPlatformFilter(null, nintendoSwitch);145 expect(isMatched).toEqual(false);146 });147 });...

Full Screen

Full Screen

checker.py

Source:checker.py Github

copy

Full Screen

1import ROOT2file = ROOT.TFile.Open('test.root','read')3file.cd()4file.cd('sorter')5tree = ROOT.gDirectory.FindObjectAny('vertexTree')6failing_match = 07this_event = -18myevents = {}9for event in tree :10# if event.isfirst > 0.5 : continue11 evt = event.evt12 onlvtxsize = event.onlvtxsize13 ntrk = event.ntrk 14 ntrk5gev = event.ntrk5gev 15 ntrk10gev = event.ntrk10gev 16 cl = event.cl 17 sumpt2 = event.sumpt2 18 ltpt = event.ltpt 19 avesumpt = event.avesumpt 20 isfirst = event.isfirst21 ismatched = event.ismatched22 23# discr = -3.1327991846824776e-02 * sumpt2 + \24# 8.8394987781991623e-04 * ntrk + \25# 5.7524818636658849e-04 * ntrk5gev + \26# 1.3525466529345670e-02 * ntrk10gev + \27# 5.6848729864949356e-02 * ltpt + \28# 1.6917675215048249e-05 * avesumpt 29# discr = 8.8394987781991623e-04 * sumpt2 + \30# 5.7524818636658849e-04 * ntrk + \31# 1.3525466529345670e-02 * ntrk5gev + \32# 5.6848729864949356e-02 * ntrk10gev + \33# 1.6917675215048249e-05 * ltpt + \34# -5.6139379732648184e-05 * avesumpt 35# discr = 8.7935450672209565e-04 * sumpt2 + \36# 3.6420911807874448e-04 * ntrk + \37# 1.4202446017075245e-02 * ntrk5gev + \38# 6.2321686696701580e-02 * ntrk10gev + \39# 1.6742885500209335e-05 * ltpt + \40# -5.4981590355099178e-05 * avesumpt 41# print 3.8324663627255950e-04 * sumpt2, '\t', 2.4421095537881357e-04 *ntrk, '\t',6.3290404218937875e-03 * ntrk5gev, '\t', 2.8800916885034698e-02 *ntrk10gev42# discr = 3.8324663627255950e-04 * sumpt2 + \43# 2.4421095537881357e-04 * ntrk + \44# 6.3290404218937875e-03 * ntrk5gev + \45# 2.8800916885034698e-02 * ntrk10gev 46# discr = 3.8324663630406381e-04 * sumpt2 + \47# -4.2916529418151064e-02 * ntrk + \48# 4.3203073772384547e-02 * ntrk-ntrk5gev + \49# 4.9415876361901409e-02 * ntrk5gev-ntrk10gev + \50# 7.8265682935863348e-02 * ntrk10gev 51 discr = 6.7857799012604862e-04 * sumpt2 + \52 -2.6500643043350961e-04 * ntrk + \53 -2.4409283096776284e-06 * avesumpt 54# discr = -1*discr55 56 if evt != this_event : 57 myevents.update({evt:{'disc':[],'ismatched':[],'sumpt2':[]}})58 myevents[evt]['disc' ].append(discr)59 myevents[evt]['ismatched'].append(ismatched)60 myevents[evt]['sumpt2' ].append(sumpt2)61 else : 62 myevents[evt]['disc' ].append(discr)63 myevents[evt]['ismatched'].append(ismatched)64 myevents[evt]['sumpt2' ].append(sumpt2)65 66 this_event = event.evt67import pdb ; pdb.set_trace() 68bad = 069good = 070for event in myevents.keys() :71 try :72 if myevents[event]['ismatched'].index(1) == myevents[event]['disc'].index(max(myevents[event]['disc'])) : good += 173 else : bad += 174 except :75 bad += 176 77print 'tot ', len(myevents)78print 'good', good79print 'bad ', bad80import pdb ; pdb.set_trace() 81# evt = event.evt82# onlvtxsize = event.onlvtxsize83# ntrk = event.ntrk 84# ntrk5gev = event.ntrk5gev 85# ntrk10gev = event.ntrk10gev 86# cl = event.cl 87# sumpt2 = event.sumpt2 88# ltpt = event.ltpt 89# avesumpt = event.avesumpt 90# # weigh = event.weigh 91# isfirst = event.isfirst92# ismatched = event.ismatched93# 94# 95# print evt96# failing_match += 197# 98# 99# 100# 101# 102# 103# 104# #print evt105# #print discr,'\t\t',sumpt2,'\t\t',ismatched,'\t\t',isfirst106# if evt != this_event :107# print 'cazzo'108# disc_dict = {}109# disc_dict.update({ismatched:[discr,sumpt2]})110# else :111# disc_dict.update({ismatched:[discr,sumpt2]})112# 113# import pdb ; pdb.set_trace() 114# 115# this_event = evt116# ...

Full Screen

Full Screen

tiles.ts

Source:tiles.ts Github

copy

Full Screen

1// Store all possible tiles in an array of objects2// Each object has an unique name and a href to an image3export const TILES = [4 { name: 'stekepanne', src: './images/1.svg', image: null, isMatched: false },5 {6 name: 'hodetelefoner',7 src: './images/2.svg',8 image: null,9 isMatched: false,10 },11 { name: 'gulrot', src: './images/3.svg', image: null, isMatched: false },12 { name: 'pokal', src: './images/4.svg', image: null, isMatched: false },13 { name: 'gitar', src: './images/5.svg', image: null, isMatched: false },14 { name: 'snømann', src: './images/6.svg', image: null, isMatched: false },15 { name: 'gris', src: './images/7.svg', image: null, isMatched: false },16 { name: 'ugle', src: './images/8.svg', image: null, isMatched: false },17 { name: 'chaplin', src: './images/9.svg', image: null, isMatched: false },18 { name: 'kake', src: './images/10.svg', image: null, isMatched: false },19 { name: 'hamburger', src: './images/11.svg', image: null, isMatched: false },20 {21 name: 'gammel mann',22 src: './images/12.svg',23 image: null,24 isMatched: false,25 },26 { name: 'parasoll', src: './images/13.svg', image: null, isMatched: false },27 { name: 'palme', src: './images/14.svg', image: null, isMatched: false },28 { name: 'kuleramme', src: './images/15.svg', image: null, isMatched: false },29 { name: 'trekkspill', src: './images/16.svg', image: null, isMatched: false },30 { name: 'medalje', src: './images/17.svg', image: null, isMatched: false },31 { name: 'gondol', src: './images/18.svg', image: null, isMatched: false },32 { name: 'fly', src: './images/19.svg', image: null, isMatched: false },33 {34 name: 'vekkeklokke',35 src: './images/20.svg',36 image: null,37 isMatched: false,38 },39 {40 name: 'rom-monster',41 src: './images/21.svg',42 image: null,43 isMatched: false,44 },45 { name: 'romvesen', src: './images/22.svg', image: null, isMatched: false },46 { name: 'sykebil', src: './images/23.svg', image: null, isMatched: false },47 { name: 'anker', src: './images/24.svg', image: null, isMatched: false },48 { name: 'lastebil', src: './images/25.svg', image: null, isMatched: false },49 {50 name: 'forskrekket ansikt',51 src: './images/26.svg',52 image: null,53 isMatched: false,54 },55 { name: 'bil', src: './images/27.svg', image: null, isMatched: false },56 { name: 'avocado', src: './images/28.svg', image: null, isMatched: false },57 { name: 'øks', src: './images/29.svg', image: null, isMatched: false },58 { name: 'tåteflaske', src: './images/30.svg', image: null, isMatched: false },59 { name: 'baby', src: './images/31.svg', image: null, isMatched: false },60 {61 name: 'søppelbøtte',62 src: './images/32.svg',63 image: null,64 isMatched: false,65 },66 { name: 'hus', src: './images/33.svg', image: null, isMatched: false },67 { name: 'chili', src: './images/34.svg', image: null, isMatched: false },68 { name: 'tre', src: './images/35.svg', image: null, isMatched: false },69 { name: 'hjort', src: './images/36.svg', image: null, isMatched: false },70 { name: 'telefon', src: './images/37.svg', image: null, isMatched: false },...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1import { isMatched } from 'storybook-root';2import { isMatched } from 'storybook-root';3import { isMatched } from 'storybook-root';4import { isMatched } from 'storybook-root';5import { isMatched } from 'storybook-root';6import { isMatched } from 'storybook-root';7import { isMatched } from 'storybook-root';8import { isMatched } from 'storybook-root';9import { isMatched } from 'storybook-root';10import { isMatched } from 'storybook-root';11import { isMatched } from 'storybook-root';12import { isMatched } from 'storybook-root';13import { isMatched } from 'storybook-root';14import { isMatched } from 'storybook-root';15import { isMatched } from 'storybook-root';16import { isMatched } from 'storybook-root';17import { isMatched } from 'storybook-root';18import { isMatched } from 'storybook-root';19import { isMatched } from 'storybook-root';

Full Screen

Using AI Code Generation

copy

Full Screen

1import { isMatched } from 'storybook-root-decorator';2import { storiesOf } from '@storybook/react';3import { withReadme } from 'storybook-readme';4const story = storiesOf('Button', module).addDecorator(5 withReadme(readme),6 withInfo({7 }),8);9if (isMatched('Button')) {10 story.add('default', () => <ButtonWrapper />);11 story.add('disabled', () => <ButtonWrapper disabled />);12 story.add('with icon', () => <ButtonWrapper icon="download" />);13 story.add('with icon and text', () => (14 ));15 story.add('with icon and text and disabled', () => (16 ));17}18import { isMatched } from 'storybook-root-decorator';19if (isMatched('Button')) {20 describe('Button', () => {21 it('should render default', () => {22 const wrapper = shallow(<ButtonWrapper />);23 expect(wrapper).toMatchSnapshot();24 });25 it('should render disabled', () => {26 const wrapper = shallow(<ButtonWrapper disabled />);27 expect(wrapper).toMatchSnapshot();28 });29 it('should render with icon', () => {30 const wrapper = shallow(<ButtonWrapper icon="download" />);31 expect(wrapper).toMatchSnapshot();32 });33 it('should render with icon and text', () => {34 const wrapper = shallow(<ButtonWrapper icon="download" text="Download" />);35 expect(wrapper).toMatchSnapshot();36 });37 it('should render with icon and text and disabled', () => {38 const wrapper = shallow(39 );40 expect(wrapper).toMatchSnapshot();41 });42 });43}44import { storiesOf } from '@storybook/react';45import { withReadme } from 'storybook-readme';

Full Screen

Using AI Code Generation

copy

Full Screen

1import { isMatched } from 'storybook-root';2import { storiesOf, action } from '@kadira/storybook';3storiesOf('Button', module)4 .add('with text', () => (5 <button onClick={action('clicked')} disabled={!isMatched('Button', 'with text')}>6 .add('with some emoji', () => (7 <button onClick={action('clicked')} disabled={!isMatched('Button', 'with some emoji')}>8 ));9import { configure } from '@kadira/storybook';10const req = require.context('../src/components', true, /stories\.js$/);11function loadStories() {12 req.keys().forEach(filename => req(filename));13}14configure(loadStories, module);15const path = require('path');16module.exports = {17 module: {18 {19 include: path.resolve(__dirname, '../'),20 },21 },22};23import 'storybook-root/register';24import 'storybook-root/config';25const path = require('path');26module.exports = {27 module: {28 {29 include: path.resolve(__dirname, '../'),30 },31 },32};33import 'storybook-root/register';34import 'storybook-root/config';35const path = require('path');36module.exports = {37 module: {38 {39 include: path.resolve(__dirname, '../'),40 },41 },42};43import 'storybook-root/register';44import 'storybook-root/config';45const path = require('path');46module.exports = {

Full Screen

Using AI Code Generation

copy

Full Screen

1import { isMatched } from 'storybook-root'2export default function test() {3 const result = isMatched('test')4 console.log(result)5}6import { isMatched } from 'storybook-root'7export const parameters = {8 actions: { argTypesRegex: "^on[A-Z].*" },9 controls: { expanded: true },10 viewMode: isMatched('test') ? 'story' : 'docs',11}12import { isMatched } from 'storybook-root'13export const parameters = {14 actions: { argTypesRegex: "^on[A-Z].*" },15 controls: { expanded: true },16 viewMode: isMatched('test') ? 'story' : 'docs',17}18import { isMatched } from 'storybook-root'19export const parameters = {20 actions: { argTypesRegex: "^on[A-Z].*" },21 controls: { expanded: true },22 viewMode: isMatched('test') ? 'story' : 'docs',23}24import { isMatched } from 'storybook-root'25export const parameters = {26 actions: { argTypesRegex: "^on[A-Z].*" },27 controls: { expanded: true },28 viewMode: isMatched('test') ? 'story' : 'docs',29}30import { isMatched } from 'storybook-root'31export const parameters = {32 actions: { argTypesRegex: "^on[A-Z].*" },33 controls: { expanded: true },34 viewMode: isMatched('test') ? 'story' : 'docs',35}

Full Screen

Using AI Code Generation

copy

Full Screen

1const { isMatched } = require('storybook-root-provider');2const story = 'storyName';3const storybook = 'storybookName';4const isMatch = isMatched(story, storybook);5console.log(isMatch);6const { isMatched } = require('storybook-root-provider');7const story = 'storyName';8const storybook = 'storybookName';9const isMatch = isMatched(story, storybook);10console.log(isMatch);11const { isMatched } = require('storybook-root-provider');12const story = 'storyName';13const storybook = 'storybookName';14const isMatch = isMatched(story, storybook);15console.log(isMatch);16const { isMatched } = require('storybook-root-provider');17const story = 'storyName';18const storybook = 'storybookName';19const isMatch = isMatched(story, storybook);20console.log(isMatch);21const { isMatched } = require('storybook-root-provider');22const story = 'storyName';23const storybook = 'storybookName';24const isMatch = isMatched(story, storybook);25console.log(isMatch);26const { isMatched } = require('storybook-root-provider');27const story = 'storyName';28const storybook = 'storybookName';29const isMatch = isMatched(story, storybook);30console.log(isMatch);31const { isMatched } = require('storybook-root-provider');32const story = 'storyName';33const storybook = 'storybookName';34const isMatch = isMatched(story, storybook);35console.log(isMatch);

Full Screen

Using AI Code Generation

copy

Full Screen

1import { isMatched } from '@storybook/addon-storyshots'2const storybookRoot = require.resolve('@storybook/react')3const isStorybook = isMatched(storybookRoot)4console.log(isStorybook)5import { isMatched } from '@storybook/addon-storyshots'6const storybookRoot = require.resolve('@storybook/react')7const isStorybook = isMatched(storybookRoot)8console.log(isStorybook)9import React, { Component } from 'react';10import { DragSource } from 'react-dnd';11import { findDOMNode } from 'react-dom';12const cardSource = {13 beginDrag(props) {14 return {15 };16 },17};18@DragSource('card', cardSource, (connect, monitor) => ({19 connectDragSource: connect.dragSource(),20 isDragging: monitor.isDragging(),21}))22export default class Card extends Component {23 render() {24 const { text, isDragging, connectDragSource } = this.props;25 const opacity = isDragging ? 0 : 1;26 return connectDragSource(27 <div style={{ ...style, opacity }}>28 {text}29 );30 }31}32import React from 'react';33import { shallow } from 'enzyme';34import Card from './Card';35describe('<Card />', () => {36 it('should render without crashing', () => {37 const wrapper = shallow(<Card text="test" />);38 expect(wrapper).toHaveLength(1);39 });40});41jest.mock('react-dnd', () => ({42 DragSource: jest.fn(() => component => component),43}));44jest.mock('react-dnd', () => ({45 DragSource: () => component => component,46}));

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run storybook-root automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful