Skip to content

fix: do not treat inf and infinity as numbers when spell checking - #207

Merged
barrust merged 2 commits into
barrust:masterfrom
raashish1601:fix/infinity-not-a-number
Oct 10, 2026
Merged

barrust merged 2 commits into
barrust:masterfrom
raashish1601:fix/infinity-not-a-number

Conversation

@raashish1601

Copy link
Copy Markdown
Contributor

_check_if_should_check skips anything that float() can parse, and has a special case for "nan" (#125). float() also accepts "inf" and "infinity", so those words were never checked either, even though both are in the English dictionary:

spell = SpellChecker()
"infinity" in spell            # True
spell.known(["infinity"])      # set()
spell.correction("infinty")    # 'infinite', "infinity" is never a candidate

This adds "inf" and "infinity" to the same bypass as "nan". Real numbers like "1e5" are still skipped.

Tests: added test_infinity_correction (fails before the change). pytest tests passes (55 tests), ruff check, ruff format --check and mypy spellchecker are clean.

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@barrust
barrust merged commit 37c985c into barrust:master Oct 10, 2026
8 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