Commit db0f8996 authored by Michał Góral's avatar Michał Góral

Fixed sorting for missing attributes

parent 860c8f91
Pipeline #56673622 passed with stage
in 1 minute and 20 seconds
......@@ -37,9 +37,9 @@ class TaskComparer:
if sp is None and op is None:
continue
if sp is None:
return False ^ rev
if op is None:
return True ^ rev
if op is None:
return False ^ rev
if sp == op:
continue
return (sp < op) ^ rev
......
......@@ -13,12 +13,12 @@ import twc.twutils as twutils
('c', [1, 0, 2, 3]),
('c+', [1, 0, 2, 3]),
('c-', [3, 0, 2, 1]),
('d', [0, 3, 1, 2]),
('d-', [1, 2, 3, 0]), # same as TW: tasks without attr are at the top
('d+', [1, 2, 0, 3]),
('d-', [3, 0, 1, 2]), # same as TW: tasks without attr are at the bottom
('b+,id-', [3, 0, 2, 1]),
('b+,id+', [0, 3, 1, 2]),
('a+,d-,id-', [2, 1, 3, 0]),
('a+,d+,id-', [0, 3, 2, 1]),
('a+,d-,id-', [3, 0, 2, 1]),
('a+,d+,id-', [2, 1, 0, 3]),
])
def test_sort(sortcond, expected_order):
# Keep ids unique and incremented. They simplify investigation and reporting
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment