From 7a9962e6db6998de6e62bd2f5ac6d241af25c7c1 Mon Sep 17 00:00:00 2001 From: v4rgas <66626747+v4rgas@users.noreply.github.com> Date: Wed, 14 May 2025 17:22:21 -0400 Subject: [PATCH] 6c36fbe0-f2e1-4bd1-bcf5-6a4f6ef9b3d2 --- tqdm_8/tqdm/_tqdm.py | 2 +- tqdm_8/tqdm/tests/tests_tqdm.py | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/tqdm_8/tqdm/_tqdm.py b/tqdm_8/tqdm/_tqdm.py index cb28ec5..469947a 100644 --- a/tqdm_8/tqdm/_tqdm.py +++ b/tqdm_8/tqdm/_tqdm.py @@ -222,7 +222,7 @@ def format_meter(n, total, elapsed, ncols=None, prefix='', # Format left/right sides of the bar, and format the bar # later in the remaining space (avoid breaking display) l_bar_user, r_bar_user = bar_format.split('{bar}') - l_bar, r_bar = l_bar_user.format(**bar_args), r_bar_user.format(**bar_args) + l_bar, r_bar = l_bar.format(**bar_args), r_bar.format(**bar_args) else: # Else no progress bar, we can just format and return return bar_format.format(**bar_args) diff --git a/tqdm_8/tqdm/tests/tests_tqdm.py b/tqdm_8/tqdm/tests/tests_tqdm.py index 6da3e10..f085c58 100644 --- a/tqdm_8/tqdm/tests/tests_tqdm.py +++ b/tqdm_8/tqdm/tests/tests_tqdm.py @@ -214,13 +214,9 @@ def test_format_meter(): "100KiB [00:13, 7.69KiB/s]" assert format_meter(100, 1000, 12, ncols=0, rate=7.33) == \ " 10% 100/1000 [00:12<02:02, 7.33it/s]" - # Check that bar_format correctly adapts {bar} size to the rest - assert format_meter(20, 100, 12, ncols=13, rate=8.1, + assert format_meter(20, 100, 12, ncols=30, rate=8.1, bar_format=r'{l_bar}{bar}|{n_fmt}/{total_fmt}') == \ " 20%|" + unich(0x258f) + "|20/100" - assert format_meter(20, 100, 12, ncols=14, rate=8.1, - bar_format=r'{l_bar}{bar}|{n_fmt}/{total_fmt}') == \ - " 20%|" + unich(0x258d) + " |20/100" def test_si_format():