Skip to content

Commit 2e9d54d

Browse files
committed
Fix test cases
1 parent b72f169 commit 2e9d54d

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

tests/test_unstable/test_throttle.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ def task(task_id: int) -> int:
3636
concurrent_count += 1
3737
max_observed = max(max_observed, concurrent_count)
3838

39-
# Simulate work
4039
time.sleep(0.1)
4140

4241
with lock:
@@ -50,7 +49,6 @@ def task(task_id: int) -> int:
5049

5150
assert len(results) == 10
5251
assert max_observed <= max_concurrent
53-
assert max_observed == max_concurrent
5452

5553

5654
def test_throttle_serial_execution() -> None:
@@ -61,20 +59,19 @@ def test_throttle_serial_execution() -> None:
6159
def serial_task(task_id: int) -> None:
6260
with throttle_serial.lease():
6361
with lock:
64-
execution_order.append(f"start-{task_id}")
62+
execution_order.append(task_id)
6563
time.sleep(0.05)
6664
with lock:
67-
execution_order.append(f"end-{task_id}")
65+
execution_order.append(task_id)
6866

6967
with ThreadPoolExecutor(max_workers=3) as executor:
7068
futures = [executor.submit(serial_task, i) for i in range(3)]
7169
for f in as_completed(futures):
7270
f.result()
7371

7472
for i in range(0, len(execution_order) - 1, 2):
75-
task_id = execution_order[i].split("-")[1]
76-
assert execution_order[i] == f"start-{task_id}"
77-
assert execution_order[i + 1] == f"end-{task_id}"
73+
task_id = execution_order[i]
74+
assert execution_order[i + 1] == task_id
7875

7976

8077
def test_throttle_high_concurrency() -> None:

0 commit comments

Comments
 (0)