require_iterable_of loses invalid elements in one-shot iterators

オープン 初心者向け
#3 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
68/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python
領域
backend

調査の方向性

まず require_iterable_of とそのイテラブル検証の経路を確認し、既存のテストに再利用可能なシーケンスがあるか調べます。issue に示されたジェネレーターで失敗を再現し、有効なジェネレーターと無効なジェネレーターの回帰テストを追加します。ワンショットイテレーターが元の要素インデックスを含む指定の TypeError を送出し、有効なジェネレーターが通れば完了です。

索引モデルが issue の本文から書いたものです。

説明

require_iterable_of(iter([1, "bad", 3]), int) raises AssertionError("Shouldn't reach here.") rather than the documented named TypeError. The fast all() consumes the invalid item, and the second traversal sees only the remaining values. A list correctly reports the mismatched element.

Reproduce with the current default branch:

from typechecks import require_iterable_of
require_iterable_of(iter([1, "bad", 3]), int, name="items")

Validate one-shot iterators in a single traversal, preserving the original element index and named error; add a regression covering valid/invalid generators. The documentation PR explicitly describes the current reusable-sequence limitation rather than claiming generators are supported.

主要言語
Python
スター
0
フォーク
1
平均マージ
4分
マージ済み PR(30日)
2

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

openvax/typechecks のほかの issue

openvax/typechecks の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。