Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Header-only fix is_valid for empty Indexed or IndexedOption #3120

Merged
merged 6 commits into from
May 27, 2024

Conversation

zonca
Copy link
Collaborator

@zonca zonca commented May 14, 2024

Noticed that the implementation of is_valid in #3901
did not handle correctly empty objects.
In that case max_index_ has the initial value of 0
the length of content is also 0.
Therefore is_valid fails because they are equal.

Added 2 test cases for this to the same file given they are related.

  • test: test empty IndexedOption builders are valid
  • test: suppress printout to avoid thinking tests fail
  • fix: append_index() should call append_index(i)
  • fix: specific case of is_valid to catch empty objects
  • test: separate test case for empty Indexed and IndexedOption

@zonca zonca changed the title Header-only fix is_valid for empty Indexed or IndexedOption fix: Header-only fix is_valid for empty Indexed or IndexedOption May 15, 2024
@zonca zonca self-assigned this May 15, 2024
Copy link
Member

@jpivarski jpivarski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good fix—thanks for catching it!

I'll merge this PR as soon as we get the MacOS bug fixed. I think we'll get that done tomorrow, even if we have to put an upper limit on the pyarrow version we accept.

@ManasviGoyal
Copy link
Collaborator

@jpivarski Since the MacOS bug is fixed, this can be merged, right?
@zonca Once there is an awkward release with this fix, we should bump the minimum version of awkward in kaitai_struct_awkward_runtime and make a release (or maybe once you are done with the documentation).

@jpivarski
Copy link
Member

Yes, the MacOS bug was the only thing holding it back. I'll merge it now.

@jpivarski jpivarski merged commit f16c0e7 into main May 27, 2024
41 checks passed
@jpivarski jpivarski deleted the fix_max_index_init branch May 27, 2024 15:43
zonca added a commit to det-lab/kaitai_struct_awkward_runtime that referenced this pull request May 29, 2024
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.

None yet

3 participants