mirror of https://github.com/Textualize/rich.git
append text test
This commit is contained in:
parent
350cbbe6c8
commit
5a9f0dcc36
|
@ -778,7 +778,8 @@ class Text(JupyterMixin):
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def append_text(self, text: "Text") -> "Text":
|
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:
|
Returns:
|
||||||
Text: Returns self for chaining.
|
Text: Returns self for chaining.
|
||||||
|
|
|
@ -275,6 +275,13 @@ def test_append():
|
||||||
test.append(1)
|
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():
|
def test_split():
|
||||||
test = Text()
|
test = Text()
|
||||||
test.append("foo", "red")
|
test.append("foo", "red")
|
||||||
|
|
Loading…
Reference in New Issue