Skip to content

Commit 34ef88e

Browse files
committed
Update tests to use group_by
1 parent 52e4ebe commit 34ef88e

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

nbgrader/tests/api/test_models.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -673,13 +673,20 @@ def test_query_needs_manual_grade_manualgraded(submissions):
673673
def test_query_max_score(submissions):
674674
db = submissions[0]
675675

676-
assert [5, 10] == sorted([x[0] for x in db.query(api.GradeCell.max_score).all()])
677-
assert [5, 5, 10, 10] == sorted([x[1] for x in db.query(api.Grade.id, api.Grade.max_score).all()])
678-
assert [15] == sorted([x[1] for x in db.query(api.Notebook.id, api.Notebook.max_score).all()])
679-
assert [15, 15] == sorted([x[1] for x in db.query(api.SubmittedNotebook.id, api.SubmittedNotebook.max_score).all()])
680-
assert [15] == sorted([x[1] for x in db.query(api.Assignment.id, api.Assignment.max_score).all()])
681-
assert [15, 15] == sorted([x[1] for x in db.query(api.SubmittedAssignment.id, api.SubmittedAssignment.max_score).all()])
682-
assert [15, 15] == sorted([x[1] for x in db.query(api.Student.id, api.Student.max_score).all()])
676+
assert [5, 10] == sorted([x[1] for x in db.query(
677+
api.GradeCell.id, api.GradeCell.max_score).group_by(api.GradeCell.id).all()])
678+
assert [5, 5, 10, 10] == sorted([x[1] for x in db.query(
679+
api.Grade.id, api.Grade.max_score).group_by(api.Grade.id).all()])
680+
assert [15] == sorted([x[1] for x in db.query(
681+
api.Notebook.id, api.Notebook.max_score).group_by(api.Notebook.id).all()])
682+
assert [15, 15] == sorted([x[1] for x in db.query(
683+
api.SubmittedNotebook.id, api.SubmittedNotebook.max_score).group_by(api.SubmittedNotebook.id).all()])
684+
assert [15] == sorted([x[1] for x in db.query(
685+
api.Assignment.id, api.Assignment.max_score).group_by(api.Assignment.id).all()])
686+
assert [15, 15] == sorted([x[1] for x in db.query(
687+
api.SubmittedAssignment.id, api.SubmittedAssignment.max_score).group_by(api.SubmittedAssignment.id).all()])
688+
assert [15, 15] == sorted([x[1] for x in db.query
689+
(api.Student.id, api.Student.max_score).group_by(api.Student.id).all()])
683690

684691

685692
def test_query_score_ungraded(submissions):

0 commit comments

Comments
 (0)