示例#1
0
文件: ql.py 项目: guyromb/many-ql
def main():
    if len(sys.argv) == 1:
    	print("Run as follows: python ql.py YOUR_SOURCECODE.ql")
    	exit(0)

    filename = sys.argv[1]

    if not os.path.isfile(filename):
    	print("ERROR: %s cannot be found." %(filename), file=sys.stderr)
    	exit(1)

    parseResult = parse(filename)
    if parseResult is None:
        exit(1)

    if not typecheck(parseResult):
        exit(1)

    evaluator = createEvaluator(parseResult.questionnaire)

    models = [QuestionModel(identifier, evaluator) for identifier in evaluator.identifiers()]
    view = View(title = 'Questions')
    controller = Controller(models, view)

    controller.run()
示例#2
0
def main():
    if len(sys.argv) == 1:
        print("Run as follows: python ql.py YOUR_SOURCECODE.ql")
        exit(0)

    filename = sys.argv[1]

    if not os.path.isfile(filename):
        print("ERROR: %s cannot be found." % (filename), file=sys.stderr)
        exit(1)

    parseResult = parse(filename)
    if parseResult is None:
        exit(1)

    if not typecheck(parseResult):
        exit(1)

    evaluator = createEvaluator(parseResult.questionnaire)

    models = [
        QuestionModel(identifier, evaluator)
        for identifier in evaluator.identifiers()
    ]
    view = View(title='Questions')
    controller = Controller(models, view)

    controller.run()
 def test(self):
     evaluator = createEvaluator(self.questionnaire)
     self.assertEqual(2, len(evaluator.questions()))
 def test(self):
     evaluator = createEvaluator(self.questionnaire)
     questions = evaluator.questions()
     self.assertEqual(2, len(questions))
     self.assertEqual(QLInteger(3),
                      evaluator.getValue(questions[1].identifier))
 def test(self):
     evaluator = createEvaluator(self.questionnaire)
     questions = evaluator.questions()
     self.assertEqual(1, len(questions))
     self.assertEqual('Foo1', questions[0].text)
示例#6
0
 def test(self):
     evaluator = createEvaluator(self.questionnaire)
     self.assertEqual(1, len(evaluator.questions()))
示例#7
0
 def test(self):
     evaluator = createEvaluator(self.questionnaire)
     questions = evaluator.questions()
     self.assertEqual(1, len(questions))
     self.assertEqual('Foo1', questions[0].text)
示例#8
0
 def test(self):
     evaluator = createEvaluator(self.questionnaire)
     questions = evaluator.questions()
     self.assertEqual(2, len(questions))
     self.assertEqual(QLInteger(3), evaluator.getValue(questions[1].identifier))