2020-07-07 15:26:25 +00:00
|
|
|
from rich.console import Console
|
|
|
|
|
|
|
|
|
|
|
|
def test_jupyter():
|
|
|
|
console = Console(force_jupyter=True)
|
2022-06-09 22:07:28 +00:00
|
|
|
assert console.width == 115
|
2022-06-09 21:52:37 +00:00
|
|
|
assert console.height == 100
|
2020-07-07 15:26:25 +00:00
|
|
|
assert console.color_system == "truecolor"
|
2022-06-09 21:52:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
def test_jupyter_columns_env():
|
|
|
|
console = Console(_environ={"JUPYTER_COLUMNS": "314"}, force_jupyter=True)
|
|
|
|
assert console.width == 314
|
|
|
|
# width take precedence
|
|
|
|
console = Console(width=40, _environ={"JUPYTER_COLUMNS": "314"}, force_jupyter=True)
|
|
|
|
assert console.width == 40
|
|
|
|
# Should not fail
|
2022-06-09 22:07:28 +00:00
|
|
|
console = Console(
|
|
|
|
width=40, _environ={"JUPYTER_COLUMNS": "broken"}, force_jupyter=True
|
|
|
|
)
|
2022-06-09 21:52:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
def test_jupyter_lines_env():
|
|
|
|
console = Console(_environ={"JUPYTER_LINES": "220"}, force_jupyter=True)
|
|
|
|
assert console.height == 220
|
|
|
|
# height take precedence
|
|
|
|
console = Console(height=40, _environ={"JUPYTER_LINES": "220"}, force_jupyter=True)
|
|
|
|
assert console.height == 40
|
|
|
|
# Should not fail
|
2022-06-09 22:07:28 +00:00
|
|
|
console = Console(
|
|
|
|
width=40, _environ={"JUPYTER_LINES": "broken"}, force_jupyter=True
|
|
|
|
)
|