for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
import unittest
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:
class SomeClass: def some_method(self): """Do x and return foo."""
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.
from foil.iteration import chunks
class TestChunks(unittest.TestCase):
def test_chunks_generator(self):
gen = range(0, 8)
chunksize = 3
grouped = chunks(gen, chunksize=chunksize)
expected = [(0, 1, 2), (3, 4, 5), (6, 7)]
result = list(tuple(g) for g in grouped)
self.assertEqual(expected, result)
def test_chunks_sequence(self):
seq = list(range(0, 9))
grouped = chunks(seq, chunksize=chunksize)
expected = [(0, 1, 2), (3, 4, 5), (6, 7, 8)]
result = [tuple(g) for g in grouped]
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.