removesuffix helper returns an empty string for an empty suffix
まだ誰も着手していません。
評価
調査の方向性
src/browserbase/_utils/_utils.py:368-375 から始め、関連する prefix helper と併せて removesuffix の実装を確認します。既存のテストスイートを実行し、その後、空文字列の prefix と suffix のケースをカバーするテストを追加します。removesuffix("abc", "") が "abc" を返し、標準ライブラリの動作と一致すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Description
The internal removesuffix helper claims to backport str.removesuffix, but it returns an empty string when the requested suffix is empty.
Code reference
src/browserbase/_utils/_utils.py:368-375
The implementation executes string[:-len(suffix)]; for an empty suffix this becomes string[:-0], which is string[:0].
Reproduction
from browserbase._utils._utils import removesuffix
print(repr(removesuffix("abc", "")))
print(repr("abc".removesuffix("")))
Actual:
''
'abc'
Expected behavior
To match the documented stdlib behavior, an empty suffix should leave the original string unchanged.
Why it matters
This shared helper silently corrupts input for a valid edge case and has no direct test coverage. Even though current in-repo call sites are limited, it is exported through browserbase._utils and may be reused by generated or manual code later. The fix is small (if suffix and string.endswith(suffix): ...) and should include empty-string tests for both prefix/suffix helpers.
- 主要言語
- Python
- スター
- 93
- フォーク
- 16
- 平均マージ
- 11分
- マージ済み PR(30日)
- 3
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
browserbase/sdk-python のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
browserbase/sdk-python#180 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
browserbase/sdk-python#179 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
browserbase/sdk-python#178 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
browserbase/sdk-python#176 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
browserbase/sdk-python#175 ·
browserbase/sdk-python の issue をすべて見る
似ている issue
-
bug ci good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
-
documentation
難易度 2/5 半日 初心者へのやさしさ 62/100
inmanta/inmanta-core#10835 ·
-
sponsored
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
Diaoul/subliminal#1382 ·