Skip to content

Commit 8bd2b1c

Browse files
author
github-actions
committed
[github-actions] Apply auto-formatting using ruff
1 parent d266fd9 commit 8bd2b1c

File tree

2 files changed

+42
-13
lines changed

2 files changed

+42
-13
lines changed

mix_messy_graph/test_verify.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,9 @@ def test_base():
7979
rs.git.commit(message="Mention feature for creating books")
8080
rs.git.tag("v1.0")
8181

82-
rs.files.create_or_update("features.md", FEATURES_FILE_CONTENT_FIX_HEADINGS_COMMIT)
82+
rs.files.create_or_update(
83+
"features.md", FEATURES_FILE_CONTENT_FIX_HEADINGS_COMMIT
84+
)
8385
rs.git.add("features.md")
8486
rs.git.commit(message="Fix phrasing of heading")
8587

@@ -118,7 +120,11 @@ def test_invalid_features_content():
118120
rs.git.commit(message="Add the delete feature")
119121

120122
output = test.run()
121-
assert_output(output, GitAutograderStatus.UNSUCCESSFUL, [FEATURES_FILE_CONTENT_INVALID.format(commit="Fix phrasing of heading")])
123+
assert_output(
124+
output,
125+
GitAutograderStatus.UNSUCCESSFUL,
126+
[FEATURES_FILE_CONTENT_INVALID.format(commit="Fix phrasing of heading")],
127+
)
122128

123129

124130
def test_non_squash_merge_used():

mix_messy_graph/verify.py

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
GitAutograderOutput,
44
GitAutograderExercise,
55
GitAutograderStatus,
6-
GitAutograderCommit
6+
GitAutograderCommit,
77
)
88
from itertools import zip_longest
99

@@ -89,7 +89,12 @@ def get_commit_from_message(
8989
return None
9090

9191

92-
def verify_commit_file_content(exercise: GitAutograderExercise, commit: GitAutograderCommit | None, file_name: str, expected_content: List[str]):
92+
def verify_commit_file_content(
93+
exercise: GitAutograderExercise,
94+
commit: GitAutograderCommit | None,
95+
file_name: str,
96+
expected_content: List[str],
97+
):
9398
"""Checkout to specific commit and verify that the file content of the given commit matches the expected content."""
9499
if not commit:
95100
return
@@ -100,7 +105,13 @@ def verify_commit_file_content(exercise: GitAutograderExercise, commit: GitAutog
100105

101106
contents = [line.strip() for line in file.readlines() if line.strip() != ""]
102107
if contents != expected_content:
103-
raise exercise.wrong_answer([FEATURES_FILE_CONTENT_INVALID.format(commit=commit.commit.message.strip())])
108+
raise exercise.wrong_answer(
109+
[
110+
FEATURES_FILE_CONTENT_INVALID.format(
111+
commit=commit.commit.message.strip()
112+
)
113+
]
114+
)
104115
exercise.repo.branches.branch("main").checkout()
105116

106117

@@ -143,21 +154,33 @@ def verify(exercise: GitAutograderExercise) -> GitAutograderOutput:
143154
# Verify that the features.md file is correct
144155
# Checkout to specific commit to verify the contents of features.md
145156
features_commit = get_commit_from_message(commits, "Add features.md")
146-
verify_commit_file_content(exercise, features_commit, "features.md", EXPECTED_LINES_FEATURES_COMMIT)
157+
verify_commit_file_content(
158+
exercise, features_commit, "features.md", EXPECTED_LINES_FEATURES_COMMIT
159+
)
147160

148-
create_books_commit = get_commit_from_message(commits, "Mention feature for creating books")
149-
verify_commit_file_content(exercise, create_books_commit, "features.md", EXPECTED_LINES_CREATE_BOOK_COMMIT)
161+
create_books_commit = get_commit_from_message(
162+
commits, "Mention feature for creating books"
163+
)
164+
verify_commit_file_content(
165+
exercise, create_books_commit, "features.md", EXPECTED_LINES_CREATE_BOOK_COMMIT
166+
)
150167

151168
fix_heading_commit = get_commit_from_message(commits, "Fix phrasing of heading")
152-
verify_commit_file_content(exercise, fix_heading_commit, "features.md", EXPECTED_LINES_FIX_HEADING_COMMIT)
169+
verify_commit_file_content(
170+
exercise, fix_heading_commit, "features.md", EXPECTED_LINES_FIX_HEADING_COMMIT
171+
)
153172

154173
add_search_commit = get_commit_from_message(commits, "Add the search feature")
155-
verify_commit_file_content(exercise, add_search_commit, "features.md", EXPECTED_LINES_SEARCH_COMMIT)
174+
verify_commit_file_content(
175+
exercise, add_search_commit, "features.md", EXPECTED_LINES_SEARCH_COMMIT
176+
)
156177

157178
delete_feature_commit = get_commit_from_message(commits, "Add the delete feature")
158-
verify_commit_file_content(exercise, delete_feature_commit, "features.md", EXPECTED_LINES_DELETE_COMMIT)
179+
verify_commit_file_content(
180+
exercise, delete_feature_commit, "features.md", EXPECTED_LINES_DELETE_COMMIT
181+
)
159182

160183
return exercise.to_output(
161-
["You have successfully completed the exercise!"],
162-
GitAutograderStatus.SUCCESSFUL
184+
["You have successfully completed the exercise!"],
185+
GitAutograderStatus.SUCCESSFUL,
163186
)

0 commit comments

Comments
 (0)