Beispiel #1
0
    def integrityCheck(self):
        python_parts = {
            'Before Experiment', 'Begin Experiment', 'Begin Routine',
            'Each Frame', 'End Routine', 'End Experiment'
        }
        js_parts = {
            'Before JS Experiment', 'Begin JS Experiment', 'Begin JS Routine',
            'Each JS Frame', 'End JS Routine', 'End JS Experiment'
        }
        for part in python_parts:
            if len(str(self.params[part])):
                alerttools.checkPythonSyntax(self, part)

        for part in js_parts:
            if len(str(self.params[part])):
                alerttools.checkJavaScriptSyntax(self, part)
Beispiel #2
0
 def writeExperimentEndCodeJS(self, buff):
     if len(str(self.params['End JS Experiment'])
            ) and not self.params['disabled']:
         alerttools.checkJavaScriptSyntax(self, 'End JS Experiment')
         buff.writeIndentedLines(
             str(self.params['End JS Experiment']) + '\n')
Beispiel #3
0
 def writeFrameCodeJS(self, buff):
     if len(str(
             self.params['Each JS Frame'])) and not self.params['disabled']:
         alerttools.checkJavaScriptSyntax(self, 'Each JS Frame')
         buff.writeIndentedLines(str(self.params['Each JS Frame']) + '\n')
Beispiel #4
0
 def writeRoutineStartCodeJS(self, buff):
     if len(str(self.params['Begin JS Routine'])
            ) and not self.params['disabled']:
         alerttools.checkJavaScriptSyntax(self, 'Begin JS Routine')
         buff.writeIndentedLines(
             str(self.params['Begin JS Routine']) + '\n')
Beispiel #5
0
 def writeRoutineEndCodeJS(self, buff):
     if len(str(self.params['End JS Routine'])):
         alerttools.checkJavaScriptSyntax(self, 'End JS Routine')
         buff.writeIndentedLines(str(self.params['End JS Routine']) + '\n')
Beispiel #6
0
 def writeInitCodeJS(self, buff):
     if len(str(self.params['Begin JS Experiment'])):
         alerttools.checkJavaScriptSyntax(self, 'Begin JS Experiment')
         buff.writeIndentedLines(
             str(self.params['Begin JS Experiment']) + '\n')
Beispiel #7
0
 def test_javascript_syntax(self):
     alerttools.checkJavaScriptSyntax(self.codeComp, 'Begin JS Experiment')
     assert ("JavaScript Syntax Error in 'Begin JS Experiment'" in self.error.alerts[0].msg)
Beispiel #8
0
 def test_javascript_syntax(self):
     alerttools.checkJavaScriptSyntax(self.codeComp, 'Begin JS Experiment')
     sys.stderr.flush()
     assert ("JavaScript Syntax Error in 'Begin JS Experiment'"
             in alertLog[0].msg)
Beispiel #9
0
 def writeExperimentEndCodeJS(self, buff):
     if len(str(self.params['End JS Experiment'])) and not self.params['disabled']:
         alerttools.checkJavaScriptSyntax(self, 'End JS Experiment')
         if self.params['End Experiment']:
             buff.writeIndentedLines("// Run 'End Experiment' code from %(name)s" % self.params)
         buff.writeIndentedLines(str(self.params['End JS Experiment']) + '\n')
Beispiel #10
0
 def writeFrameCodeJS(self, buff):
     if len(str(self.params['Each JS Frame'])) and not self.params['disabled']:
         alerttools.checkJavaScriptSyntax(self, 'Each JS Frame')
         if self.params['Each Frame']:
             buff.writeIndentedLines("// Run 'Each Frame' code from %(name)s" % self.params)
         buff.writeIndentedLines(str(self.params['Each JS Frame']) + '\n')