Skip to content

Commit f95be0c

Browse files
committedFeb 8, 2024
style: beautify 8b742d3
1 parent 8b742d3 commit f95be0c

File tree

2 files changed

+30
-13
lines changed

2 files changed

+30
-13
lines changed
 

‎semantic_release/version/algorithm.py

+1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ def _bfs_for_latest_version_in_history(
7474
tag_sha_2_version_lookup = {
7575
tag.commit.hexsha: version for tag, version in full_release_tags_and_versions
7676
}
77+
7778
# Step 3. Latest full release version within the history of the current branch
7879
# Breadth-first search the merge-base and its parent commits for one which matches
7980
# the tag of the latest full release tag in history

‎tests/unit/semantic_release/version/test_algorithm.py

+29-13
Original file line numberDiff line numberDiff line change
@@ -27,31 +27,47 @@ def test_bfs_for_latest_version_in_history():
2727
repo = Repo()
2828
expected_version = Version.parse("1.0.0")
2929
v1_commit = Commit(repo, binsha=b"0" * 20)
30+
3031
class TagReferenceOverride(TagReference):
31-
commit = v1_commit # type: ignore - mocking the commit property
32+
commit = v1_commit # type: ignore - mocking the commit property
3233

3334
v1_tag = TagReferenceOverride(repo, "refs/tags/v1.0.0", check_path=False)
3435

35-
trunk = Commit(repo, binsha=b"3" * 20, parents=[
36-
Commit(repo, binsha=b"2" * 20, parents=[
37-
Commit(repo, binsha=b"1" * 20, parents=[v1_commit]),
38-
]),
39-
])
36+
trunk = Commit(
37+
repo,
38+
binsha=b"3" * 20,
39+
parents=[
40+
Commit(
41+
repo,
42+
binsha=b"2" * 20,
43+
parents=[
44+
Commit(repo, binsha=b"1" * 20, parents=[v1_commit]),
45+
],
46+
),
47+
],
48+
)
4049
start_commit = Commit(
4150
repo,
4251
binsha=b"6" * 20,
4352
parents=[
4453
trunk,
45-
Commit(repo, binsha=b"5" * 20, parents=[
46-
Commit(repo, binsha=b"4" * 20, parents=[trunk]),
47-
]),
48-
]
54+
Commit(
55+
repo,
56+
binsha=b"5" * 20,
57+
parents=[
58+
Commit(repo, binsha=b"4" * 20, parents=[trunk]),
59+
],
60+
),
61+
],
4962
)
5063

5164
# Execute
52-
actual = _bfs_for_latest_version_in_history(start_commit, [
53-
(v1_tag, expected_version),
54-
])
65+
actual = _bfs_for_latest_version_in_history(
66+
start_commit,
67+
[
68+
(v1_tag, expected_version),
69+
],
70+
)
5571

5672
# Verify
5773
assert expected_version == actual

0 commit comments

Comments
 (0)
Please sign in to comment.