I stole the idea from _encode_params in all candor.
try:
fields = list(self.data.items())
except AttributeError:
+ dict(self.data)
fields = list(self.data)
+ try:
+ dict(files)
+ except ValueError:
+ raise ValueError('Unable to encode lists with elements that '
+ 'are not 2-tuples.')
+
if isinstance(files, dict):
files = files.items()
post4 = post(url, data='[{"some": "json"}]')
self.assertEqual(post4.status_code, 200)
+ try:
+ post(url, files=['bad file data'])
+ except ValueError:
+ pass
+
def test_POSTBIN_GET_POST_FILES_WITH_PARAMS(self):
for service in SERVICES: