def test_type_string_to_type_pb_hit(self): from google.cloud.spanner_admin_database_v1 import ( OptimizeRestoredDatabaseMetadata, ) from google.cloud.spanner_v1 import instance type_string = "type.googleapis.com/google.spanner.admin.database.v1.OptimizeRestoredDatabaseMetadata" self.assertIn(type_string, instance._OPERATION_METADATA_TYPES) self.assertEqual( instance._type_string_to_type_pb(type_string), OptimizeRestoredDatabaseMetadata, )
def test_type_string_to_type_pb_miss(self): from google.cloud.spanner_v1 import instance from google.protobuf.empty_pb2 import Empty self.assertEqual(instance._type_string_to_type_pb("invalid_string"), Empty)