diff options
author | zsloan | 2020-11-11 13:03:50 -0600 |
---|---|---|
committer | zsloan | 2020-11-11 13:03:50 -0600 |
commit | cd01afec0bbe28bfcd1982cbf03c056a856b1d13 (patch) | |
tree | 55c6ed5d7312a9f4f4eb32fd0ae1144540f8b0ee /wqflask/tests/unit/utility/test_chunks.py | |
parent | 06102cab4b6a3bc898c65c6df485f328e3314980 (diff) | |
parent | d60d8bbff8fbd032a3cf72559719a7f78881965a (diff) | |
download | genenetwork2-cd01afec0bbe28bfcd1982cbf03c056a856b1d13.tar.gz |
Merge branch 'testing' of github.com:genenetwork/genenetwork2 into testing
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), + [[]]) |