test: Fix failing pytest asserts in GradesheetTest.test_weighted_grading.

This commit is contained in:
Usman Khalid
2021-03-03 18:09:01 +05:00
parent 8a8dbee340
commit 0e7664fbce

View File

@@ -43,14 +43,14 @@ class GradesheetTest(unittest.TestCase):
agg_fields['first_attempted'] = now
scores.append(ProblemScore(weighted_earned=3, weighted_possible=5, graded=True, **prob_fields))
all_total, graded_total = aggregate_scores(scores)
assert round(all_total - AggregatedScore(tw_earned=3, tw_possible=10, graded=False, **agg_fields), 7) >= 0
assert round(graded_total - AggregatedScore(tw_earned=3, tw_possible=5, graded=True, **agg_fields), 7) >= 0
assert all_total == AggregatedScore(tw_earned=3, tw_possible=10, graded=False, **agg_fields)
assert graded_total == AggregatedScore(tw_earned=3, tw_possible=5, graded=True, **agg_fields)
# (0/5 non-graded) + (3/5 graded) + (2/5 graded) = 5/15 total, 5/10 graded
scores.append(ProblemScore(weighted_earned=2, weighted_possible=5, graded=True, **prob_fields))
all_total, graded_total = aggregate_scores(scores)
assert round(all_total - AggregatedScore(tw_earned=5, tw_possible=15, graded=False, **agg_fields), 7) >= 0
assert round(graded_total - AggregatedScore(tw_earned=5, tw_possible=10, graded=True, **agg_fields), 7) >= 0
assert all_total == AggregatedScore(tw_earned=5, tw_possible=15, graded=False, **agg_fields)
assert graded_total == AggregatedScore(tw_earned=5, tw_possible=10, graded=True, **agg_fields)
@ddt.ddt