Fix test normalization for integer tokens in space-delimited fields and numeric-string Software - #57
Closed
tonimelisma wants to merge 1 commit into
Closed
Fix test normalization for integer tokens in space-delimited fields and numeric-string Software#57tonimelisma wants to merge 1 commit into
tonimelisma wants to merge 1 commit into
Conversation
Two test infrastructure fixes:
1. The fuzzy float comparator regex for space-delimited fields (LensInfo,
PrimaryChromaticities, etc.) required both the first and second token to
contain a decimal point. Fields with integer tokens (e.g. LensInfo
"2.22 9 1.78 2.8" where 9 is the max focal length) fell through to exact
string comparison, failing on float64 precision differences.
Fix: allow subsequent tokens to be integers.
2. ExifTool with -n outputs numeric-looking software versions (e.g. iOS
"26.3") as JSON numbers rather than strings. After json.Unmarshal this
becomes float64(26.3) while imagemeta correctly returns string("26.3")
since EXIF Software is an ASCII field.
Fix: convert float64 back to string for Software in normalizeThem.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Owner
|
This needs to fix a failing test case. As per my previous comment, if this is more practical to do as part of #58 that's fine. But in any case, we need to be able to remove this particular patch and have a test fail. |
Owner
|
I'll handle this in #58 |
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.
Two small test infrastructure gaps discovered while adding HEIF support:
1.
isSpaceDelimitedFloatReregex too strictThe fuzzy float comparator for space-delimited fields (used for
LensInfo,PrimaryChromaticities, etc.) had regex^(\d+\.\d+) (\d+\.\d+)which requiredboth the first and second token to contain a decimal point.
LensInfoon some camerasincludes integer tokens (e.g. iPhone 15 Pro:
"2.22 9 1.78 2.8"where9is themax focal length in mm). The second token
9has no decimal point, so the fuzzycomparison was not applied and the test fell through to exact string comparison,
failing on float64 precision differences.
Fix: change to
^(\d+\.\d+)( \d+\.?\d*)+$— first token still requires a decimal(to avoid accidentally matching non-numeric strings), subsequent tokens may be integers.
2. ExifTool emits iOS software version as JSON number
ExifTool with
-noutputs"Software": 26.3(a JSON number) rather than"Software": "26.3"(a string) when the software field contains a value that lookslike a number. After
json.Unmarshalthis becomesfloat64(26.3)in the goldenfile, while imagemeta correctly returns
string("26.3")(the EXIFSoftwaretagis defined as ASCII). The comparison failed on type mismatch.
Fix: add
"Software"to thenormalizeThemswitch to convertfloat64back toits decimal string representation when ExifTool has emitted it as a number.