mirror of https://github.com/Textualize/rich.git
tests for markup property
This commit is contained in:
parent
67f1c7ab29
commit
1c543b746d
|
@ -9,7 +9,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
### Fixed
|
||||
|
||||
- Double print of progress bar in Jupyter
|
||||
- Double print of progress bar in Jupyter https://github.com/willmcgugan/rich/issues/1737
|
||||
|
||||
### Added
|
||||
|
||||
- Added Text.markup property https://github.com/willmcgugan/rich/issues/1751
|
||||
|
||||
## [10.15.2] - 2021-12-02
|
||||
|
||||
|
|
|
@ -715,3 +715,19 @@ def test_on():
|
|||
assert text.get_style_at_offset(console, 0).meta == expected
|
||||
assert text.get_style_at_offset(console, 1).meta == expected
|
||||
assert text.get_style_at_offset(console, 2).meta == expected
|
||||
|
||||
|
||||
def test_markup_property():
|
||||
assert Text("").markup == ""
|
||||
assert Text("foo").markup == "foo"
|
||||
assert Text("foo", style="bold").markup == "[bold]foo[/bold]"
|
||||
assert Text.from_markup("foo [red]bar[/red]").markup == "foo [red]bar[/red]"
|
||||
assert (
|
||||
Text.from_markup("foo [red]bar[/red]", style="bold").markup
|
||||
== "[bold]foo [red]bar[/red][/bold]"
|
||||
)
|
||||
assert (
|
||||
Text.from_markup("[bold]foo [italic]bar[/bold] baz[/italic]").markup
|
||||
== "[bold]foo [italic]bar[/bold] baz[/italic]"
|
||||
)
|
||||
assert Text("[bold]foo").markup == "\\[bold]foo"
|
||||
|
|
Loading…
Reference in New Issue