Exemplo n.º 1
0
    def test_bad_agg_size(self):
        rows = [1,2,3,4]
        self.assertRaises(ValueError, iter_chunks, rows, 0)
        self.assertRaises(ValueError, iter_chunks, rows, -1)

        try:
            for i in iter_chunks(rows, 0):
                pass
        except ValueError:
            pass
        else:
            self.fail()
        
        try:
            result = list(iter_chunks(rows, 0))
        except ValueError:
            pass
        else:
            self.fail()
Exemplo n.º 2
0
    def test_bad_agg_size(self):
        rows = [1, 2, 3, 4]
        self.assertRaises(ValueError, iter_chunks, rows, 0)
        self.assertRaises(ValueError, iter_chunks, rows, -1)

        try:
            for i in iter_chunks(rows, 0):
                pass
        except ValueError:
            pass
        else:
            self.fail()

        try:
            result = list(iter_chunks(rows, 0))
        except ValueError:
            pass
        else:
            self.fail()
Exemplo n.º 3
0
 def test_multi_agg(self):
     rows = [[1],[2],[3],[4],[5]]
     result = list(iter_chunks(rows, 2))
     self.assertEqual(result, [[[1],[2]],[[3],[4]],[[5]]])
Exemplo n.º 4
0
 def test_size(self):
     rows = [[1],[2]]
     result = list(iter_chunks(rows, 2))
     self.assertEqual(result, [[[1],[2]]])
Exemplo n.º 5
0
 def test_empty(self):
     rows = []
     result = list(iter_chunks(rows))
     self.assertEqual(result, [])
Exemplo n.º 6
0
 def test_multi_agg(self):
     rows = [[1], [2], [3], [4], [5]]
     result = list(iter_chunks(rows, 2))
     self.assertEqual(result, [[[1], [2]], [[3], [4]], [[5]]])
Exemplo n.º 7
0
 def test_size(self):
     rows = [[1], [2]]
     result = list(iter_chunks(rows, 2))
     self.assertEqual(result, [[[1], [2]]])
Exemplo n.º 8
0
 def test_empty(self):
     rows = []
     result = list(iter_chunks(rows))
     self.assertEqual(result, [])