@@ -368,7 +368,6 @@ def test_raise_exception_on_s3_object_lambda_resource(self):
368368 self .manager .upload (self .filename , s3_object_lambda_arn , self .key )
369369
370370 def test_upload_with_no_overwrite_flag_when_object_exists (self ):
371- """Test that upload fails when object exists at the destination"""
372371 self .extra_args ['IfNoneMatch' ] = '*'
373372 # Mocking a precondition Error
374373 self .stubber .add_client_error (
@@ -380,20 +379,21 @@ def test_upload_with_no_overwrite_flag_when_object_exists(self):
380379 'Bucket' : self .bucket ,
381380 'Key' : self .key ,
382381 'IfNoneMatch' : '*' ,
383- 'ChecksumAlgorithm' : DEFAULT_CHECKSUM_ALGORITHM
384- }
382+ 'ChecksumAlgorithm' : DEFAULT_CHECKSUM_ALGORITHM ,
383+ },
385384 )
386385 with self .assertRaises (ClientError ) as context :
387386 future = self .manager .upload (
388387 self .filename , self .bucket , self .key , self .extra_args
389388 )
390389 future .result ()
391390 # Verify the error is a PreconditionFailed error
392- self .assertEqual (context .exception .response ['Error' ]['Code' ], 'PreconditionFailed' )
391+ self .assertEqual (
392+ context .exception .response ['Error' ]['Code' ], 'PreconditionFailed'
393+ )
393394 self .stubber .assert_no_pending_responses ()
394395
395396 def test_upload_with_no_overwrite_flag_when_object_does_not_exists (self ):
396- """Test that upload succeed when object does not exists at the destination"""
397397 self .extra_args ['IfNoneMatch' ] = '*'
398398 self .stubber .add_response (
399399 'put_object' ,
@@ -403,8 +403,8 @@ def test_upload_with_no_overwrite_flag_when_object_does_not_exists(self):
403403 'Bucket' : self .bucket ,
404404 'Key' : self .key ,
405405 'IfNoneMatch' : '*' ,
406- 'ChecksumAlgorithm' : DEFAULT_CHECKSUM_ALGORITHM
407- }
406+ 'ChecksumAlgorithm' : DEFAULT_CHECKSUM_ALGORITHM ,
407+ },
408408 )
409409 future = self .manager .upload (
410410 self .filename , self .bucket , self .key , self .extra_args
@@ -895,7 +895,6 @@ def test_multipart_upload_with_default_checksum_when_required(self):
895895 self .assert_expected_client_calls_were_correct ()
896896
897897 def test_multipart_upload_with_no_overwrite_flag_when_object_exists (self ):
898- """Test that multipart upload fails when object exists"""
899898 self .extra_args ['IfNoneMatch' ] = '*'
900899 # Add response for create_multipart_upload (no IfNoneMatch here)
901900 self .add_create_multipart_response_with_default_expected_params ()
@@ -913,13 +912,25 @@ def test_multipart_upload_with_no_overwrite_flag_when_object_exists(self):
913912 'UploadId' : self .multipart_id ,
914913 'MultipartUpload' : {
915914 'Parts' : [
916- {'ETag' : 'etag-1' , 'PartNumber' : 1 , 'ChecksumCRC64NVME' : 'sum1==' },
917- {'ETag' : 'etag-2' , 'PartNumber' : 2 , 'ChecksumCRC64NVME' : 'sum2==' },
918- {'ETag' : 'etag-3' , 'PartNumber' : 3 , 'ChecksumCRC64NVME' : 'sum3==' }
915+ {
916+ 'ETag' : 'etag-1' ,
917+ 'PartNumber' : 1 ,
918+ 'ChecksumCRC64NVME' : 'sum1==' ,
919+ },
920+ {
921+ 'ETag' : 'etag-2' ,
922+ 'PartNumber' : 2 ,
923+ 'ChecksumCRC64NVME' : 'sum2==' ,
924+ },
925+ {
926+ 'ETag' : 'etag-3' ,
927+ 'PartNumber' : 3 ,
928+ 'ChecksumCRC64NVME' : 'sum3==' ,
929+ },
919930 ]
920931 },
921- 'IfNoneMatch' : '*'
922- }
932+ 'IfNoneMatch' : '*' ,
933+ },
923934 )
924935 # Add response for abort_multipart_upload that should be called after the error
925936 self .stubber .add_response (
@@ -938,11 +949,14 @@ def test_multipart_upload_with_no_overwrite_flag_when_object_exists(self):
938949 )
939950 future .result ()
940951 # Verify the error is a PreconditionFailed error
941- self .assertEqual (context .exception .response ['Error' ]['Code' ], 'PreconditionFailed' )
952+ self .assertEqual (
953+ context .exception .response ['Error' ]['Code' ], 'PreconditionFailed'
954+ )
942955 self .stubber .assert_no_pending_responses ()
943956
944- def test_multipart_upload_with_no_overwrite_flag_when_object_does_not_exist (self ):
945- """Test that multipart upload succeeds when object doesn't exist"""
957+ def test_multipart_upload_with_no_overwrite_flag_when_object_does_not_exist (
958+ self ,
959+ ):
946960 self .extra_args ['IfNoneMatch' ] = '*'
947961 # Add response for create_multipart_upload (no IfNoneMatch here)
948962 self .add_create_multipart_response_with_default_expected_params ()
@@ -958,13 +972,25 @@ def test_multipart_upload_with_no_overwrite_flag_when_object_does_not_exist(self
958972 'UploadId' : self .multipart_id ,
959973 'MultipartUpload' : {
960974 'Parts' : [
961- {'ETag' : 'etag-1' , 'PartNumber' : 1 , 'ChecksumCRC64NVME' : 'sum1==' },
962- {'ETag' : 'etag-2' , 'PartNumber' : 2 , 'ChecksumCRC64NVME' : 'sum2==' },
963- {'ETag' : 'etag-3' , 'PartNumber' : 3 , 'ChecksumCRC64NVME' : 'sum3==' }
975+ {
976+ 'ETag' : 'etag-1' ,
977+ 'PartNumber' : 1 ,
978+ 'ChecksumCRC64NVME' : 'sum1==' ,
979+ },
980+ {
981+ 'ETag' : 'etag-2' ,
982+ 'PartNumber' : 2 ,
983+ 'ChecksumCRC64NVME' : 'sum2==' ,
984+ },
985+ {
986+ 'ETag' : 'etag-3' ,
987+ 'PartNumber' : 3 ,
988+ 'ChecksumCRC64NVME' : 'sum3==' ,
989+ },
964990 ]
965991 },
966- 'IfNoneMatch' : '*'
967- }
992+ 'IfNoneMatch' : '*' ,
993+ },
968994 )
969995 # Execute the upload
970996 future = self .manager .upload (
0 commit comments