Skip to content
Myr

Fixed tests for Python 3 (text vs. bytes).

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Jakub Roztocil · committed by Jakub Roztocil · parent dee3693 · Browse files · 1 file+5 added−9 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+5 added−9 removed

  • tests:+5 added−9 removed

1 file+5 added−9 removed

modified:tests/test_requests.py+5 added-9 removed
1031 unmodified lines
1032 with the same name.1033 https://github.com/kennethreitz/requests/pull/7461034 """10351036 data = [1036 fields = [1037 ('__field__', '__value__'),1038 ('__field__', '__value__'),1039 ]1040 files = [1041 ('__field__', '__value__'),1042 ('__field__', '__value__'),1043 ]10401045 r = post(httpbin('post'), data=data, files=files)1041 r = post(httpbin('post'), data=fields, files=fields)1042 t = json.loads(r.text)10431044 self.assertEqual(t.get('form'), {1045 '__field__': [
6 unmodified lines
1052 # the same name against httpbin so we need to inspect the encoded1053 # body manually.1054 request = r.request1055 body, content_type = request._encode_files(request.files)1060 file_field = ('Content-Disposition: form-data;'1061 ' name="__field__"; filename="__field__"')1062 self.assertEqual(body.count('__value__'), 4)1056 file_field = (b'Content-Disposition: form-data;'1057 b' name="__field__"; filename="__field__"')1058 self.assertEqual(body.count(b'__value__'), 4)1059 self.assertEqual(body.count(file_field), 2)10601061 def test_bytes_files(self):1062 """Test that `bytes` can be used as the values of `files`."""
5 unmodified lines