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 writeExperimentEndCode(self, buff):
     if len(str(self.params['End Experiment'])
            ) and not self.params['disabled']:
         alerttools.checkPythonSyntax(self, 'End Experiment')
         buff.writeIndentedLines(str(self.params['End Experiment']) + '\n')
Beispiel #3
0
 def writeFrameCode(self, buff):
     if len(str(self.params['Each Frame'])) and not self.params['disabled']:
         alerttools.checkPythonSyntax(self, 'Each Frame')
         buff.writeIndentedLines(str(self.params['Each Frame']) + '\n')
Beispiel #4
0
 def writeRoutineStartCode(self, buff):
     if len(str(
             self.params['Begin Routine'])) and not self.params['disabled']:
         alerttools.checkPythonSyntax(self, 'Begin Routine')
         buff.writeIndentedLines(str(self.params['Begin Routine']) + '\n')
Beispiel #5
0
 def writeInitCode(self, buff):
     if len(str(self.params['Begin Experiment'])):
         alerttools.checkPythonSyntax(self, 'Begin Experiment')
         buff.writeIndentedLines(
             str(self.params['Begin Experiment']) + '\n')
Beispiel #6
0
 def writeRoutineEndCode(self, buff):
     if len(str(self.params['End Routine'])):
         alerttools.checkPythonSyntax(self, 'End Routine')
         buff.writeIndentedLines(str(self.params['End Routine']) + '\n')
Beispiel #7
0
 def test_python_syntax(self):
     alerttools.checkPythonSyntax(self.codeComp, 'Begin Experiment')
     assert ("Python Syntax Error in 'Begin Experiment'" in self.error.alerts[0].msg)
Beispiel #8
0
 def test_python_syntax(self):
     alerttools.checkPythonSyntax(self.codeComp, 'Begin Experiment')
     sys.stderr.flush()
     assert ("Python Syntax Error in 'Begin Experiment'" in alertLog[0].msg)
Beispiel #9
0
 def writeRoutineEndCode(self, buff):
     if len(str(self.params['End Routine'])) and not self.params['disabled']:
         alerttools.checkPythonSyntax(self, 'End Routine')
         if self.params['End Routine']:
             buff.writeIndentedLines("# Run 'End Routine' code from %(name)s" % self.params)
         buff.writeIndentedLines(str(self.params['End Routine']) + '\n')
Beispiel #10
0
 def writeInitCode(self, buff):
     if len(str(self.params['Begin Experiment'])) and not self.params['disabled']:
         alerttools.checkPythonSyntax(self, 'Begin Experiment')
         if self.params['Begin Experiment']:
             buff.writeIndentedLines("# Run 'Begin Experiment' code from %(name)s" % self.params)
         buff.writeIndentedLines(str(self.params['Begin Experiment']) + '\n')
Beispiel #11
0
 def writePreCodeJS(self, buff):
     if len(str(self.params['Before JS Experiment'])):
         alerttools.checkPythonSyntax(self, 'Before Experiment')
         buff.writeIndentedLines(
             str(self.params['Before JS Experiment']) + '\n')