Skip to content

Process iterable array inputs without testing their truth values - #384

Merged
dgilland merged 3 commits into
dgilland:developfrom
ShahadatTest:fix/iterable-array-truth-values
Oct 29, 2026
Merged

dgilland merged 3 commits into
dgilland:developfrom
ShahadatTest:fix/iterable-array-truth-values

Conversation

@ShahadatTest

@ShahadatTest ShahadatTest commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Array operations currently truth-test their input before iterating it. For example, uniq_by(numpy.array([1, 2])) and difference_by([1, 2], numpy.array([2])) raise the NumPy ambiguous-truth-value error. A populated iterable that returns false is silently treated as empty.

Use explicit None checks in uniqueness, intersection, difference conversion and unzip_with. Empty iterables still yield empty results. Sized empty intersections retain the early return so they do not evaluate an iteratee unnecessarily. Tests model both ambiguous and false truth values without adding a NumPy dependency.

Validation: 15 regression cases fail before the fix. Python 3.12: 3001 tests/doctests pass with 100% coverage. Python 3.10: 2642 unit tests pass. Ruff lint/format, mypy over the package and new tests, and git diff --check pass. An initial Python 3.10 run hit the existing real-time test_debounce_max_wait; the complete rerun above passed. Two additional tests preserve the empty-intersection shortcut. Existing comparison semantics are unchanged; this does not address #356.

AI assistance: OpenAI Codex (GPT-6), original user request new 14ta koro aro (make 14 more new contributions). Diff inspection was automated; no human review or personal production usage is claimed.

@coveralls

coveralls commented Oct 27, 2026 •

Copy link
Copy Markdown

Coverage Status

coverage: 100.0%. remained the same — ShahadatTest:fix/iterable-array-truth-values into dgilland:develop

@dgilland
dgilland merged commit 5d8f663 into dgilland:develop Oct 29, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants