From f2b4cb0dd67bf7ce1a0e395d57a64e46108386f8 Mon Sep 17 00:00:00 2001 From: aemous Date: Mon, 23 Sep 2024 15:04:39 -0400 Subject: [PATCH] Swap format operation in favor of formatted string syntax. --- tests/functional/s3/test_cp_command.py | 14 ++++---------- tests/functional/s3/test_mv_command.py | 7 ++----- tests/functional/s3/test_sync_command.py | 14 ++++---------- 3 files changed, 10 insertions(+), 25 deletions(-) diff --git a/tests/functional/s3/test_cp_command.py b/tests/functional/s3/test_cp_command.py index 2fb9160b83d36..1070bb696c319 100644 --- a/tests/functional/s3/test_cp_command.py +++ b/tests/functional/s3/test_cp_command.py @@ -762,9 +762,7 @@ def test_cp_with_error_and_warning_permissions(self): def test_upload_with_checksum_algorithm_crc32(self): full_path = self.files.create_file('foo.txt', 'contents') - cmdline = ( - '%s %s s3://bucket/key.txt --checksum-algorithm CRC32' % ( - self.prefix, full_path)) + cmdline = f'{self.prefix} {full_path} s3://bucket/key.txt --checksum-algorithm CRC32' self.run_cmd(cmdline, expected_rc=0) self.assert_in_operations_called( ('PutObject', { @@ -778,9 +776,7 @@ def test_upload_with_checksum_algorithm_crc32(self): def test_upload_with_checksum_algorithm_crc32c(self): full_path = self.files.create_file('foo.txt', 'contents') - cmdline = ( - '%s %s s3://bucket/key.txt --checksum-algorithm CRC32C' % ( - self.prefix, full_path)) + cmdline = f'{self.prefix} {full_path} s3://bucket/key.txt --checksum-algorithm CRC32C' self.run_cmd(cmdline, expected_rc=0) self.assert_in_operations_called( ('PutObject', { @@ -803,8 +799,7 @@ def test_download_with_checksum_mode_crc32(self): 'Body': BytesIO(b'foo') } ] - cmdline = '%s s3://bucket/foo %s --checksum-mode ENABLED' \ - % (self.prefix, self.files.rootdir) + cmdline = f'{self.prefix} s3://bucket/foo {self.files.rootdir} --checksum-mode ENABLED' self.run_cmd(cmdline, expected_rc=0) self.assertEqual(self.operations_called[1][0].name, 'GetObject') self.assertEqual(self.operations_called[1][1]['ChecksumMode'], 'ENABLED') @@ -820,8 +815,7 @@ def test_download_with_checksum_mode_crc32c(self): 'Body': BytesIO(b'foo') } ] - cmdline = '%s s3://bucket/foo %s --checksum-mode ENABLED' \ - % (self.prefix, self.files.rootdir) + cmdline = f'{self.prefix} s3://bucket/foo {self.files.rootdir} --checksum-mode ENABLED' self.run_cmd(cmdline, expected_rc=0) self.assertEqual(self.operations_called[1][0].name, 'GetObject') self.assertEqual(self.operations_called[1][1]['ChecksumMode'], 'ENABLED') diff --git a/tests/functional/s3/test_mv_command.py b/tests/functional/s3/test_mv_command.py index ae6d4dfcb7bb0..5754dd9093034 100644 --- a/tests/functional/s3/test_mv_command.py +++ b/tests/functional/s3/test_mv_command.py @@ -246,9 +246,7 @@ def test_mv_does_not_delete_source_on_failed_put_tagging(self): def test_upload_with_checksum_algorithm_crc32(self): full_path = self.files.create_file('foo.txt', 'contents') - cmdline = ( - '%s %s s3://bucket/key.txt --checksum-algorithm CRC32' % ( - self.prefix, full_path)) + cmdline = f'{self.prefix} {full_path} s3://bucket/key.txt --checksum-algorithm CRC32' self.run_cmd(cmdline, expected_rc=0) self.assert_in_operations_called( ('PutObject', { @@ -272,8 +270,7 @@ def test_download_with_checksum_mode_crc32(self): }, self.delete_object_response() ] - cmdline = '%s s3://bucket/foo %s --checksum-mode ENABLED' \ - % (self.prefix, self.files.rootdir) + cmdline = f'{self.prefix} s3://bucket/foo {self.files.rootdir} --checksum-mode ENABLED' self.run_cmd(cmdline, expected_rc=0) self.assertEqual(self.operations_called[1][0].name, 'GetObject') self.assertEqual(self.operations_called[1][1]['ChecksumMode'], 'ENABLED') diff --git a/tests/functional/s3/test_sync_command.py b/tests/functional/s3/test_sync_command.py index 556ae533aef40..97086dbd15249 100644 --- a/tests/functional/s3/test_sync_command.py +++ b/tests/functional/s3/test_sync_command.py @@ -355,9 +355,7 @@ def test_with_copy_props(self): def test_upload_with_checksum_algorithm_sha1(self): self.files.create_file('foo.txt', 'contents') - cmdline = ( - '%s %s s3://bucket/ --checksum-algorithm SHA1' % ( - self.prefix, self.files.rootdir)) + cmdline = f'{self.prefix} {self.files.rootdir} s3://bucket/ --checksum-algorithm SHA1' self.run_cmd(cmdline, expected_rc=0) self.assert_in_operations_called( ('PutObject', { @@ -371,9 +369,7 @@ def test_upload_with_checksum_algorithm_sha1(self): def test_upload_with_checksum_algorithm_sha256(self): self.files.create_file('foo.txt', 'contents') - cmdline = ( - '%s %s s3://bucket/ --checksum-algorithm SHA256' % ( - self.prefix, self.files.rootdir)) + cmdline = f'{self.prefix} {self.files.rootdir} s3://bucket/ --checksum-algorithm SHA256' self.run_cmd(cmdline, expected_rc=0) self.assert_in_operations_called( ('PutObject', { @@ -396,8 +392,7 @@ def test_download_with_checksum_mode_sha1(self): 'Body': BytesIO(b'foo') } ] - cmdline = '%s s3://bucket/foo %s --checksum-mode ENABLED' \ - % (self.prefix, self.files.rootdir) + cmdline = f'{self.prefix} s3://bucket/foo {self.files.rootdir} --checksum-mode ENABLED' self.run_cmd(cmdline, expected_rc=0) self.assertEqual(self.operations_called[0][0].name, 'ListObjectsV2') @@ -412,8 +407,7 @@ def test_download_with_checksum_mode_sha256(self): 'Body': BytesIO(b'foo') } ] - cmdline = '%s s3://bucket/foo %s --checksum-mode ENABLED' \ - % (self.prefix, self.files.rootdir) + cmdline = f'{self.prefix} s3://bucket/foo {self.files.rootdir} --checksum-mode ENABLED' self.run_cmd(cmdline, expected_rc=0) self.assertEqual(self.operations_called[0][0].name, 'ListObjectsV2')