tomchristie/django-rest-framework — pull request #1847 by hamishcampbell (2014-09-08 00:26:30+00:00)
Title: Stop the API Client converting empty lists/dicts to empty strings

The test client performs a naive check on data for empty values:

```python
def _encode_data(self, data, format=None, content_type=None):
"""
Encode the data returning a two tuple of (bytes, content_type)
"""

if not data:
return ('', content_type)
...
```

This causes issues testing against views that accept empty `list` and `dict` values as valid input. In the test client, these are converted to empty strings, causing unexpected validation issues that don't happen in production use.

This PR simply changes it to an `is None` test. FWIW, this seems to be implied by the call signatures of `.post`, `.put`.

Tests against python2.7 pass.