Skip to content

Commit 9cf3794

Browse files
Mantisusvdusek
andauthored
test: Update test_list_actors_sorting to check sorting order (#784)
Closes: #773 Co-authored-by: Vlada Dusek <v.dusek96@gmail.com>
1 parent f0b2350 commit 9cf3794

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

‎tests/integration/test_actor.py‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from __future__ import annotations
44

5+
from datetime import UTC, datetime
56
from typing import TYPE_CHECKING, cast
67

78
from ._utils import get_random_resource_name, maybe_await
@@ -67,6 +68,14 @@ async def test_list_actors_sorting(client: ApifyClient | ApifyClientAsync) -> No
6768
assert actors_page.items is not None
6869
assert isinstance(actors_page.items, list)
6970

71+
min_dt = datetime.min.replace(tzinfo=UTC)
72+
sorted_items = sorted(
73+
actors_page.items,
74+
key=lambda a: (a.stats.last_run_started_at if a.stats else None) or min_dt,
75+
reverse=True,
76+
)
77+
assert actors_page.items == sorted_items
78+
7079

7180
async def test_actor_create_update_delete(client: ApifyClient | ApifyClientAsync) -> None:
7281
"""Test creating, updating, and deleting an Actor."""

0 commit comments

Comments
 (0)