From 966679bdaa4b17af7560a9f4b673eaab5e2f66f4 Mon Sep 17 00:00:00 2001 From: Isaac Wahhab Date: Mon, 29 Mar 2021 10:10:43 -0700 Subject: [PATCH] Unit test fix --- rich/spinner.py | 2 +- tests/test_spinner.py | 12 ++++-------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/rich/spinner.py b/rich/spinner.py index 4bd80eca..f780d591 100644 --- a/rich/spinner.py +++ b/rich/spinner.py @@ -3,7 +3,7 @@ from typing import cast, List, Optional, TYPE_CHECKING from ._spinners import SPINNERS from .measure import Measurement from .table import Table -from .text import Text, TextType +from .text import Text if TYPE_CHECKING: from .console import Console, ConsoleOptions, RenderResult, RenderableType diff --git a/tests/test_spinner.py b/tests/test_spinner.py index d30b2774..28aac7fc 100644 --- a/tests/test_spinner.py +++ b/tests/test_spinner.py @@ -2,7 +2,7 @@ import pytest from rich.console import Console from rich.measure import Measurement -from rich.panel import Panel +from rich.rule import Rule from rich.spinner import Spinner @@ -40,7 +40,7 @@ def test_spinner_update(): nonlocal time return time - console = Console(width=80, force_terminal=True, get_time=get_time) + console = Console(width=20, force_terminal=True, get_time=get_time) console.begin_capture() spinner = Spinner("dots") console.print(spinner) @@ -49,17 +49,13 @@ def test_spinner_update(): time += 80 / 1000 console.print(spinner) - spinner.update(text=Panel("Bar")) + spinner.update(text=Rule("Bar")) time += 80 / 1000 console.print(spinner) result = console.end_capture() print(repr(result)) - expected = ( - f"⠋\n" - f"\x1b[32m⠙\x1b[0m Bar\n" - f"\x1b[32m⠸\x1b[0m ╭─────╮\n │ Bar │\n ╰─────╯\n" - ) + expected = f"⠋\n\x1b[32m⠙\x1b[0m Bar\n\x1b[32m⠸\x1b[0m \x1b[92m────── \x1b[0mBar\x1b[92m ───────\x1b[0m\n" assert result == expected