  class FileSerializerTests(TestCase):
  
      def test_create(self):
          now = datetime.datetime.now()
          file = BytesIO(b'stuff')
          file.name = 'stuff.txt'
          file.size = len(file.getvalue())
          serializer = UploadedFileSerializer(data={'created': now}, files={'file': file})
          uploaded_file = UploadedFile(file=file, created=now)
          self.assertTrue(serializer.is_valid())
 
</s> remove         self.assertEquals(response.content, "403 Forbidden")
 </s> add         self.assertEquals(response.content, six.b("403 Forbidden")) </s> remove RENDERER_A_SERIALIZER = lambda x: 'Renderer A: %s' % x
RENDERER_B_SERIALIZER = lambda x: 'Renderer B: %s' % x
 </s> add RENDERER_A_SERIALIZER = lambda x: ('Renderer A: %s' % x).encode('ascii')
RENDERER_B_SERIALIZER = lambda x: ('Renderer B: %s' % x).encode('ascii') </s> remove             for name,value in headers.iteritems():
 </s> add             for name, value in six.iteritems(headers): </s> remove         unique = str(uuid.uuid4())
        return hmac.new(unique, digestmod=sha1).hexdigest()
 </s> add         unique = uuid.uuid4()
        return hmac.new(unique.bytes, digestmod=sha1).hexdigest() </s> remove         content = 'qwerty'
 </s> add         content = six.b('qwerty')
        file = BytesIO(six.b('stuff'))
  class FileSerializerTests(TestCase):
  
      def test_create(self):
          now = datetime.datetime.now()
        file = BytesIO(six.b('stuff'))
          file.name = 'stuff.txt'
          file.size = len(file.getvalue())
          serializer = UploadedFileSerializer(data={'created': now}, files={'file': file})
          uploaded_file = UploadedFile(file=file, created=now)
          self.assertTrue(serializer.is_valid())
keep keep keep keep replace keep keep keep keep keep
 Every (base) test should now pass with python3. 
rest_framework/tests/files.py