diff options
author | Pjotr Prins | 2020-07-25 08:24:33 +0100 |
---|---|---|
committer | Pjotr Prins | 2020-07-25 08:24:33 +0100 |
commit | 9f8beacddb71aac9905c896b9d81caf45b4735a0 (patch) | |
tree | 1f3ea2b1bdb6835a6c172b739e6872bf59af6181 /wqflask/tests/utility/test_chunks.py | |
parent | c249ba2ef7d691227da8864838dfc97db68d4084 (diff) | |
parent | f66da35a09cbb8da13cfb142cbe3ff208404970b (diff) | |
download | genenetwork2-9f8beacddb71aac9905c896b9d81caf45b4735a0.tar.gz |
Merge branch 'testing' of github.com:genenetwork/genenetwork2 into testing
Diffstat (limited to 'wqflask/tests/utility/test_chunks.py')
-rw-r--r-- | wqflask/tests/utility/test_chunks.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/wqflask/tests/utility/test_chunks.py b/wqflask/tests/utility/test_chunks.py new file mode 100644 index 00000000..8d90a1ec --- /dev/null +++ b/wqflask/tests/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), + [[]]) |