Esempio n. 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 файл')
Esempio n. 2
0
 def test_GameOpened(self):
     game, _ = questiondata.create_game("Example.xlsx")
     self.assertIsNotNone(game)
Esempio n. 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)
Esempio n. 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)
Esempio n. 5
0
 def test_CategoryQuestionLen(self):
     game, _ = questiondata.create_game("Example.xlsx")
     category = game.get_category_by_name('Красивые картинки')
     self.assertEqual(2, len(category.questions))
Esempio n. 6
0
 def test_Category(self):
     game, _ = questiondata.create_game("Example.xlsx")
     category = game.get_category_by_name('Красивые картинки')
     self.assertIsNotNone(category)
Esempio n. 7
0
 def test_CategoryLen(self):
     game, _ = questiondata.create_game("Example.xlsx")
     self.assertEqual(2, len(game.categories))
Esempio n. 8
0
 def test_GameLen(self):
     game, _ = questiondata.create_game("Example.xlsx")
     self.assertEqual(2, game.length)