Repository: Textualize/rich
File: tests/test_cells.py (Python)

Code before:
    assert chop_cells(text, 3) == ["abc", "def", "ghi", "jk"]


def test_chop_cells_double_width_boundary():
    """The available width lies within a double-width character."""
    text = "ありがとう"
    assert chop_cells(text, 3) == ["あ", "り", "が", "と", "う"]


def test_chop_cells_mixed_width():
    """Mixed single and double-width characters."""
    text = "あ1り234が5と6う78"
    assert chop_cells(text, 3) == ["あ1", "り2", "34", "が5", "と6", "う7", "8"]


@pytest.mark.parametrize(
    "text,expected",
    [
        ("", []),
        ("\x1b", []),
        ("\x1b\x1b", []),
        ("\x1b\x1b\x1b", []),
        ("\x1b\x1b\x1b\x1b", []),
    ],
)
def test_chop_cells_zero_width(text: str, expected: list) -> None:
    """Test zer width characters being chopped."""
    assert chop_cells(text, 3) == expected


def test_is_single_cell_widths() -> None:
    # Check _is_single_cell_widths reports correctly
    for character in string.printable:
        if ord(character) >= 32:
            assert _is_single_cell_widths(character)

    BOX = "┌─┬┐│ ││├─┼┤│ ││├─┼┤├─┼┤│ ││└─┴┘"

    for character in BOX:
        assert _is_single_cell_widths(character)

    for character in "💩😽":
        assert not _is_single_cell_widths(character)

    for character in "わさび":
        assert not _is_single_cell_widths(character)


@pytest.mark.parametrize(
    "text,expected_spans,expected_cell_length",
    [

Review comment (suggestion):
Type annotation for `expected` is too generic here (`list`). Since the expected values are strings, annotate it as `list[str]` for consistency with the rest of the file (e.g. `expected_spans: list[CellSpan]`).
```suggestion
def test_chop_cells_zero_width(text: str, expected: list[str]) -> None:
```

Code after:
    assert chop_cells(text, 3) == ["abc", "def", "ghi", "jk"]


def test_chop_cells_double_width_boundary():
    """The available width lies within a double-width character."""
    text = "ありがとう"
    assert chop_cells(text, 3) == ["あ", "り", "が", "と", "う"]


def test_chop_cells_mixed_width():
    """Mixed single and double-width characters."""
    text = "あ1り234が5と6う78"
    assert chop_cells(text, 3) == ["あ1", "り2", "34", "が5", "と6", "う7", "8"]


@pytest.mark.parametrize(
    "text,expected",
    [
        ("", []),
        ("\x1b", []),
        ("\x1b\x1b", []),
        ("\x1b\x1b\x1b", []),
        ("\x1b\x1b\x1b\x1b", []),
    ],
)
def test_chop_cells_zero_width(text: str, expected: list[str]) -> None:
    """Test zer width characters being chopped."""
    assert chop_cells(text, 3) == expected


def test_is_single_cell_widths() -> None:
    # Check _is_single_cell_widths reports correctly
    for character in string.printable:
        if ord(character) >= 32:
            assert _is_single_cell_widths(character)

    BOX = "┌─┬┐│ ││├─┼┤│ ││├─┼┤├─┼┤│ ││└─┴┘"

    for character in BOX:
        assert _is_single_cell_widths(character)

    for character in "💩😽":
        assert not _is_single_cell_widths(character)

    for character in "わさび":
        assert not _is_single_cell_widths(character)


@pytest.mark.parametrize(
    "text,expected_spans,expected_cell_length",
    [