From 398a2c45d76246005638b7018b5cd7b52ebd4d12 Mon Sep 17 00:00:00 2001 From: Dougal Matthews Date: Tue, 25 Nov 2014 16:04:44 +0000 Subject: [PATCH] Fix tests under Python 3 --- .travis.yml | 5 ----- quiz/tests.py | 2 +- quiz/views.py | 4 ++-- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0a9f9a2..e32930c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,8 +8,3 @@ install: - pip install tox script: - tox -e $TOX_ENV -matrix: - fast_finish: true - allow_failures: - - env: TOX_ENV=py33 - - env: TOX_ENV=py34 diff --git a/quiz/tests.py b/quiz/tests.py index 9f3bd38..50caa80 100644 --- a/quiz/tests.py +++ b/quiz/tests.py @@ -135,7 +135,7 @@ class TestProgress(TestCase): category_dict = self.p1.list_all_cat_scores - self.assertIn(str(category_dict.keys()[0]), self.p1.score) + self.assertIn(str(list(category_dict.keys())[0]), self.p1.score) self.assertIn(self.c1.category, self.p1.score) diff --git a/quiz/views.py b/quiz/views.py index aac3d71..5e6819c 100644 --- a/quiz/views.py +++ b/quiz/views.py @@ -265,8 +265,8 @@ class QuizTake(FormView): if self.quiz.random_order is True: random.shuffle(question_list) - if all([self.quiz.max_questions, - self.quiz.max_questions < len(question_list)]): + if self.quiz.max_questions and (self.quiz.max_questions + < len(question_list)): question_list = question_list[:self.quiz.max_questions] # session score for anon users -- 2.39.5