MCPcopy
hub / github.com/Textualize/rich / test_split

Function test_split

tests/test_text.py:378–394  ·  tests/test_text.py::test_split
()

Source from the content-addressed store, hash-verified

376
377
378def test_split():
379 text = Text()
380 text.append(class="st">"foo", class="st">"red")
381 text.append(class="st">"\n")
382 text.append(class="st">"bar", class="st">"green")
383 text.append(class="st">"\n")
384
385 line1 = Text()
386 line1.append(class="st">"foo", class="st">"red")
387 line2 = Text()
388 line2.append(class="st">"bar", class="st">"green")
389 split = text.split(class="st">"\n")
390 assert len(split) == 2
391 assert split[0] == line1
392 assert split[1] == line2
393
394 assert list(Text(class="st">"foo").split(class="st">"\n")) == [Text(class="st">"foo")]
395
396
397def test_split_spans():

Callers

nothing calls this directly

Calls 4

appendMethod · 0.95
splitMethod · 0.95
TextClass · 0.90
splitMethod · 0.45

Tested by

no test coverage detected