Files
textual/tests/test_log.py
Will McGugan cdacc36ca7 disabled fix
2024-09-23 13:35:44 +01:00

26 lines
802 B
Python
Raw Blame History

from textual.app import App, ComposeResult
from textual.widgets import Log
def test_process_line():
log = Log()
assert log._process_line("foo") == "foo"
assert log._process_line("foo\t") == "foo "
assert log._process_line("\0foo") == "<EFBFBD>foo"
async def test_disabled_log_no_attribute_error() -> None:
"""Ensure that initializing the log with disabled=True does not
raise an AttributeError.
Regression test for https://github.com/Textualize/textual/issues/5028
"""
class DisabledLogApp(App):
def compose(self) -> ComposeResult:
yield Log(disabled=True)
async with DisabledLogApp().run_test() as pilot:
# If no exception is raised, the test will pass
log = pilot.app.query_one(Log)
assert log.disabled == True