aboutsummaryrefslogtreecommitdiff
path: root/wqflask/tests/utility/test_chunks.py
diff options
context:
space:
mode:
authorBonfaceKilz2020-07-21 23:36:48 +0300
committerBonfaceKilz2020-07-24 03:47:43 +0300
commitb4d35b413df6ac11648030afd9ceb76e05e0e0f5 (patch)
tree401222249127452c50fe67c6834d40947362bc7f /wqflask/tests/utility/test_chunks.py
parent3d6483e8fd59d2e77149aa5d78ec32448be7338c (diff)
downloadgenenetwork2-b4d35b413df6ac11648030afd9ceb76e05e0e0f5.tar.gz
Test utility methods for chunking
* wqflask/tests/utility/test_chunks.py: New test
Diffstat (limited to 'wqflask/tests/utility/test_chunks.py')
-rw-r--r--wqflask/tests/utility/test_chunks.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/wqflask/tests/utility/test_chunks.py b/wqflask/tests/utility/test_chunks.py
new file mode 100644
index 00000000..8d90a1ec
--- /dev/null
+++ b/wqflask/tests/utility/test_chunks.py
@@ -0,0 +1,19 @@
+"""Test chunking"""
+
+import unittest
+
+from utility.chunks import divide_into_chunks
+
+
+class TestChunks(unittest.TestCase):
+ "Test Utility method for chunking"
+ def test_divide_into_chunks(self):
+ "Check that a list is chunked correctly"
+ self.assertEqual(divide_into_chunks([1, 2, 7, 3, 22, 8, 5, 22, 333], 3),
+ [[1, 2, 7], [3, 22, 8], [5, 22, 333]])
+ self.assertEqual(divide_into_chunks([1, 2, 7, 3, 22, 8, 5, 22, 333], 4),
+ [[1, 2, 7], [3, 22, 8], [5, 22, 333]])
+ self.assertEqual(divide_into_chunks([1, 2, 7, 3, 22, 8, 5, 22, 333], 5),
+ [[1, 2], [7, 3], [22, 8], [5, 22], [333]])
+ self.assertEqual(divide_into_chunks([], 5),
+ [[]])