From d1cd347a31f29efb12c0701f99870cea15baab70 Mon Sep 17 00:00:00 2001 From: amartya-dev Date: Sun, 4 Oct 2020 23:00:52 +0530 Subject: [PATCH] Simplify the download column test --- tests/test_progress.py | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/tests/test_progress.py b/tests/test_progress.py index 16ed4ab4..e94d75ed 100644 --- a/tests/test_progress.py +++ b/tests/test_progress.py @@ -82,23 +82,10 @@ def test_time_remaining_column(): def test_download_progress_uses_decimal_units() -> None: column = DownloadColumn() - - size_params = [pow(10, ex) for ex in range(3, 25, 3)] - units = ["KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"] - - # Check rendering params for all sizes - for i in range(len(size_params)): - test_task = Task( - i, f"test_{units[i]}", size_params[i], 0, _get_time=lambda: 1.0 - ) - list_rendered = [] - for n in range(10): - test_task.completed = size_params[i] / 10 * (n + 1) - list_rendered.append(str(column.render(test_task))) - expected = [f"0.{completed}/1.0 {units[i]}" for completed in range(1, 10)] + [ - f"1.0/1.0 {units[i]}" - ] - assert list_rendered == expected + test_task = Task(1, "test", 1000, 500, _get_time=lambda: 1.0) + rendered_progress = str(column.render(test_task)) + expected = "0.5/1.0 KB" + assert rendered_progress == expected def test_task_ids():