Example #1
0
    def test_generates_multiple_chunks_and_remainders_correctly(self):
        total = 30
        chunkSize = 16

        intervals = [
            interval for interval in chunkSizeGenerator(total, chunkSize)
        ]

        self.assertEqual(len(intervals), 2)
        self.assertEqual(intervals[0], (16, 14))
        self.assertEqual(intervals[1], (14, 0))
Example #2
0
 def test_error_on_negative_chunkSize(self):
     total = 30
     chunkSize = -5
     try:
         intervals = [
             interval for interval in chunkSizeGenerator(total, chunkSize)
         ]
         self.fail(
             f"Chunksize generator should throw ValueError with chunkSize: -5. Result: {intervals}"
         )
     except ValueError:
         pass