django/django — pull request #780 by datagrok (2013-02-23 16:45:25+00:00)
Title: Add a unit test to exercise chunking behavior

Bug #18972 https://code.djangoproject.com/ticket/18972 reports that the math used by django.core.servers.basehttp.ServerHandler.write to break large data into chunks before writing is incorrect.This issue is valid, but since an array slice whose end exceeds the array's length automatically truncates, nothing actually breaks because of this mistake.

@doda has contributed a patch to address the problem, but no unit tests accompany it.

This commit adds a unit test that exercises the chunking code, proves that no data is currently lost, and allows for easy refactoring of the chunking code.