]> git.parisson.com Git - django_quiz.git/commitdiff
small cleanup, mostly pep8 related modifications
authorTom Walker <tomwalker0472@gmail.com>
Wed, 26 Nov 2014 11:55:50 +0000 (11:55 +0000)
committerTom Walker <tomwalker0472@gmail.com>
Wed, 26 Nov 2014 11:55:50 +0000 (11:55 +0000)
essay/models.py
multichoice/models.py
quiz/models.py
quiz/tests.py
true_false/models.py

index de8dcb189ed4b273f334d6ebe086f7bc031605fe..af02e7aa15399f6e50c4aa47fdd6052ff3fc8121 100644 (file)
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals # for Py2 & Py3 compatibility
+from __future__ import unicode_literals
 from django.utils.encoding import python_2_unicode_compatible
 from django.utils.translation import ugettext as _
 from quiz.models import Question
index f7f3d1aa6735b245b3ab7860cb7ace71d82c789f..22ca026198ac7fb56a41b0276bb2f312850d2162 100644 (file)
@@ -1,5 +1,5 @@
-from __future__ import unicode_literals # for Py2 & Py3 compatibility
-from django.utils.encoding import python_2_unicode_compatible # ditto
+from __future__ import unicode_literals
+from django.utils.encoding import python_2_unicode_compatible
 from django.utils.translation import ugettext as _
 from django.db import models
 from quiz.models import Question
@@ -75,4 +75,3 @@ class Answer(models.Model):
     class Meta:
         verbose_name = _("Answer")
         verbose_name_plural = _("Answers")
-
index f2a497441b8ce6b079e137a9ba1550c5251d55d3..64913d2053da4cb64e086e9ac5d0453cb4f588ba 100644 (file)
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals # for Py2 & Py3 compatibility
+from __future__ import unicode_literals
 import re
 import json
 
@@ -36,7 +36,6 @@ class Category(models.Model):
         verbose_name = _("Category")
         verbose_name_plural = _("Categories")
 
-    # Changed __unicode__() to __str__() for Py2 & Py3 compatibility
     def __str__(self):
         return self.category
 
@@ -57,8 +56,7 @@ class SubCategory(models.Model):
     class Meta:
         verbose_name = _("Sub-Category")
         verbose_name_plural = _("Sub-Categories")
-    
-    # Changed __unicode__() to __str__() for Py2 & Py3 compatibility
+
     def __str__(self):
         return self.sub_category + " (" + self.category.category + ")"
 
@@ -153,7 +151,6 @@ class Quiz(models.Model):
         verbose_name = _("Quiz")
         verbose_name_plural = _("Quizzes")
 
-    # Changed __unicode__() to __str__() for Py2 & Py3 compatibility
     def __str__(self):
         return self.title
 
@@ -526,6 +523,7 @@ class Sitting(models.Model):
         total = self.get_max_score
         return answered, total
 
+
 @python_2_unicode_compatible
 class Question(models.Model):
     """
@@ -572,7 +570,5 @@ class Question(models.Model):
         verbose_name_plural = _("Questions")
         ordering = ['category']
 
-    # Changed __unicode__() to __str__() for Py2 & Py3 compatibility
     def __str__(self):
         return self.content
-
index 50caa80b210bf64beb38e2c60a445191dbdc5260..1b18905d6c1456c419ac938873ffb67e13aa48a9 100644 (file)
@@ -22,20 +22,13 @@ from essay.models import Essay_Question
 
 class TestCategory(TestCase):
     def setUp(self):
-        self.c1 = Category.objects.new_category(category='elderberries')
-        self.c2 = Category.objects.new_category(category='straw.berries')
-        self.c3 = Category.objects.new_category(category='black berries')
-        self.c4 = Category.objects.new_category(category='squishy   berries')
+        self.c1 = Category.objects.new_category(category='squishy   berries')
 
         self.sub1 = SubCategory.objects.create(sub_category='Red',
                                                category=self.c1)
 
     def test_categories(self):
-
-        self.assertEqual(self.c1.category, 'elderberries')
-        self.assertEqual(self.c2.category, 'straw.berries')
-        self.assertEqual(self.c3.category, 'black-berries')
-        self.assertEqual(self.c4.category, 'squishy-berries')
+        self.assertEqual(self.c1.category, 'squishy-berries')
 
     def test_sub_categories(self):
         self.assertEqual(self.sub1.category, self.c1)
@@ -148,7 +141,7 @@ class TestProgress(TestCase):
     def test_subcategory_all_empty(self):
         SubCategory.objects.create(sub_category='pickles',
                                    category=self.c1)
-        self.p1.list_all_cat_scores
+        self.p1.list_all_cat_scores
         # self.assertIn('pickles', self.p1.score)
         # TODO: test after implementing subcategory scoring on progress page
 
index 159c973e48fe54c21d609a328de0c76338342c1c..7bf1adc4cd9fdda3cb70f1b41ac1e1ed9e50887f 100644 (file)
@@ -1,4 +1,4 @@
-from __future__ import unicode_literals # for Py2 & Py3 compatibility
+from __future__ import unicode_literals
 from django.utils.encoding import python_2_unicode_compatible
 from django.utils.translation import ugettext as _
 from django.db import models