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

Defend against more .ser files than number of metadata elements present #2531

Merged

Conversation

jat255
Copy link
Member

@jat255 jat255 commented Sep 2, 2020

Resolves #2530

As in the issue, sometimes more .ser files are produced than there are <ObjectInfo> elements defined in the .emi (not totally sure why). This was causing an IndexError. The proposed change checks if we have enough objects before attempting to read from them. If not, we just do not return any metadata (since there's none to be read anyway).

Also included tests to cover the new lines.

@codecov
Copy link

codecov bot commented Sep 2, 2020

Codecov Report

Merging #2531 into RELEASE_next_patch will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@                 Coverage Diff                 @@
##           RELEASE_next_patch    #2531   +/-   ##
===================================================
  Coverage               75.53%   75.53%           
===================================================
  Files                     202      202           
  Lines                   29528    29531    +3     
  Branches                 6434     6435    +1     
===================================================
+ Hits                    22304    22307    +3     
  Misses                   5403     5403           
  Partials                 1821     1821           
Impacted Files Coverage Δ
hyperspy/io_plugins/fei.py 77.62% <100.00%> (+0.18%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 01d23e5...c039de5. Read the comment docs.

@francisco-dlp francisco-dlp merged commit 487fd46 into hyperspy:RELEASE_next_patch Sep 3, 2020
@jat255 jat255 deleted the BUGFIX_emi_indexerror branch September 3, 2020 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants