summaryrefslogtreecommitdiffstats
path: root/tests/test_styled.py
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tests/test_styled.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/test_styled.py b/tests/test_styled.py
new file mode 100644
index 0000000..8ebe5e8
--- /dev/null
+++ b/tests/test_styled.py
@@ -0,0 +1,15 @@
+import io
+
+from rich.console import Console
+from rich.measure import Measurement
+from rich.styled import Styled
+
+
+def test_styled():
+ styled_foo = Styled("foo", "on red")
+ console = Console(file=io.StringIO(), force_terminal=True)
+ assert Measurement.get(console, styled_foo, 80) == Measurement(3, 3)
+ console.print(styled_foo)
+ result = console.file.getvalue()
+ expected = "\x1b[41mfoo\x1b[0m\n"
+ assert result == expected