示例#1
0
 def OpenPressed(self):
     openfilename = QtWidgets.QFileDialog.getOpenFileName(self, 'Выберите игру', "")[0]
     if openfilename and openfilename.endswith(".xlsx"):
         self.game, error = questiondata.create_game(openfilename)
         if self.game:
             if error:
                 ErrorMessage(error)
             self.state.set_game(self.game)
             self.category_form = category.CategoryForm(self.game)
             self.category_form.category_signal[str].connect(self.CategorySelected)
             self.category_form.show()
     else:
         ErrorMessage('Файл не выбран или формат неверный (выберите .xlxs файл')
示例#2
0
 def test_GameOpened(self):
     game, _ = questiondata.create_game("Example.xlsx")
     self.assertIsNotNone(game)
示例#3
0
 def test_CategoryQuestionPoints(self):
     game, _ = questiondata.create_game("Example.xlsx")
     total_points = 0
     for category in game.categories:
         total_points += category.get_total_points()
     self.assertEqual(60, total_points)
示例#4
0
 def test_CategoryQuestionNumber(self):
     game, _ = questiondata.create_game("Example.xlsx")
     total = 0
     for category in game.categories:
         total += category.get_question_number()
     self.assertEqual(4, total)
示例#5
0
 def test_CategoryQuestionLen(self):
     game, _ = questiondata.create_game("Example.xlsx")
     category = game.get_category_by_name('Красивые картинки')
     self.assertEqual(2, len(category.questions))
示例#6
0
 def test_Category(self):
     game, _ = questiondata.create_game("Example.xlsx")
     category = game.get_category_by_name('Красивые картинки')
     self.assertIsNotNone(category)
示例#7
0
 def test_CategoryLen(self):
     game, _ = questiondata.create_game("Example.xlsx")
     self.assertEqual(2, len(game.categories))
示例#8
0
 def test_GameLen(self):
     game, _ = questiondata.create_game("Example.xlsx")
     self.assertEqual(2, game.length)