Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions hAMRonization/MykrobeIO.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ def parse(self, handle):
data = json.load(handle)

sample_names = list(data.keys())
if len(sample_names) == 0:
return # take an empty JSON object as a success but with no results
assert len(sample_names) == 1, "can only parse output with a single "
"sample currently, found {}".format(len(sample_names))
sample_name = sample_names[0]
Expand Down
2 changes: 1 addition & 1 deletion hAMRonization/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python

__version__ = "1.1.8"
__version__ = "1.1.9"

from hAMRonization import AbricateIO
from hAMRonization import AmrFinderPlusIO
Expand Down
1 change: 1 addition & 0 deletions test/data/dummy/mykrobe/empty.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
9 changes: 9 additions & 0 deletions test/test_parsing_validity.py
Original file line number Diff line number Diff line change
Expand Up @@ -823,6 +823,15 @@ def test_tbprofiler():
assert result.reference_gene_stop is None


def test_mykrobe_empty():
metadata = {}
parsed_report = hAMRonization.parse(
"data/dummy/mykrobe/empty.json", metadata, "mykrobe"
)
for result in parsed_report:
assert False # there should be none


def test_mykrobe():
metadata = {}
parsed_report = hAMRonization.parse(
Expand Down
Loading