Update tests/test_utils_tqdm_mod.py
Run CI Tests / test (push) Successful in 37s

This commit is contained in:
2025-07-30 14:38:11 +02:00
parent a7bac06d7c
commit 26192a8d20
+4 -4
View File
@@ -19,7 +19,7 @@ def extract_last_line(output):
def test_complete_progress_bar():
f = io.StringIO()
with redirect_stdout(f):
for _ in tqdm_mod(range(3), desc="TestBar"):
for _ in tqdm_mod(range(3), desc="TestBar", file=f, dynamic_ncols=False):
sleep(0.001)
last_line = extract_last_line(f.getvalue())
assert last_line == "TestBar: 100%|########################| 3.00/3.00 [00:00<00:00, 3.0 Hz]"
@@ -27,7 +27,7 @@ def test_complete_progress_bar():
def test_set_progress_multiple_points():
f = io.StringIO()
with redirect_stdout(f):
bar = tqdm_mod(total=5, desc="SetBar")
bar = tqdm_mod(total=5, desc="SetBar", file=f, dynamic_ncols=False)
bar.set(1.0)
bar.set(2.0)
bar.set(3.5)
@@ -45,7 +45,7 @@ def test_set_progress_multiple_points():
def test_custom_unit():
f = io.StringIO()
with redirect_stdout(f):
for _ in tqdm_mod(range(4), desc="StepBar", unit="step"):
for _ in tqdm_mod(range(4), desc="StepBar", unit="step", file=f, dynamic_ncols=False):
sleep(0.001)
last_line = extract_last_line(f.getvalue())
assert last_line == "StepBar: 100%|########################| 4.00/4.00 [00:00<00:00, 4.0step/s]"
@@ -53,7 +53,7 @@ def test_custom_unit():
def test_clamp_above_total():
f = io.StringIO()
with redirect_stdout(f):
bar = tqdm_mod(total=10, desc="ClampBar")
bar = tqdm_mod(total=10, desc="ClampBar", file=f, dynamic_ncols=False)
bar.set(12) # Clamp to 10
bar.close()
last_line = extract_last_line(f.getvalue())