Skip to content

Commit

Permalink
Fix return in read_paired_chunks (is a generator)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelm committed Jun 16, 2024
1 parent 2aaaba6 commit 0ea0414
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/dnaio/chunks.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def read_paired_chunks(
start2 = f2.readinto(memoryview(buf2)[0:1])

if start1 == 0 and start2 == 0:
return memoryview(b""), memoryview(b"")
return

if (start1 == 0) != (start2 == 0):
i = 2 if start1 == 0 else 1
Expand Down
9 changes: 9 additions & 0 deletions tests/test_chunks.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,15 @@ def test_fastq_head():
assert _fastq_head(b"A\nB\nC\nD\nE\nF\nG\nH\nI\n") == 16


def test_read_paired_chunks_empty_input(tmp_path):
empty_fastq = tmp_path / "empty.fastq"
empty_fastq.write_text("")
with open(empty_fastq, "rb") as f1:
with open(empty_fastq, "rb") as f2:
chunks = list(read_paired_chunks(f1, f2))
assert len(chunks) == 0


def test_read_paired_chunks_fastq():
with open("tests/data/paired.1.fastq", "rb") as f1:
with open("tests/data/paired.2.fastq", "rb") as f2:
Expand Down

0 comments on commit 0ea0414

Please sign in to comment.