2323)
2424
2525
26- def get_commit_from_message (commits : List [GitAutograderCommit ], message : str ) -> Optional [GitAutograderCommit ]:
26+ def get_commit_from_message (
27+ commits : List [GitAutograderCommit ], message : str
28+ ) -> Optional [GitAutograderCommit ]:
2729 """Find a commit with the given message from a list of commits."""
2830 for commit in commits :
2931 if message .strip () == commit .commit .message .strip ():
@@ -45,22 +47,27 @@ def verify_branch(
4547 branch_helper = exercise .repo .branches
4648 if not branch_helper .has_branch (branch_name ):
4749 raise exercise .wrong_answer ([MISSING_BRANCH .format (branch_name = branch_name )])
48-
50+
4951 branch = branch_helper .branch (branch_name )
5052 latest_commit = branch .latest_commit
51-
53+
5254 if latest_commit .hexsha == expected_start_commit .hexsha :
5355 raise exercise .wrong_answer ([MISSING_COMMIT .format (branch_name = branch_name )])
5456
55- if expected_start_commit .hexsha not in [parent .hexsha for parent in latest_commit .commit .parents ]:
57+ if expected_start_commit .hexsha not in [
58+ parent .hexsha for parent in latest_commit .commit .parents
59+ ]:
5660 raise exercise .wrong_answer ([WRONG_START .format (branch_name = branch_name )])
57-
61+
5862 with latest_commit .file ("story.txt" ) as content :
5963 if expected_content not in content :
60- raise exercise .wrong_answer ([WRONG_CONTENT .format (
61- branch_name = branch_name ,
62- expected_content = expected_content
63- )])
64+ raise exercise .wrong_answer (
65+ [
66+ WRONG_CONTENT .format (
67+ branch_name = branch_name , expected_content = expected_content
68+ )
69+ ]
70+ )
6471
6572
6673def verify (exercise : GitAutograderExercise ) -> GitAutograderOutput :
@@ -71,14 +78,14 @@ def verify(exercise: GitAutograderExercise) -> GitAutograderOutput:
7178 branch_name = "visitor-line" ,
7279 expected_start_commit = describe_location_commit ,
7380 expected_content = "I heard someone knocking at the door." ,
74- exercise = exercise
81+ exercise = exercise ,
7582 )
7683
7784 verify_branch (
7885 branch_name = "sleep-line" ,
7986 expected_start_commit = describe_location_commit ,
8087 expected_content = "I fell asleep on the couch." ,
81- exercise = exercise
88+ exercise = exercise ,
8289 )
8390
8491 return exercise .to_output (
0 commit comments