Skip to content

Docs: empty smart_truncate separator raises ValueError only on the word-boundary path #218

Done

Description

@un33k

Reported by email by Arden (no GitHub account), filed here for the record.

The README and the legacy smart_truncate docstring in 9.2.0 say empty separators raise ValueError. They only do on the word-boundary path:

smart_truncate('aaa bbb', 3, False, '')  # 'aaa' (plain cut, no error)
smart_truncate('aaa bbb', 5, True, '')   # ValueError: empty separator

The ValueError comes from str.split('') inside the word-boundary branch. Behavior is correct and frozen (legacy); only the wording is wrong. Docs-only fix, no release needed on its own.

🚀 Generated with Dojo ⛩️

Activity

  1. un33k commented on Nov 29, 2026

    @un33k
    OwnerAuthor

    Fixed in #217 (docs only): the README and the legacy smart_truncate docstring now say an empty separator raises ValueError only on the word-boundary path (word_boundary=True and the string at least max_length long), and is a plain cut otherwise. Behavior is unchanged; legacy output was verified against the frozen goldens, and tests/test_release.py now pins the non-raising cases.

    No release on its own: it is listed under Unreleased in the changelog and ships with the next release. Thanks to Arden for the precise report.

    🚀 Generated with Dojo ⛩️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions