Skip to content

Commit df7ca99

Browse files
authored
Merge pull request #20 from ressy/release-0.0.8
Release 0.0.8
2 parents 956f7d3 + fea0216 commit df7ca99

File tree

4 files changed

+40
-2
lines changed

4 files changed

+40
-2
lines changed

CHANGELOG.md

+9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Changelog
22

3+
## 0.0.8 - 2021-07-13
4+
5+
### Fixed
6+
7+
* Don't include a trailing empty submission when submitting perfect multiples
8+
of 50 sequences ([#19])
9+
10+
[#19]: https://github.com/ressy/vquest/pull/19
11+
312
## 0.0.7 - 2021-03-17
413

514
### Fixed

test_vquest/test_util.py

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
"""
2+
Test util functions.
3+
"""
4+
5+
import unittest
6+
from vquest import util
7+
8+
class TestChunker(unittest.TestCase):
9+
"""Basic test of iterator chunker."""
10+
11+
def test_chunker(self):
12+
"""Test that chunker breaks iterator items into fixed-size chunks."""
13+
chunks = []
14+
for chunk in util.chunker(range(8), 5):
15+
chunks.append(chunk)
16+
self.assertEqual([[0, 1, 2, 3, 4], [5, 6, 7]], chunks)
17+
18+
class TestChunkerPerfectFit(unittest.TestCase):
19+
"""Test chunker for a perfect fit, with number of items equal to chunk size."""
20+
21+
def test_chunker(self):
22+
"""Test that chunker gives only one chunk for the perfect-fit case."""
23+
chunks = []
24+
for chunk in util.chunker(range(5), 5):
25+
chunks.append(chunk)
26+
self.assertEqual([[0, 1, 2, 3, 4]], chunks)

vquest/util.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ def chunker(iterator, chunksize):
2222
chunk = []
2323
except StopIteration:
2424
pass
25-
yield chunk
25+
# If the last chunk has items, yield that, but don't just yield an empty
26+
# list.
27+
if chunk:
28+
yield chunk
2629

2730
def unzip(txt):
2831
"""Extract .zip data from bytes into dict keyed on filenames."""

vquest/version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
See https://www.python.org/dev/peps/pep-0396/
66
"""
77

8-
__version__ = "0.0.7"
8+
__version__ = "0.0.8"

0 commit comments

Comments
 (0)