Skip to content

Commit

Permalink
Merge pull request #20 from ressy/release-0.0.8
Browse files Browse the repository at this point in the history
Release 0.0.8
  • Loading branch information
ressy authored Jul 13, 2021
2 parents 956f7d3 + fea0216 commit df7ca99
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 2 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## 0.0.8 - 2021-07-13

### Fixed

* Don't include a trailing empty submission when submitting perfect multiples
of 50 sequences ([#19])

[#19]: https://github.com/ressy/vquest/pull/19

## 0.0.7 - 2021-03-17

### Fixed
Expand Down
26 changes: 26 additions & 0 deletions test_vquest/test_util.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
"""
Test util functions.
"""

import unittest
from vquest import util

class TestChunker(unittest.TestCase):
"""Basic test of iterator chunker."""

def test_chunker(self):
"""Test that chunker breaks iterator items into fixed-size chunks."""
chunks = []
for chunk in util.chunker(range(8), 5):
chunks.append(chunk)
self.assertEqual([[0, 1, 2, 3, 4], [5, 6, 7]], chunks)

class TestChunkerPerfectFit(unittest.TestCase):
"""Test chunker for a perfect fit, with number of items equal to chunk size."""

def test_chunker(self):
"""Test that chunker gives only one chunk for the perfect-fit case."""
chunks = []
for chunk in util.chunker(range(5), 5):
chunks.append(chunk)
self.assertEqual([[0, 1, 2, 3, 4]], chunks)
5 changes: 4 additions & 1 deletion vquest/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ def chunker(iterator, chunksize):
chunk = []
except StopIteration:
pass
yield chunk
# If the last chunk has items, yield that, but don't just yield an empty
# list.
if chunk:
yield chunk

def unzip(txt):
"""Extract .zip data from bytes into dict keyed on filenames."""
Expand Down
2 changes: 1 addition & 1 deletion vquest/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
See https://www.python.org/dev/peps/pep-0396/
"""

__version__ = "0.0.7"
__version__ = "0.0.8"

0 comments on commit df7ca99

Please sign in to comment.