aboutsummaryrefslogtreecommitdiff
path: root/wqflask/tests/unit/utility/test_chunks.py
diff options
context:
space:
mode:
authorBonfaceKilz2020-11-11 21:37:04 +0300
committerGitHub2020-11-11 21:37:04 +0300
commitd60d8bbff8fbd032a3cf72559719a7f78881965a (patch)
tree9ae956af7a43465851e4f786d416755e890337d8 /wqflask/tests/unit/utility/test_chunks.py
parent25f7d30b9f052ec5d812bfe3bf9713df850cc267 (diff)
parentdbeefadc25fb2bc6e04b4baa4b35bbbd5298e880 (diff)
downloadgenenetwork2-d60d8bbff8fbd032a3cf72559719a7f78881965a.tar.gz
Merge pull request #477 from BonfaceKilz/feature/add-glossary-page
Feature/add glossary page
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),
+ [[]])