def test_load_survey(self):
        global survey
        s = loadSurvey("test_load.svy")
        self.assertEqual(s.name, "Survey Load Test")
        self.assertEqual(len(s.questions), 2)

        q = s.questions[1]
        self.assertEqual(q.name, "Question1")
        self.assertEqual(len(q.answers), 2)
        a = q.answers[1]
        self.assertEqual(a.value, "answer1")
        self.assertEqual(a.selected, False)
        self.assertEqual(a.editable, False)
        a = q.answers[2]
        self.assertEqual(a.value, "answer2")
        self.assertEqual(a.selected, False)
        self.assertEqual(a.editable, False)

        q = s.questions[2]
        self.assertEqual(q.name, "Question2")
        self.assertEqual(len(q.answers), 3)
        a = q.answers[3]
        self.assertEqual(a.value, "answer3")
        self.assertEqual(a.selected, False)
        self.assertEqual(a.editable, False)
        a = q.answers[4]
        self.assertEqual(a.value, "answer4")
        self.assertEqual(a.selected, False)
        self.assertEqual(a.editable, False)
        a = q.answers[5]
        self.assertEqual(a.value, "answer5")
        self.assertEqual(a.selected, False)
        self.assertEqual(a.editable, False)
Beispiel #2
0
    def test_load_survey(self):
        global survey
        s = loadSurvey("test_load.svy")
        self.assertEqual(s.name, "Survey Load Test")
        self.assertEqual(len(s.questions), 2)

        q = s.questions[1]
        self.assertEqual(q.name, "Question1")
        self.assertEqual(len(q.answers), 2)
        a = q.answers[1]
        self.assertEqual(a.value, "answer1")
        self.assertEqual(a.selected, False)
        self.assertEqual(a.editable, False)
        a = q.answers[2]
        self.assertEqual(a.value, "answer2")
        self.assertEqual(a.selected, False)
        self.assertEqual(a.editable, False)

        q = s.questions[2]
        self.assertEqual(q.name, "Question2")
        self.assertEqual(len(q.answers), 3)
        a = q.answers[3]
        self.assertEqual(a.value, "answer3")
        self.assertEqual(a.selected, False)
        self.assertEqual(a.editable, False)
        a = q.answers[4]
        self.assertEqual(a.value, "answer4")
        self.assertEqual(a.selected, False)
        self.assertEqual(a.editable, False)
        a = q.answers[5]
        self.assertEqual(a.value, "answer5")
        self.assertEqual(a.selected, False)
        self.assertEqual(a.editable, False)
Beispiel #3
0
 def openSurvey(self):
     from survey import Survey, loadSurvey
     filename = QtGui.QFileDialog.getOpenFileName(self,
                                                  "Select survey file", ".",
                                                  "Survey Files (*.svy)")
     survey = loadSurvey(filename)
     sg = QSurveyGrid(survey)
     self.setCentralWidget(sg)
Beispiel #4
0
 def openSurvey(self):
     from survey import Survey, loadSurvey
     filename = QtGui.QFileDialog.getOpenFileName(self, "Select survey file", ".", "Survey Files (*.svy)")
     survey = loadSurvey(filename)
     sg = QSurveyGrid(survey)
     self.setCentralWidget(sg)