tests: sort using key function (#36515)

This commit is contained in:
Frédéric Péters 2019-11-13 11:18:04 +01:00
parent be4101e5a7
commit 61efee3db9
1 changed files with 1 additions and 7 deletions

View File

@ -439,13 +439,7 @@ def test_backoffice_listing_order(pub):
formdata.store()
inversed_receipt_time_order = list(reversed([str(x) for x in sorted(ids)]))
def odd_cmp(x, y):
if x % 2 == y % 2:
return cmp(x, y)
if x % 2:
return -1
return 1
last_update_time_order = [str(x) for x in sorted(ids, odd_cmp)]
last_update_time_order = [str(x) for x in sorted(ids, key=lambda x: int(x) if int(x) % 2 else int(x)+1000)]
app = login(get_app(pub))
resp = app.get('/backoffice/management/form-title/')