diff options
author | zsloan | 2020-11-12 17:20:39 -0600 |
---|---|---|
committer | zsloan | 2020-11-12 17:20:39 -0600 |
commit | 0b47b750549915f2655d3807f5131837ddf8ccc8 (patch) | |
tree | 814173cb4904177e8e125011ae8abce69ef12f04 /wqflask/tests/unit/utility/test_chunks.py | |
parent | e20d5f41d076659706442a8ab1db93cd65c9cb0f (diff) | |
parent | cd01afec0bbe28bfcd1982cbf03c056a856b1d13 (diff) | |
download | genenetwork2-0b47b750549915f2655d3807f5131837ddf8ccc8.tar.gz |
Merge branch 'testing' of github.com:genenetwork/genenetwork2 into feature/corr_table_changes
Diffstat (limited to 'wqflask/tests/unit/utility/test_chunks.py')
-rw-r--r-- | wqflask/tests/unit/utility/test_chunks.py | 19 |
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), + [[]]) |