mirror of
https://github.com/Textualize/rich.git
synced 2025-08-03 17:48:25 +00:00
append text test
This commit is contained in:
parent
350cbbe6c8
commit
5a9f0dcc36
2 changed files with 9 additions and 1 deletions
|
@ -778,7 +778,8 @@ class Text(JupyterMixin):
|
|||
return self
|
||||
|
||||
def append_text(self, text: "Text") -> "Text":
|
||||
"""Append another Text instance. This method is more performant that Text.append.
|
||||
"""Append another Text instance. This method is more performant that Text.append, but
|
||||
only works for Text.
|
||||
|
||||
Returns:
|
||||
Text: Returns self for chaining.
|
||||
|
|
|
@ -275,6 +275,13 @@ def test_append():
|
|||
test.append(1)
|
||||
|
||||
|
||||
def test_append_text():
|
||||
test = Text("foo")
|
||||
test.append_text(Text("bar", style="bold"))
|
||||
assert str(test) == "foobar"
|
||||
assert test._spans == [Span(3, 6, "bold")]
|
||||
|
||||
|
||||
def test_split():
|
||||
test = Text()
|
||||
test.append("foo", "red")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue