mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-09-09 18:14:09 +02:00
Add test for chunks(), refs #364
This commit is contained in:
parent
6e46b99134
commit
a8f9cc6f64
3 changed files with 23 additions and 6 deletions
|
|
@ -25,3 +25,18 @@ def test_decode_base64_values(input, expected, should_be_is):
|
|||
def test_find_spatialite():
|
||||
spatialite = utils.find_spatialite()
|
||||
assert spatialite is None or isinstance(spatialite, str)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"size,expected",
|
||||
(
|
||||
(1, [["a"], ["b"], ["c"], ["d"]]),
|
||||
(2, [["a", "b"], ["c", "d"]]),
|
||||
(3, [["a", "b", "c"], ["d"]]),
|
||||
(4, [["a", "b", "c", "d"]]),
|
||||
),
|
||||
)
|
||||
def test_chunks(size, expected):
|
||||
input = ["a", "b", "c", "d"]
|
||||
chunks = list(map(list, utils.chunks(input, size)))
|
||||
assert chunks == expected
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue