aboutsummaryrefslogtreecommitdiff
path: root/wqflask/tests/unit/utility/test_chunks.py
diff options
context:
space:
mode:
authorAlexander Kabui2020-11-27 16:11:06 +0300
committerAlexander Kabui2020-11-27 16:11:06 +0300
commit8485dfd5aa02f451a646f643f503ccb02779430b (patch)
tree1df6291f98a6be1939a908271f45a6f54639f7b7 /wqflask/tests/unit/utility/test_chunks.py
parent77dff447c83a4b0824fe6626d16484cfd826ca77 (diff)
parent39accba7e31beb6f0df5ddb96fb3062d527b12af (diff)
downloadgenenetwork2-8485dfd5aa02f451a646f643f503ccb02779430b.tar.gz
Merge branch 'testing' of https://github.com/genenetwork/genenetwork2 into test-regression
Diffstat (limited to 'wqflask/tests/unit/utility/test_chunks.py')
-rw-r--r--wqflask/tests/unit/utility/test_chunks.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/wqflask/tests/unit/utility/test_chunks.py b/wqflask/tests/unit/utility/test_chunks.py
new file mode 100644
index 00000000..8d90a1ec
--- /dev/null
+++ b/wqflask/tests/unit/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),
+ [[]])