def _uploadFile(self, name, parent, parentType='folder', size=1024,
                    error=None, partial=False):
        """
        Upload a random file to an item.

        :param name: name of the file.
        :param parent: parent document to upload the file to.
        :param parentType: type of parent to upload to.
        :param size: size of the file to upload
        :param error: if set, expect this error.
        :param partial: if set, return before uploading the data.  This returns
                        a kwargs for multipartRequest so that the caller can
                        finishe the upload later.
        :returns: file: the created file object
        """
        if parentType != 'file':
            resp = self.request(
                path='/file', method='POST', user=self.admin, params={
                    'parentType': parentType,
                    'parentId': parent['_id'],
                    'name': name,
                    'size': size,
                    'mimeType': 'application/octet-stream'
                }, exception=error is not None)
        else:
            resp = self.request(
                path=str(parent['_id']) % '/file/%s/contents', method='PUT',
                user=self.admin, params={
                    'size': size,
                }, exception=error is not None)
        if error:
            self.assertStatus(resp, 500)
            self.assertEqual(resp.json['type'], 'girder')
            self.assertEqual(resp.json['message'][:len(error)], error)
            return None
        # We don't create the contents until after we check for the first
        # error.  This means that we can try to upload huge files without
        # allocating the space for them
        contents = os.urandom(size)
        self.assertStatusOk(resp)
        upload = resp.json
        fields = [('offset', 0), ('uploadId', upload['_id'])]
        if not partial:
            files = [('chunk', name, contents)]
        else:
            files = [('chunk', name, contents[:-1])]
        resp = self.multipartRequest(path='/file/chunk', user=self.admin,
                                     fields=fields, files=files)
        self.assertStatusOk(resp)
        if partial:
            fields = [('offset', len(contents)-1), ('uploadId', upload['_id'])]
            files = [('chunk', name, contents[-1:])]
            kwargs = {'path': '/file/chunk', 'user': self.admin,
                      'fields': fields, 'files': files}
            return kwargs
        return resp.json
dataset/ETHPy150Open girder/girder/plugins/user_quota/plugin_tests/user_quota_test.py/QuotaTestCase._uploadFile/swapped operands of `%`