'Data containing list of incorrect data type should return errors.'

def test_invalid_list_datatype(self):

    data = [u'foo', u'bar', u'baz']
    serializer = self.BookSerializer(data=data, many=True)
    assert (serializer.is_valid() is False)
    text_type_string = six.text_type.__name__
    message = (u'Invalid    data.    Expected    a    dictionary,    but    got    %s.' % text_type_string)
    expected_errors = [{u'non_field_errors': [message]}, {u'non_field_errors': [message]}, {u'non_field_errors': [message]}]
    assert (serializer.errors == expected_errors)
