()
| 990 | |
| 991 | |
| 992 | def test_slice(): |
| 993 | text = Text.from_markup("[red]foo [bold]bar[/red] baz[/bold]") |
| 994 | assert text[0] == Text("f", spans=[Span(0, 1, "red")]) |
| 995 | assert text[4] == Text("b", spans=[Span(0, 1, "red"), Span(0, 1, "bold")]) |
| 996 | |
| 997 | assert text[:3] == Text("foo", spans=[Span(0, 3, "red")]) |
| 998 | assert text[:4] == Text("foo ", spans=[Span(0, 4, "red")]) |
| 999 | assert text[:5] == Text("foo b", spans=[Span(0, 5, "red"), Span(4, 5, "bold")]) |
| 1000 | assert text[4:] == Text("bar baz", spans=[Span(0, 3, "red"), Span(0, 7, "bold")]) |
| 1001 | |
| 1002 | with pytest.raises(TypeError): |
| 1003 | text[::-1] |
| 1004 | |
| 1005 | |
| 1006 | def test_wrap_invalid_style(): |
nothing calls this directly
no test coverage detected