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

[MRG] empty zipfile collections should not raise assertion errors when loaded #1546

Merged
merged 1 commit into from
May 24, 2021

Conversation

ctb
Copy link
Contributor

@ctb ctb commented May 22, 2021

Over in dib-lab/charcoal#171, @taylorreiter had to add checks for AssertionError in load_file_as_signatures(...). It turns out this is because empty zipfile collections evaluate to empty, and there is a better-safe-than-sorry assertion in _load_database that checks for empty databases.

This PR changes that assertion to checking for unset database objections (db is None) and adds a test.

Fixes #1545

@taylorreiter @bluegenes ready for review!

@codecov
Copy link

codecov bot commented May 22, 2021

Codecov Report

Merging #1546 (3aa253e) into latest (e47bdb5) will increase coverage by 4.98%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           latest    #1546      +/-   ##
==========================================
+ Coverage   90.26%   95.25%   +4.98%     
==========================================
  Files         126       99      -27     
  Lines       21262    17568    -3694     
  Branches     1595     1595              
==========================================
- Hits        19192    16734    -2458     
+ Misses       1843      607    -1236     
  Partials      227      227              
Flag Coverage Δ
python 95.25% <100.00%> (+<0.01%) ⬆️
rust ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/sourmash/sourmash_args.py 94.01% <100.00%> (ø)
tests/test_sourmash_args.py 100.00% <100.00%> (ø)
src/core/src/sketch/minhash.rs
src/core/src/ffi/utils.rs
src/core/src/ffi/hyperloglog.rs
src/core/src/index/bigsi.rs
src/core/src/ffi/signature.rs
src/core/src/ffi/nodegraph.rs
src/core/src/cmd.rs
src/core/src/index/sbt/mod.rs
... and 19 more

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 e47bdb5...3aa253e. Read the comment docs.

Copy link
Contributor

@taylorreiter taylorreiter left a comment

Choose a reason for hiding this comment

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

🎉 LGTM!

src/sourmash/sourmash_args.py Show resolved Hide resolved
@ctb ctb merged commit 83954d1 into latest May 24, 2021
@ctb ctb deleted the fix/empty_zipfile branch May 24, 2021 15:15
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.

fix assertion error being raised by _load_database
2 participants