From ac4e13bf94ed2d722eb607555a5c036b9c139c8b Mon Sep 17 00:00:00 2001 From: Astha Mohta Date: Thu, 24 Mar 2022 10:29:00 +0530 Subject: [PATCH] linting --- google/cloud/spanner_v1/instance.py | 37 ++++++------ samples/samples/autocommit.py | 7 +-- samples/samples/autocommit_test.py | 2 +- samples/samples/backup_sample.py | 69 ++++++++++++++------- samples/samples/backup_sample_test.py | 39 ++++++------ samples/samples/conftest.py | 6 +- samples/samples/noxfile.py | 8 +-- samples/samples/snippets.py | 86 ++++++++++++++------------- samples/samples/snippets_test.py | 36 +++++++++-- 9 files changed, 171 insertions(+), 119 deletions(-) diff --git a/google/cloud/spanner_v1/instance.py b/google/cloud/spanner_v1/instance.py index a7725c7057..d3514bd85d 100644 --- a/google/cloud/spanner_v1/instance.py +++ b/google/cloud/spanner_v1/instance.py @@ -557,24 +557,25 @@ def copy_backup( self, backup_id, source_backup, expire_time=None, encryption_config=None, ): """Factory to create a copy backup within this instance. - :type backup_id: str - :param backup_id: The ID of the backup copy. - :type source_backup: str - :param source_backup_id: The full path of the source backup to be copied. - :type expire_time: :class:`datetime.datetime` - :param expire_time: - Optional. The expire time that will be used when creating the copy backup. - Required if the create method needs to be called. - :type encryption_config: - :class:`~google.cloud.spanner_admin_database_v1.types.CopyBackupEncryptionConfig` - or :class:`dict` - :param encryption_config: - (Optional) Encryption configuration for the backup. - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.spanner_admin_database_v1.types.CopyBackupEncryptionConfig` - :rtype: :class:`~google.cloud.spanner_v1.backup.Backup` - :returns: a copy backup owned by this instance. - """ + + :type backup_id: str + :param backup_id: The ID of the backup copy. + :type source_backup: str + :param source_backup_id: The full path of the source backup to be copied. + :type expire_time: :class:`datetime.datetime` + :param expire_time: + Optional. The expire time that will be used when creating the copy backup. + Required if the create method needs to be called. + :type encryption_config: + :class:`~google.cloud.spanner_admin_database_v1.types.CopyBackupEncryptionConfig` + or :class:`dict` + :param encryption_config: + (Optional) Encryption configuration for the backup. + If a dict is provided, it must be of the same form as the protobuf + message :class:`~google.cloud.spanner_admin_database_v1.types.CopyBackupEncryptionConfig` + :rtype: :class:`~google.cloud.spanner_v1.backup.Backup` + :returns: a copy backup owned by this instance. + """ return Backup( backup_id, self, diff --git a/samples/samples/autocommit.py b/samples/samples/autocommit.py index 873ed2b7bd..d5c44b0c53 100644 --- a/samples/samples/autocommit.py +++ b/samples/samples/autocommit.py @@ -46,14 +46,11 @@ def enable_autocommit_mode(instance_id, database_id): if __name__ == "__main__": parser = argparse.ArgumentParser( - description=__doc__, - formatter_class=argparse.RawDescriptionHelpFormatter, + description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter, ) parser.add_argument("instance_id", help="Your Cloud Spanner instance ID.") parser.add_argument( - "--database-id", - help="Your Cloud Spanner database ID.", - default="example_db", + "--database-id", help="Your Cloud Spanner database ID.", default="example_db", ) subparsers = parser.add_subparsers(dest="command") subparsers.add_parser("enable_autocommit_mode", help=enable_autocommit_mode.__doc__) diff --git a/samples/samples/autocommit_test.py b/samples/samples/autocommit_test.py index 9880460cac..6b102da8fe 100644 --- a/samples/samples/autocommit_test.py +++ b/samples/samples/autocommit_test.py @@ -19,7 +19,7 @@ def sample_name(): @RetryErrors(exception=Aborted, max_tries=2) def test_enable_autocommit_mode(capsys, instance_id, sample_database): # Delete table if it exists for retry attempts. - table = sample_database.table('Singers') + table = sample_database.table("Singers") if table.exists(): op = sample_database.update_ddl(["DROP TABLE Singers"]) op.result() diff --git a/samples/samples/backup_sample.py b/samples/samples/backup_sample.py index b2f63ca29e..01d3e4bf60 100644 --- a/samples/samples/backup_sample.py +++ b/samples/samples/backup_sample.py @@ -34,7 +34,9 @@ def create_backup(instance_id, database_id, backup_id, version_time): # Create a backup expire_time = datetime.utcnow() + timedelta(days=14) - backup = instance.backup(backup_id, database=database, expire_time=expire_time, version_time=version_time) + backup = instance.backup( + backup_id, database=database, expire_time=expire_time, version_time=version_time + ) operation = backup.create() # Wait for backup operation to complete. @@ -56,7 +58,9 @@ def create_backup(instance_id, database_id, backup_id, version_time): # [END spanner_create_backup] # [START spanner_create_backup_with_encryption_key] -def create_backup_with_encryption_key(instance_id, database_id, backup_id, kms_key_name): +def create_backup_with_encryption_key( + instance_id, database_id, backup_id, kms_key_name +): """Creates a backup for a database using a Customer Managed Encryption Key (CMEK).""" from google.cloud.spanner_admin_database_v1 import CreateBackupEncryptionConfig @@ -67,10 +71,15 @@ def create_backup_with_encryption_key(instance_id, database_id, backup_id, kms_k # Create a backup expire_time = datetime.utcnow() + timedelta(days=14) encryption_config = { - 'encryption_type': CreateBackupEncryptionConfig.EncryptionType.CUSTOMER_MANAGED_ENCRYPTION, - 'kms_key_name': kms_key_name, + "encryption_type": CreateBackupEncryptionConfig.EncryptionType.CUSTOMER_MANAGED_ENCRYPTION, + "kms_key_name": kms_key_name, } - backup = instance.backup(backup_id, database=database, expire_time=expire_time, encryption_config=encryption_config) + backup = instance.backup( + backup_id, + database=database, + expire_time=expire_time, + encryption_config=encryption_config, + ) operation = backup.create() # Wait for backup operation to complete. @@ -115,7 +124,7 @@ def restore_database(instance_id, new_database_id, backup_id): restore_info.backup_info.source_database, new_database_id, restore_info.backup_info.backup, - restore_info.backup_info.version_time + restore_info.backup_info.version_time, ) ) @@ -124,7 +133,9 @@ def restore_database(instance_id, new_database_id, backup_id): # [START spanner_restore_backup_with_encryption_key] -def restore_database_with_encryption_key(instance_id, new_database_id, backup_id, kms_key_name): +def restore_database_with_encryption_key( + instance_id, new_database_id, backup_id, kms_key_name +): """Restores a database from a backup using a Customer Managed Encryption Key (CMEK).""" from google.cloud.spanner_admin_database_v1 import RestoreDatabaseEncryptionConfig @@ -134,10 +145,12 @@ def restore_database_with_encryption_key(instance_id, new_database_id, backup_id # Start restoring an existing backup to a new database. backup = instance.backup(backup_id) encryption_config = { - 'encryption_type': RestoreDatabaseEncryptionConfig.EncryptionType.CUSTOMER_MANAGED_ENCRYPTION, - 'kms_key_name': kms_key_name, + "encryption_type": RestoreDatabaseEncryptionConfig.EncryptionType.CUSTOMER_MANAGED_ENCRYPTION, + "kms_key_name": kms_key_name, } - new_database = instance.database(new_database_id, encryption_config=encryption_config) + new_database = instance.database( + new_database_id, encryption_config=encryption_config + ) operation = new_database.restore(backup) # Wait for restore operation to complete. @@ -210,7 +223,7 @@ def list_backup_operations(instance_id, database_id, backup_id): metadata.name, metadata.database, metadata.progress.progress_percent ) ) - + # List the CopyBackup operations. filter_ = ( "(metadata.@type:type.googleapis.com/google.spanner.admin.database.v1.CopyBackupMetadata) " @@ -221,7 +234,9 @@ def list_backup_operations(instance_id, database_id, backup_id): metadata = op.metadata print( "Backup {} on source backup {}: {}% complete.".format( - metadata.name, metadata.source_backup, metadata.progress.progress_percent + metadata.name, + metadata.source_backup, + metadata.progress.progress_percent, ) ) @@ -305,8 +320,11 @@ def list_backups(instance_id, database_id, backup_id): print("All backups with pagination") # If there are multiple pages, additional ``ListBackup`` # requests will be made as needed while iterating. + paged_backups = set() for backup in instance.list_backups(page_size=2): - print(backup.name) + paged_backups.add(backup.name) + for backup in paged_backups: + print(backup) # [END spanner_list_backups] @@ -358,7 +376,9 @@ def update_backup(instance_id, backup_id): # [START spanner_create_database_with_version_retention_period] -def create_database_with_version_retention_period(instance_id, database_id, retention_period): +def create_database_with_version_retention_period( + instance_id, database_id, retention_period +): """Creates a database with a version retention period.""" spanner_client = spanner.Client() instance = spanner_client.instance(instance_id) @@ -378,7 +398,7 @@ def create_database_with_version_retention_period(instance_id, database_id, rete "ALTER DATABASE `{}`" " SET OPTIONS (version_retention_period = '{}')".format( database_id, retention_period - ) + ), ] db = instance.database(database_id, ddl_statements) operation = db.create() @@ -387,12 +407,15 @@ def create_database_with_version_retention_period(instance_id, database_id, rete db.reload() - print("Database {} created with version retention period {} and earliest version time {}".format( - db.database_id, db.version_retention_period, db.earliest_version_time - )) + print( + "Database {} created with version retention period {} and earliest version time {}".format( + db.database_id, db.version_retention_period, db.earliest_version_time + ) + ) db.drop() + # [END spanner_create_database_with_version_retention_period] @@ -404,7 +427,9 @@ def copy_backup(instance_id, backup_id, source_backup_path): # Create a backup object and wait for copy backup operation to complete. expire_time = datetime.utcnow() + timedelta(days=14) - copy_backup = instance.copy_backup(backup_id=backup_id, source_backup=source_backup_path, expire_time=expire_time) + copy_backup = instance.copy_backup( + backup_id=backup_id, source_backup=source_backup_path, expire_time=expire_time + ) operation = copy_backup.create() # Wait for copy backup operation to complete. @@ -416,10 +441,14 @@ def copy_backup(instance_id, backup_id, source_backup_path): print( "Backup {} of size {} bytes was created at {} with version time {}".format( - copy_backup.name, copy_backup.size_bytes, copy_backup.create_time, copy_backup.version_time, + copy_backup.name, + copy_backup.size_bytes, + copy_backup.create_time, + copy_backup.version_time, ) ) + # [END spanner_copy_backup] diff --git a/samples/samples/backup_sample_test.py b/samples/samples/backup_sample_test.py index ffecdd814b..da50fbba46 100644 --- a/samples/samples/backup_sample_test.py +++ b/samples/samples/backup_sample_test.py @@ -52,23 +52,22 @@ def test_create_backup(capsys, instance_id, sample_database): version_time = list(results)[0][0] backup_sample.create_backup( - instance_id, - sample_database.database_id, - BACKUP_ID, - version_time, + instance_id, sample_database.database_id, BACKUP_ID, version_time, ) out, _ = capsys.readouterr() assert BACKUP_ID in out -@pytest.mark.dependency(name="copy_backup",depends=["create_backup"]) +@pytest.mark.dependency(name="copy_backup", depends=["create_backup"]) def test_copy_backup(capsys, instance_id, spanner_client): - source_backp_path=spanner_client.project_name+'/instances/'+instance_id+'/backups/'+BACKUP_ID - backup_sample.copy_backup( - instance_id, - COPY_BACKUP_ID, - source_backp_path + source_backp_path = ( + spanner_client.project_name + + "/instances/" + + instance_id + + "/backups/" + + BACKUP_ID ) + backup_sample.copy_backup(instance_id, COPY_BACKUP_ID, source_backp_path) out, _ = capsys.readouterr() assert COPY_BACKUP_ID in out @@ -78,10 +77,7 @@ def test_create_backup_with_encryption_key( capsys, instance_id, sample_database, kms_key_name, ): backup_sample.create_backup_with_encryption_key( - instance_id, - sample_database.database_id, - CMEK_BACKUP_ID, - kms_key_name, + instance_id, sample_database.database_id, CMEK_BACKUP_ID, kms_key_name, ) out, _ = capsys.readouterr() assert CMEK_BACKUP_ID in out @@ -104,7 +100,8 @@ def test_restore_database_with_encryption_key( capsys, instance_id, sample_database, kms_key_name, ): backup_sample.restore_database_with_encryption_key( - instance_id, CMEK_RESTORE_DB_ID, CMEK_BACKUP_ID, kms_key_name) + instance_id, CMEK_RESTORE_DB_ID, CMEK_BACKUP_ID, kms_key_name + ) out, _ = capsys.readouterr() assert (sample_database.database_id + " restored to ") in out assert (CMEK_RESTORE_DB_ID + " from backup ") in out @@ -115,7 +112,8 @@ def test_restore_database_with_encryption_key( @pytest.mark.dependency(depends=["create_backup", "copy_backup"]) def test_list_backup_operations(capsys, instance_id, sample_database): backup_sample.list_backup_operations( - instance_id, sample_database.database_id, BACKUP_ID) + instance_id, sample_database.database_id, BACKUP_ID + ) out, _ = capsys.readouterr() assert BACKUP_ID in out assert sample_database.database_id in out @@ -123,8 +121,10 @@ def test_list_backup_operations(capsys, instance_id, sample_database): print(out) -@pytest.mark.dependency(depends=["create_backup"]) -def test_list_backups(capsys, instance_id, sample_database, ): +@pytest.mark.dependency(name="list_backup", depends=["create_backup", "copy_backup"]) +def test_list_backups( + capsys, instance_id, sample_database, +): backup_sample.list_backups( instance_id, sample_database.database_id, BACKUP_ID, ) @@ -140,7 +140,7 @@ def test_update_backup(capsys, instance_id): assert BACKUP_ID in out -@pytest.mark.dependency(depends=["create_backup","copy_backup"]) +@pytest.mark.dependency(depends=["create_backup", "copy_backup", "list_backup"]) def test_delete_backup(capsys, instance_id): backup_sample.delete_backup(instance_id, BACKUP_ID) out, _ = capsys.readouterr() @@ -173,4 +173,3 @@ def test_create_database_with_retention_period(capsys, sample_instance): assert ("retention period " + RETENTION_PERIOD) in out database = sample_instance.database(RETENTION_DATABASE_ID) database.drop() - diff --git a/samples/samples/conftest.py b/samples/samples/conftest.py index b3728a4db4..314c984920 100644 --- a/samples/samples/conftest.py +++ b/samples/samples/conftest.py @@ -93,9 +93,7 @@ def instance_config(spanner_client): @pytest.fixture(scope="module") def multi_region_instance_config(spanner_client): - return "{}/instanceConfigs/{}".format( - spanner_client.project_name, "nam3" - ) + return "{}/instanceConfigs/{}".format(spanner_client.project_name, "nam3") @pytest.fixture(scope="module") @@ -143,7 +141,7 @@ def multi_region_instance( labels={ "cloud_spanner_samples": "true", "sample_name": sample_name, - "created": str(int(time.time())) + "created": str(int(time.time())), }, ) op = retry_429(multi_region_instance.create)() diff --git a/samples/samples/noxfile.py b/samples/samples/noxfile.py index 4c808af73e..85f5836dba 100644 --- a/samples/samples/noxfile.py +++ b/samples/samples/noxfile.py @@ -208,9 +208,7 @@ def _session_tests( if os.path.exists("requirements-test.txt"): if os.path.exists("constraints-test.txt"): - session.install( - "-r", "requirements-test.txt", "-c", "constraints-test.txt" - ) + session.install("-r", "requirements-test.txt", "-c", "constraints-test.txt") else: session.install("-r", "requirements-test.txt") with open("requirements-test.txt") as rtfile: @@ -223,9 +221,9 @@ def _session_tests( post_install(session) if "pytest-parallel" in packages: - concurrent_args.extend(['--workers', 'auto', '--tests-per-worker', 'auto']) + concurrent_args.extend(["--workers", "auto", "--tests-per-worker", "auto"]) elif "pytest-xdist" in packages: - concurrent_args.extend(['-n', 'auto']) + concurrent_args.extend(["-n", "auto"]) session.run( "pytest", diff --git a/samples/samples/snippets.py b/samples/samples/snippets.py index 5a3ac6df24..87721c021f 100644 --- a/samples/samples/snippets.py +++ b/samples/samples/snippets.py @@ -51,8 +51,8 @@ def create_instance(instance_id): labels={ "cloud_spanner_samples": "true", "sample_name": "snippets-create_instance-explicit", - "created": str(int(time.time())) - } + "created": str(int(time.time())), + }, ) operation = instance.create() @@ -83,8 +83,8 @@ def create_instance_with_processing_units(instance_id, processing_units): labels={ "cloud_spanner_samples": "true", "sample_name": "snippets-create_instance_with_processing_units", - "created": str(int(time.time())) - } + "created": str(int(time.time())), + }, ) operation = instance.create() @@ -92,8 +92,11 @@ def create_instance_with_processing_units(instance_id, processing_units): print("Waiting for operation to complete...") operation.result(OPERATION_TIMEOUT_SECONDS) - print("Created instance {} with {} processing units".format( - instance_id, instance.processing_units)) + print( + "Created instance {} with {} processing units".format( + instance_id, instance.processing_units + ) + ) # [END spanner_create_instance_with_processing_units] @@ -103,10 +106,15 @@ def create_instance_with_processing_units(instance_id, processing_units): def get_instance_config(instance_config): """Gets the leader options for the instance configuration.""" spanner_client = spanner.Client() - config_name = "{}/instanceConfigs/{}".format(spanner_client.project_name, instance_config) + config_name = "{}/instanceConfigs/{}".format( + spanner_client.project_name, instance_config + ) config = spanner_client.instance_admin_api.get_instance_config(name=config_name) - print("Available leader options for instance config {}: {}".format( - instance_config, config.leader_options)) + print( + "Available leader options for instance config {}: {}".format( + instance_config, config.leader_options + ) + ) # [END spanner_get_instance_config] @@ -203,7 +211,7 @@ def create_database_with_encryption_key(instance_id, database_id, kms_key_name): ) PRIMARY KEY (SingerId, AlbumId), INTERLEAVE IN PARENT Singers ON DELETE CASCADE""", ], - encryption_config={'kms_key_name': kms_key_name}, + encryption_config={"kms_key_name": kms_key_name}, ) operation = database.create() @@ -211,17 +219,18 @@ def create_database_with_encryption_key(instance_id, database_id, kms_key_name): print("Waiting for operation to complete...") operation.result(OPERATION_TIMEOUT_SECONDS) - print("Database {} created with encryption key {}".format( - database.name, database.encryption_config.kms_key_name)) + print( + "Database {} created with encryption key {}".format( + database.name, database.encryption_config.kms_key_name + ) + ) # [END spanner_create_database_with_encryption_key] # [START spanner_create_database_with_default_leader] -def create_database_with_default_leader( - instance_id, database_id, default_leader -): +def create_database_with_default_leader(instance_id, database_id, default_leader): """Creates a database with tables with a default leader.""" spanner_client = spanner.Client() instance = spanner_client.instance(instance_id) @@ -254,7 +263,7 @@ def create_database_with_default_leader( print( "Database {} created with default leader {}".format( - database.name, database.default_leader + database.name, database.default_leader ) ) @@ -263,17 +272,19 @@ def create_database_with_default_leader( # [START spanner_update_database_with_default_leader] -def update_database_with_default_leader( - instance_id, database_id, default_leader -): +def update_database_with_default_leader(instance_id, database_id, default_leader): """Updates a database with tables with a default leader.""" spanner_client = spanner.Client() instance = spanner_client.instance(instance_id) database = instance.database(database_id) - operation = database.update_ddl(["ALTER DATABASE {}" - " SET OPTIONS (default_leader = '{}')".format(database_id, default_leader)]) + operation = database.update_ddl( + [ + "ALTER DATABASE {}" + " SET OPTIONS (default_leader = '{}')".format(database_id, default_leader) + ] + ) operation.result(OPERATION_TIMEOUT_SECONDS) database.reload() @@ -316,9 +327,7 @@ def query_information_schema_database_options(instance_id, database_id): "WHERE SCHEMA_NAME = '' AND OPTION_NAME = 'default_leader'" ) for result in results: - print("Database {} has default leader {}".format( - database_id, result[0] - )) + print("Database {} has default leader {}".format(database_id, result[0])) # [END spanner_query_information_schema_database_options] @@ -1307,11 +1316,9 @@ def insert_singers(transaction): database.run_in_transaction(insert_singers) commit_stats = database.logger.last_commit_stats - print( - "{} mutation(s) in transaction.".format( - commit_stats.mutation_count - ) - ) + print("{} mutation(s) in transaction.".format(commit_stats.mutation_count)) + + # [END spanner_get_commit_stats] @@ -2011,7 +2018,7 @@ def query_data_with_query_options(instance_id, database_id): "SELECT VenueId, VenueName, LastUpdateTime FROM Venues", query_options={ "optimizer_version": "1", - "optimizer_statistics_package": "latest" + "optimizer_statistics_package": "latest", }, ) @@ -2028,8 +2035,9 @@ def create_client_with_query_options(instance_id, database_id): spanner_client = spanner.Client( query_options={ "optimizer_version": "1", - "optimizer_statistics_package": "auto_20191128_14_47_22UTC" - }) + "optimizer_statistics_package": "auto_20191128_14_47_22UTC", + } + ) instance = spanner_client.instance(instance_id) database = instance.database(database_id) @@ -2057,7 +2065,7 @@ def update_venues(transaction): # This request tag will only be set on this request. transaction.execute_update( "UPDATE Venues SET Capacity = CAST(Capacity/4 AS INT64) WHERE OutdoorVenue = false", - request_options={"request_tag": "app=concert,env=dev,action=update"} + request_options={"request_tag": "app=concert,env=dev,action=update"}, ) print("Venue capacities updated.") @@ -2070,21 +2078,19 @@ def update_venues(transaction): "venueId": 81, "venueName": "Venue 81", "capacity": 1440, - "outdoorVenue": True + "outdoorVenue": True, }, param_types={ "venueId": param_types.INT64, "venueName": param_types.STRING, "capacity": param_types.INT64, - "outdoorVenue": param_types.BOOL + "outdoorVenue": param_types.BOOL, }, - request_options={"request_tag": "app=concert,env=dev,action=insert"} + request_options={"request_tag": "app=concert,env=dev,action=insert"}, ) print("New venue inserted.") - database.run_in_transaction( - update_venues, transaction_tag="app=concert,env=dev" - ) + database.run_in_transaction(update_venues, transaction_tag="app=concert,env=dev") # [END spanner_set_transaction_tag] @@ -2101,7 +2107,7 @@ def set_request_tag(instance_id, database_id): with database.snapshot() as snapshot: results = snapshot.execute_sql( "SELECT SingerId, AlbumId, AlbumTitle FROM Albums", - request_options={"request_tag": "app=concert,env=dev,action=select"} + request_options={"request_tag": "app=concert,env=dev,action=select"}, ) for row in results: diff --git a/samples/samples/snippets_test.py b/samples/samples/snippets_test.py index d81032fa20..a5fa6a5caf 100644 --- a/samples/samples/snippets_test.py +++ b/samples/samples/snippets_test.py @@ -124,8 +124,12 @@ def test_create_instance_with_processing_units(capsys, lci_instance_id): retry_429(instance.delete)() -def test_create_database_with_encryption_config(capsys, instance_id, cmek_database_id, kms_key_name): - snippets.create_database_with_encryption_key(instance_id, cmek_database_id, kms_key_name) +def test_create_database_with_encryption_config( + capsys, instance_id, cmek_database_id, kms_key_name +): + snippets.create_database_with_encryption_key( + instance_id, cmek_database_id, kms_key_name + ) out, _ = capsys.readouterr() assert cmek_database_id in out assert kms_key_name in out @@ -150,7 +154,13 @@ def test_list_databases(capsys, instance_id): assert "has default leader" in out -def test_create_database_with_default_leader(capsys, multi_region_instance, multi_region_instance_id, default_leader_database_id, default_leader): +def test_create_database_with_default_leader( + capsys, + multi_region_instance, + multi_region_instance_id, + default_leader_database_id, + default_leader, +): retry_429 = RetryErrors(exceptions.ResourceExhausted, delay=15) retry_429(snippets.create_database_with_default_leader)( multi_region_instance_id, default_leader_database_id, default_leader @@ -160,7 +170,13 @@ def test_create_database_with_default_leader(capsys, multi_region_instance, mult assert default_leader in out -def test_update_database_with_default_leader(capsys, multi_region_instance, multi_region_instance_id, default_leader_database_id, default_leader): +def test_update_database_with_default_leader( + capsys, + multi_region_instance, + multi_region_instance_id, + default_leader_database_id, + default_leader, +): retry_429 = RetryErrors(exceptions.ResourceExhausted, delay=15) retry_429(snippets.update_database_with_default_leader)( multi_region_instance_id, default_leader_database_id, default_leader @@ -176,7 +192,13 @@ def test_get_database_ddl(capsys, instance_id, sample_database): assert sample_database.database_id in out -def test_query_information_schema_database_options(capsys, multi_region_instance, multi_region_instance_id, default_leader_database_id, default_leader): +def test_query_information_schema_database_options( + capsys, + multi_region_instance, + multi_region_instance_id, + default_leader_database_id, + default_leader, +): snippets.query_information_schema_database_options( multi_region_instance_id, default_leader_database_id ) @@ -587,7 +609,9 @@ def test_query_data_with_json_parameter(capsys, instance_id, sample_database): @pytest.mark.dependency(depends=["insert_datatypes_data"]) def test_query_data_with_timestamp_parameter(capsys, instance_id, sample_database): - snippets.query_data_with_timestamp_parameter(instance_id, sample_database.database_id) + snippets.query_data_with_timestamp_parameter( + instance_id, sample_database.database_id + ) out, _ = capsys.readouterr() assert "VenueId: 4, VenueName: Venue 4, LastUpdateTime:" in out assert "VenueId: 19, VenueName: Venue 19, LastUpdateTime:" in out