rich/tools/stress_test_pretty.py

22 lines
565 B
Python
Raw Normal View History

2020-08-08 17:51:34 +00:00
from rich.console import Console
2020-08-10 15:37:46 +00:00
from rich.panel import Panel
2020-08-08 17:51:34 +00:00
from rich.pretty import Pretty
2021-11-25 20:47:09 +00:00
from rich._timer import timer
2020-08-08 17:51:34 +00:00
DATA = {
2020-08-24 16:26:30 +00:00
"foo": [1, 2, 3, (), {}, (1, 2, 3), {4, 5, 6, (7, 8, 9)}, "Hello, World"],
2020-08-10 15:37:46 +00:00
"bar": [None, (False, True)] * 2,
2020-10-20 14:03:28 +00:00
"Dune": {
"names": {
2021-02-20 16:39:23 +00:00
"Paul Atreides",
2020-10-20 14:03:28 +00:00
"Vladimir Harkonnen",
2021-02-20 16:39:23 +00:00
"Thufir Hawat",
2020-10-20 14:03:28 +00:00
"Duncan Idaho",
}
},
2020-08-08 17:51:34 +00:00
}
console = Console()
2021-11-25 20:47:09 +00:00
with timer("Stress test"):
for w in range(130):
console.print(Panel(Pretty(DATA, indent_guides=True), width=w))