def test_no_remainders(self): batched = tuple(textindex.batch([1, 2], batch_size=2)) assert batched == ((1, 2),) batched = tuple(textindex.batch([1, 2, 3], batch_size=3)) assert batched == ((1, 2, 3),) batched = tuple(textindex.batch([1, 2, 3, 4], batch_size=2)) assert batched == ((1, 2), (3, 4)) batched = tuple(textindex.batch([1, 2, 3, 4, 5, 6], batch_size=3)) assert batched == ((1, 2, 3), (4, 5, 6))
def test_no_remainders(self): batched = tuple(textindex.batch([1, 2], batch_size=2)) assert batched == ((1, 2), ) batched = tuple(textindex.batch([1, 2, 3], batch_size=3)) assert batched == ((1, 2, 3), ) batched = tuple(textindex.batch([1, 2, 3, 4], batch_size=2)) assert batched == ((1, 2), (3, 4)) batched = tuple(textindex.batch([1, 2, 3, 4, 5, 6], batch_size=3)) assert batched == ((1, 2, 3), (4, 5, 6))
def test_single(self): for batch_size in range(1, 10): batched = tuple(textindex.batch([1], batch_size=batch_size)) assert batched == ((1,),)
def test_empty(self): for batch_size in range(1, 10): assert len(list(textindex.batch([], batch_size=batch_size))) == 0
def test_single(self): for batch_size in range(1, 10): batched = tuple(textindex.batch([1], batch_size=batch_size)) assert batched == ((1, ), )