@@ -285,19 +285,27 @@ def test_split_cells_emoji(text, split, result):
285285 assert Segment (text ).split_cells (split ) == result
286286
287287
288- def test_split_cells_mixed () -> None :
289- """Check that split cells splits on cell positions."""
290- # Caused https://github.com/Textualize/textual/issues/4996 in Textual
291- tests = [
288+ @pytest .mark .parametrize (
289+ "segment" ,
290+ [
292291 Segment ("早乙女リリエル (CV: 徳井青)" ),
293- Segment ("メイド・イン・きゅんクチュアリ☆" ),
292+ Segment ("メイド・イン・きゅんクチュアリ☆ " ),
294293 Segment ("TVアニメ「メルクストーリア -無気力少年と瓶の中の少女-」 主題歌CD" ),
295- ]
296- for test in tests :
297- for position in range (1 , test .cell_length ):
298- left , right = Segment .split_cells (test , position )
299- assert cell_len (left .text ) == position
300- assert cell_len (right .text ) == test .cell_length - position
294+ Segment ("南無阿弥JKうらめしや?! " ),
295+ Segment ("メルク (CV: 水瀬いのり) " ),
296+ ],
297+ )
298+ def test_split_cells_mixed (segment : Segment ) -> None :
299+ """Check that split cells splits on cell positions."""
300+ # Caused https://github.com/Textualize/textual/issues/4996 in Textual
301+
302+ for position in range (0 , segment .cell_length + 1 ):
303+ left , right = Segment .split_cells (segment , position )
304+ assert all (
305+ cell_len (c ) > 0 for c in segment .text
306+ ) # Sanity check there aren't any sneaky control codes
307+ assert cell_len (left .text ) == position
308+ assert cell_len (right .text ) == segment .cell_length - position
301309
302310
303311def test_split_cells_doubles () -> None :
0 commit comments