Repository navigation
ROB: Treat a non-numeric text operand as missing in extract_text - #4175
Merged
stefan6419846 merged 3 commits intoOct 13, 2026
Merged
stefan6419846 merged 3 commits into
stefan6419846 merged 3 commits into
Conversation
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4175 +/- ##
=======================================
Coverage 98.19% 98.19%
=======================================
Files 59 59
Lines 11700 11704 +4
Branches 2198 2199 +1
=======================================
+ Hits 11489 11493 +4
Misses 117 117
Partials 94 94 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
stefan6419846
requested changes
Oct 12, 2026
Contributor
Author
|
Renamed it to _get_number_operand. |
Contributor
Author
|
Yes: the operands here are NumberObject or FloatObject for numbers, which subclass int and float, so it now checks the index and isinstance(..., (int, float)) instead of catching exceptions. |
stefan6419846
approved these changes
Oct 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A text operator whose operand is not a number, as in
made extract_text() raise "ValueError: could not convert string to float: '/X'". The same happened for TL, Tz and Tw (_handle_tl, _handle_tz, _handle_tw and _handle_td all called float() on the raw operand).
These handlers already fall back to a default when the operand is missing. A small helper, _number_operand(), now applies the same fallback when the operand is not a number, so such an operator is treated as having no operand and the text around it is kept: the example extracts as "HelloWorld". This follows how _handle_tm and _handle_cm already handle operands they cannot convert.
The full suite passes locally (1933 tests), and the changed lines are fully covered.
Used Claude Code (Claude Opus 5.5) to help find and patch this and to draft this description; I reviewed and tested the change.