Commit 287a086c by Lyla Fischer

changed tests

parent e49fd700
......@@ -60,29 +60,25 @@ class GraderTest(unittest.TestCase):
scores = []
all, graded = aggregate_scores(scores)
self.assertTrue(all.earned == 0)
self.assertTrue(graded.earned == 0)
self.assertTrue(all.possible == 0)
self.assertTrue(graded.possible == 0)
self.assertEqual(all, Score(earned=0, possible=0, weight=1, graded=False, section="summary"))
self.assertEqual(graded, Score(earned=0, possible=0, weight=1, graded=True, section="summary"))
scores.append(Score(0,5,1,False, 'foo'))
scores.append(Score(earned=0, possible=5, weight=1, graded=False, section="summary"))
all, graded = aggregate_scores(scores)
self.assertTrue(all.earned == 0)
self.assertTrue(graded.earned == 0)
print all
self.assertTrue(all.possible == 1)
self.assertTrue(graded.possible == 0)
self.assertEqual(all, Score(earned=0, possible=1, weight=1, graded=False, section="summary"))
self.assertEqual(graded, Score(earned=0, possible=0, weight=1, graded=True, section="summary"))
scores.append(Score(3,5,1,True, 'foo'))
scores.append(Score(earned=3, possible=5, weight=1, graded=True, section="summary"))
all, graded = aggregate_scores(scores)
self.assertTrue(all.earned == 3.0/5)
self.assertTrue(graded.earned == 3.0/5)
self.assertTrue(all.possible == 2)
self.assertTrue(graded.possible == 1)
self.assertEqual(all, Score(earned=3.0/5, possible=2, weight=1, graded=False, section="summary"))
self.assertEqual(graded, Score(earned=3.0/5, possible=0, weight=1, graded=True, section="summary"))
scores.append(Score(2,5,2,True, 'foo'))
scores.append(Score(earned=2, possible=5, weight=2, graded=True, section="summary"))
all, graded = aggregate_scores(scores)
self.assertTrue(all.earned == 7.0/5)
self.assertTrue(graded.earned == 7.0/5)
self.assertTrue(all.possible == 4)
self.assertTrue(graded.possible == 3)
self.assertEqual(all, Score(earned=7.0/5, possible=4, weight=1, graded=False, section="summary"))
self.assertEqual(graded, Score(earned=7.0/5, possible=3, weight=1, graded=True, section="summary"))
scores.append(Score(earned=2, possible=5, weight=0, graded=True, section="summary"))
all, graded = aggregate_scores(scores)
self.assertEqual(all, Score(earned=7.0/5, possible=4, weight=1, graded=False, section="summary"))
self.assertEqual(graded, Score(earned=7.0/5, possible=3, weight=1, graded=True, section="summary"))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment