summaryrefslogtreecommitdiff
path: root/yaksh/test_models.py
diff options
context:
space:
mode:
authorCruiseDevice2019-01-16 14:59:41 +0530
committerCruiseDevice2019-01-28 13:07:02 +0530
commit5550bdd39df0b5569e6e690bbd715dcd4b8259e7 (patch)
tree3303508eee1c356c00b6487048b5592269f92607 /yaksh/test_models.py
parent85427fceb1c06cf036f2351ebdc0a051b5d4acb6 (diff)
downloadonline_test-5550bdd39df0b5569e6e690bbd715dcd4b8259e7.tar.gz
online_test-5550bdd39df0b5569e6e690bbd715dcd4b8259e7.tar.bz2
online_test-5550bdd39df0b5569e6e690bbd715dcd4b8259e7.zip
Made requested changes in models.py and test_models.py
- Remove 'category' key from legend_display_types dictionary. - Add a condition to check if question type exists before creating category_question_map. - Add test. - Change lambda to list in defaultdict.
Diffstat (limited to 'yaksh/test_models.py')
-rw-r--r--yaksh/test_models.py12
1 files changed, 2 insertions, 10 deletions
diff --git a/yaksh/test_models.py b/yaksh/test_models.py
index 8b9aa37..2e136d5 100644
--- a/yaksh/test_models.py
+++ b/yaksh/test_models.py
@@ -1585,18 +1585,10 @@ class AnswerPaperTestCases(unittest.TestCase):
)
def test_get_categorized_question_indices(self):
- all_questions = self.answerpaper.get_all_ordered_questions()
+ question_indices = {'Programming': [1], 'Objective Type': [2, 3]}
categorized_question_indices = \
self.answerpaper.get_categorized_question_indices()
- questions = all_questions[0:4]
- category_question_map = defaultdict(lambda: [])
- for index, question in enumerate(questions, 1):
- category_question_map[
- legend_display_types[question.type]["label"]
- ].append(index)
- category_question_map = dict(category_question_map)
- self.assertDictEqual(
- category_question_map, categorized_question_indices)
+ self.assertDictEqual(question_indices, categorized_question_indices)
###############################################################################