diff --git a/python-stdlib/chunk/README.md b/python-stdlib/chunk/README.md new file mode 100644 index 00000000..92f9e9a0 --- /dev/null +++ b/python-stdlib/chunk/README.md @@ -0,0 +1,7 @@ +# Chunk + +Imported `chunk.py` from the CPython stdlib at version +ac7b1a3f32cc81520e8962352294006d65744028. + +`test_chunk.py` was created as a simple test to chunkify the MicroPython logo +(in tiff format) and ensure chunk didn't obviously fail. \ No newline at end of file diff --git a/python-stdlib/chunk/test/micropython-logo.tiff b/python-stdlib/chunk/test/micropython-logo.tiff new file mode 100644 index 00000000..4e70955c Binary files /dev/null and b/python-stdlib/chunk/test/micropython-logo.tiff differ diff --git a/python-stdlib/chunk/test/test_chunk.py b/python-stdlib/chunk/test/test_chunk.py new file mode 100644 index 00000000..e0529e2f --- /dev/null +++ b/python-stdlib/chunk/test/test_chunk.py @@ -0,0 +1,18 @@ +from chunk import Chunk +from micropython import const + +logo = open("micropython-logo.tiff", "rb") + +CHUNK_SIZE = const(23) # Arbitrary size + +while True: + try: + chunk = Chunk(logo) + except EOFError: + break + chunktype = chunk.getname() + while True: + data = chunk.read(CHUNK_SIZE) + if not data: + break + print(data)