Skip to content

Commit

Permalink
Add tests for the batch and chunk commands (#359)
Browse files Browse the repository at this point in the history
* Add tests for the batch and chunk commands
Fixes #330

* Flake fix
  • Loading branch information
palewire authored Jan 2, 2023
1 parent 03004c4 commit 52fe65c
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,16 @@ def test_get_url():
utils.get_json_url(
"https://archive.org/download/signalcleveland-2022/signalcleveland-2022-11-17T02%3A50%3A58.280867-05%3A00.wayback.json"
)


def test_chunk():
"""Test the chunk utility."""
assert len(utils.chunk([1, 2, 3, 4, 5], 2)) == 3
assert len(utils.chunk([1, 2, 3, 4, 5], 5)) == 1
assert len(utils.chunk([1, 2, 3, 4, 5], 4)) == 2


def test_batch():
"""Test the batch utility."""
assert len(list(utils.batch([1, 2, 3, 4, 5], 2))) == 2
assert len(list(utils.batch([1, 2, 3, 4, 5], 1))) == 1

0 comments on commit 52fe65c

Please sign in to comment.