Skip to content

Commit 134e514

Browse files
(PTFE-2534) Remove sort and modify test assertion
1 parent de90e55 commit 134e514

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

bert_e/tests/test_bert_e.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ def test_branch_cascade_mixed_versions(self):
569569
2: {'name': 'development/4.3', 'ignore': True},
570570
3: {'name': 'development/5.1.8', 'ignore': True},
571571
4: {'name': 'development/5.1', 'ignore': False},
572-
5: {'name': 'development/10', 'ignore': False}
572+
5: {'name': 'development/10.0', 'ignore': False}
573573
})
574574
tags = ['4.3.16', '4.3.18', '5.1.3', '5.1.7']
575575
fixver = ['5.1.9', '10.0.0']

bert_e/tests/unit/test_sorted.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ def test_compare_branches_major_only_vs_major_minor():
7474
def test_compare_branches_major_minor_micro_vs_major_minor():
7575
branch1 = ((4, 3, 2),)
7676
branch2 = ((4, 3),)
77-
assert compare_branches(branch1, branch2) == -997
77+
assert compare_branches(branch1, branch2) == 2
7878

7979

8080
def test_compare_branches_major_minor_vs_major_minor_micro():
8181
branch1 = ((4, 3),)
8282
branch2 = ((4, 3, 2),)
83-
assert compare_branches(branch1, branch2) == 997
83+
assert compare_branches(branch1, branch2) == -2

bert_e/workflow/gitwaterflow/branches.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,18 @@ def compare_branches(branch1, branch2):
6363
return -1
6464

6565
# Both are major.minor or longer - compare normally
66-
minor1 = version1[1] if len(version1) > 1 else 999
67-
minor2 = version2[1] if len(version2) > 1 else 999
66+
minor1 = version1[1] if len(version1) > 1 else 0
67+
minor2 = version2[1] if len(version2) > 1 else 0
6868

6969
# Compare minor versions
7070
if minor1 != minor2:
7171
return minor1 - minor2
7272

7373
# Same major.minor - extract micro versions
7474
# Default to 0 if no micro
75-
micro1 = version1[2] if len(version1) > 2 else 999
75+
micro1 = version1[2] if len(version1) > 2 else 0
7676
# Default to 0 if no micro
77-
micro2 = version2[2] if len(version2) > 2 else 999
77+
micro2 = version2[2] if len(version2) > 2 else 0
7878

7979
# Compare micro versions
8080
if micro1 != micro2:

0 commit comments

Comments
 (0)