aboutsummaryrefslogtreecommitdiff
path: root/wqflask/tests/unit/utility/test_chunks.py
diff options
context:
space:
mode:
authorBonfaceKilz2020-11-03 18:13:57 +0300
committerBonfaceKilz2020-11-03 18:13:57 +0300
commitf4a3652ee5b8087f551553df9498d5f00e169a86 (patch)
tree9b5bbe8df64f9b08368073d90c9f6d98eb35825e /wqflask/tests/unit/utility/test_chunks.py
parent5d9b1f5d6380beaf8a2d713b5c33baa5a163b2bc (diff)
downloadgenenetwork2-f4a3652ee5b8087f551553df9498d5f00e169a86.tar.gz
Separate unittests from integration tests
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),
+ [[]])