Skip to content

random() on an empty table raises instead of returning None#73

Merged
roed314 merged 1 commit into
roed314:masterfrom
roed-math:fix/random-empty
Jul 20, 2026
Merged

random() on an empty table raises instead of returning None#73
roed314 merged 1 commit into
roed314:masterfrom
roed-math:fix/random-empty

Conversation

@roed-math

Copy link
Copy Markdown

max_id() returns -1 on an empty table (MAX of no ids), but random() tested == 0 and proceeded into random.randint(0, -1)ValueError: empty range. The docstring promises None; anything below 1 now returns it.


Split out of #60 (one PR per issue). This branch carries only this issue's fix and its tests; the rest of the known-bug inventory stays xfailed, so the full suite is green here and the strict markers guarantee no cross-issue leakage.

max_id() returns -1 on an empty table (MAX of no ids), but random() tested == 0 and proceeded into random.randint(0, -1) → ValueError: empty range. The docstring promises None; anything below 1 now returns it.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@roed314
roed314 merged commit 432fdc3 into roed314:master Jul 20, 2026
16 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.

2 participants