uid stringlengths 24 24 | split stringclasses 1
value | category stringclasses 2
values | content stringlengths 5 482k | signature stringlengths 1 14k | suffix stringlengths 1 482k | prefix stringlengths 9 14k | prefix_token_count int64 3 5.01k | prefix_token_budget int64 64 256 | element_token_count int64 1 292k | signature_token_count int64 1 5.01k | prefix_context_token_count int64 0 255 | repo stringlengths 7 112 | path stringlengths 4 208 | language stringclasses 1
value | name stringlengths 1 218 | qualname stringlengths 1 218 | start_line int64 1 26.7k | end_line int64 1 26.7k | signature_start_line int64 1 26.7k | signature_end_line int64 1 26.7k | source_hash stringlengths 40 40 | source_dataset stringclasses 1
value | source_split stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
8d0e7407f0ae49872aca8ca2 | train | function | def test_get_game_server_deployment_rollout_flattened_error():
client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(),
)
# Attempting to call a method with both a request object and flattened
# fields is an error.
with pytest.raises(ValueError):
... | def test_get_game_server_deployment_rollout_flattened_error():
| client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(),
)
# Attempting to call a method with both a request object and flattened
# fields is an error.
with pytest.raises(ValueError):
client.get_game_server_deployment_rollout(
game_ser... | the underlying call was made with the expected
# request object values.
assert len(call.mock_calls) == 1
_, args, _ = call.mock_calls[0]
assert args[0].name == "name_value"
def test_get_game_server_deployment_rollout_flattened_error():
| 64 | 64 | 96 | 14 | 50 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_get_game_server_deployment_rollout_flattened_error | test_get_game_server_deployment_rollout_flattened_error | 1,869 | 1,880 | 1,869 | 1,869 | e8c610278a8b33702093b43c0fd9138960d2c9ac | bigcode/the-stack | train |
db17b038cb1707154d67d347 | train | function | def test_delete_game_server_deployment_flattened():
client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(),
)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(client._transport.delete_game_server_deploym... | def test_delete_game_server_deployment_flattened():
| client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(),
)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(client._transport.delete_game_server_deployment), "__call__"
) as call:
# Designate ... | ]
assert args[0] == request
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
def test_delete_game_server_deployment_flattened():
| 63 | 64 | 192 | 11 | 52 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_delete_game_server_deployment_flattened | test_delete_game_server_deployment_flattened | 1,375 | 1,396 | 1,375 | 1,375 | bf1790950c7d6c2ebb5432c338a72d93691361c4 | bigcode/the-stack | train |
33d3e6ff41bb2eb37822eb79 | train | function | def test_preview_game_server_deployment_rollout_from_dict():
test_preview_game_server_deployment_rollout(request_type=dict)
| def test_preview_game_server_deployment_rollout_from_dict():
| test_preview_game_server_deployment_rollout(request_type=dict)
| response is the type that we expect.
assert isinstance(
response, game_server_deployments.PreviewGameServerDeploymentRolloutResponse
)
assert response.unavailable == ["unavailable_value"]
assert response.etag == "etag_value"
def test_preview_game_server_deployment_rollout_from_dict():
| 64 | 64 | 25 | 12 | 52 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_preview_game_server_deployment_rollout_from_dict | test_preview_game_server_deployment_rollout_from_dict | 2,210 | 2,211 | 2,210 | 2,210 | 74346242552bcd59c196a33914830aa3168a52e3 | bigcode/the-stack | train |
1c4da7c8d9130bec99dc60ac | train | function | def test_get_game_server_deployment_rollout(
transport: str = "grpc",
request_type=game_server_deployments.GetGameServerDeploymentRolloutRequest,
):
client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(), transport=transport,
)
# Everything is optional i... | def test_get_game_server_deployment_rollout(
transport: str = "grpc",
request_type=game_server_deployments.GetGameServerDeploymentRolloutRequest,
):
| client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(), transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
# and we are mocking out the actual API, so just send an empty request.
request = request_type()
# ... | pytest.raises(ValueError):
await client.update_game_server_deployment(
game_server_deployments.UpdateGameServerDeploymentRequest(),
game_server_deployment=game_server_deployments.GameServerDeployment(
name="name_value"
),
update_mask=field_mask.Fi... | 100 | 100 | 336 | 36 | 64 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_get_game_server_deployment_rollout | test_get_game_server_deployment_rollout | 1,696 | 1,736 | 1,696 | 1,699 | b8e1d2bed98fd6d57d9d87b3a69419c5dc11addf | bigcode/the-stack | train |
3110b09150fc6036513909a4 | train | function | def test_game_server_deployments_service_client_client_options_from_dict():
with mock.patch(
"google.cloud.gaming_v1.services.game_server_deployments_service.transports.GameServerDeploymentsServiceGrpcTransport.__init__"
) as grpc_transport:
grpc_transport.return_value = None
client = Ga... | def test_game_server_deployments_service_client_client_options_from_dict():
| with mock.patch(
"google.cloud.gaming_v1.services.game_server_deployments_service.transports.GameServerDeploymentsServiceGrpcTransport.__init__"
) as grpc_transport:
grpc_transport.return_value = None
client = GameServerDeploymentsServiceClient(
client_options={"api_endpoint"... | _called_once_with(
credentials=None,
credentials_file="credentials.json",
host=client.DEFAULT_ENDPOINT,
scopes=None,
api_mtls_endpoint=client.DEFAULT_ENDPOINT,
client_cert_source=None,
quota_project_id=None,
)
def test_game_serv... | 64 | 64 | 149 | 14 | 50 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_game_server_deployments_service_client_client_options_from_dict | test_game_server_deployments_service_client_client_options_from_dict | 367 | 383 | 367 | 367 | 157296be5a1cdb38d5486f9dd129503ea58d4b18 | bigcode/the-stack | train |
3afe7695d6f986484cc68f03 | train | function | def test_list_game_server_deployments_flattened_error():
client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(),
)
# Attempting to call a method with both a request object and flattened
# fields is an error.
with pytest.raises(ValueError):
client... | def test_list_game_server_deployments_flattened_error():
| client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(),
)
# Attempting to call a method with both a request object and flattened
# fields is an error.
with pytest.raises(ValueError):
client.list_game_server_deployments(
game_server_de... | that the underlying call was made with the expected
# request object values.
assert len(call.mock_calls) == 1
_, args, _ = call.mock_calls[0]
assert args[0].parent == "parent_value"
def test_list_game_server_deployments_flattened_error():
| 64 | 64 | 93 | 13 | 51 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_list_game_server_deployments_flattened_error | test_list_game_server_deployments_flattened_error | 548 | 559 | 548 | 548 | efe511d978fae3b59905db8154449be51eb46d01 | bigcode/the-stack | train |
68e3d109051d8b95f8c86d6f | train | function | def test_create_game_server_deployment(
transport: str = "grpc",
request_type=game_server_deployments.CreateGameServerDeploymentRequest,
):
client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(), transport=transport,
)
# Everything is optional in proto3 ... | def test_create_game_server_deployment(
transport: str = "grpc",
request_type=game_server_deployments.CreateGameServerDeploymentRequest,
):
| client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(), transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
# and we are mocking out the actual API, so just send an empty request.
request = request_type()
# ... |
# fields is an error.
with pytest.raises(ValueError):
await client.get_game_server_deployment(
game_server_deployments.GetGameServerDeploymentRequest(), name="name_value",
)
def test_create_game_server_deployment(
transport: str = "grpc",
request_type=game_server_deployments... | 75 | 75 | 252 | 32 | 43 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_create_game_server_deployment | test_create_game_server_deployment | 1,016 | 1,044 | 1,016 | 1,019 | f9ec8ed4a71d3cb303966e19f6110381fdb2f0bd | bigcode/the-stack | train |
55f3a56daab69366ea4f927c | train | function | def test_game_server_deployments_service_grpc_transport_channel():
channel = grpc.insecure_channel("http://localhost/")
# Check that if channel is provided, mtls endpoint and client_cert_source
# won't be used.
callback = mock.MagicMock()
transport = transports.GameServerDeploymentsServiceGrpcTrans... | def test_game_server_deployments_service_grpc_transport_channel():
| channel = grpc.insecure_channel("http://localhost/")
# Check that if channel is provided, mtls endpoint and client_cert_source
# won't be used.
callback = mock.MagicMock()
transport = transports.GameServerDeploymentsServiceGrpcTransport(
host="squid.clam.whelk",
channel=channel,
... | (
credentials=credentials.AnonymousCredentials(),
client_options=client_options.ClientOptions(
api_endpoint="gameservices.googleapis.com:8000"
),
)
assert client._transport._host == "gameservices.googleapis.com:8000"
def test_game_server_deployments_service_grpc_transport_cha... | 64 | 64 | 141 | 13 | 51 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_game_server_deployments_service_grpc_transport_channel | test_game_server_deployments_service_grpc_transport_channel | 2,625 | 2,639 | 2,625 | 2,625 | f28bd4c71d0d2616c11989ea8c65df97c78c4e9d | bigcode/the-stack | train |
071adc8f8c049dee22c5d1b2 | train | function | @pytest.mark.asyncio
async def test_list_game_server_deployments_async(transport: str = "grpc_asyncio"):
client = GameServerDeploymentsServiceAsyncClient(
credentials=credentials.AnonymousCredentials(), transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
... | @pytest.mark.asyncio
async def test_list_game_server_deployments_async(transport: str = "grpc_asyncio"):
| client = GameServerDeploymentsServiceAsyncClient(
credentials=credentials.AnonymousCredentials(), transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
# and we are mocking out the actual API, so just send an empty request.
request = game_server_deplo... | the type that we expect.
assert isinstance(response, pagers.ListGameServerDeploymentsPager)
assert response.next_page_token == "next_page_token_value"
assert response.unreachable == ["unreachable_value"]
def test_list_game_server_deployments_from_dict():
test_list_game_server_deployments(request_ty... | 93 | 93 | 311 | 25 | 68 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_list_game_server_deployments_async | test_list_game_server_deployments_async | 427 | 462 | 427 | 428 | ed73503a895832ba660facb786d7f46b75e66f03 | bigcode/the-stack | train |
34d8c9f9e431b30ed1dc7158 | train | function | def test_list_game_server_deployments_pages():
client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials,
)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(client._transport.list_game_server_deployments), "_... | def test_list_game_server_deployments_pages():
| client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials,
)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(client._transport.list_game_server_deployments), "__call__"
) as call:
# Set the respo... | ) + (
gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)),
)
pager = client.list_game_server_deployments(request={})
assert pager._metadata == metadata
results = [i for i in pager]
assert len(results) == 6
assert all(
isinstance(i, game_s... | 96 | 96 | 320 | 10 | 86 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_list_game_server_deployments_pages | test_list_game_server_deployments_pages | 657 | 695 | 657 | 657 | 12391051e18ba7967941046c2d02fc657e2576ed | bigcode/the-stack | train |
538f94b85081bb8133ae00f0 | train | function | @pytest.mark.asyncio
async def test_update_game_server_deployment_flattened_async():
client = GameServerDeploymentsServiceAsyncClient(
credentials=credentials.AnonymousCredentials(),
)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(client... | @pytest.mark.asyncio
async def test_update_game_server_deployment_flattened_async():
| client = GameServerDeploymentsServiceAsyncClient(
credentials=credentials.AnonymousCredentials(),
)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(client._client._transport.update_game_server_deployment), "__call__"
) as call:
... | # fields is an error.
with pytest.raises(ValueError):
client.update_game_server_deployment(
game_server_deployments.UpdateGameServerDeploymentRequest(),
game_server_deployment=game_server_deployments.GameServerDeployment(
name="name_value"
),
... | 89 | 89 | 299 | 18 | 71 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_update_game_server_deployment_flattened_async | test_update_game_server_deployment_flattened_async | 1,639 | 1,675 | 1,639 | 1,640 | 571bade64f391237f260cdaec2991a3ef79c57be | bigcode/the-stack | train |
7bc387fe2bdbddfd2612d442 | train | function | @pytest.mark.asyncio
async def test_delete_game_server_deployment_async(transport: str = "grpc_asyncio"):
client = GameServerDeploymentsServiceAsyncClient(
credentials=credentials.AnonymousCredentials(), transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
... | @pytest.mark.asyncio
async def test_delete_game_server_deployment_async(transport: str = "grpc_asyncio"):
| client = GameServerDeploymentsServiceAsyncClient(
credentials=credentials.AnonymousCredentials(), transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
# and we are mocking out the actual API, so just send an empty request.
request = game_server_deplo... | _server_deployments.DeleteGameServerDeploymentRequest()
# Establish that the response is the type that we expect.
assert isinstance(response, future.Future)
def test_delete_game_server_deployment_from_dict():
test_delete_game_server_deployment(request_type=dict)
@pytest.mark.asyncio
async def test_delete... | 76 | 76 | 255 | 24 | 52 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_delete_game_server_deployment_async | test_delete_game_server_deployment_async | 1,285 | 1,313 | 1,285 | 1,286 | 054f45409b0f7c750cd156f9d14cdf1c6fdf7065 | bigcode/the-stack | train |
9df55057b3720f697c818999 | train | function | def test_delete_game_server_deployment(
transport: str = "grpc",
request_type=game_server_deployments.DeleteGameServerDeploymentRequest,
):
client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(), transport=transport,
)
# Everything is optional in proto3 ... | def test_delete_game_server_deployment(
transport: str = "grpc",
request_type=game_server_deployments.DeleteGameServerDeploymentRequest,
):
| client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(), transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
# and we are mocking out the actual API, so just send an empty request.
request = request_type()
# ... | game_server_deployments.CreateGameServerDeploymentRequest(),
parent="parent_value",
game_server_deployment=game_server_deployments.GameServerDeployment(
name="name_value"
),
)
def test_delete_game_server_deployment(
transport: str = "grpc",
... | 75 | 75 | 252 | 32 | 43 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_delete_game_server_deployment | test_delete_game_server_deployment | 1,250 | 1,278 | 1,250 | 1,253 | 9f18a1a816794a287b4febe796488e827a61e101 | bigcode/the-stack | train |
da34fdc10967e27343535656 | train | function | def test_transport_get_channel():
# A client may be instantiated with a custom transport instance.
transport = transports.GameServerDeploymentsServiceGrpcTransport(
credentials=credentials.AnonymousCredentials(),
)
channel = transport.grpc_channel
assert channel
transport = transports.G... | def test_transport_get_channel():
# A client may be instantiated with a custom transport instance.
| transport = transports.GameServerDeploymentsServiceGrpcTransport(
credentials=credentials.AnonymousCredentials(),
)
channel = transport.grpc_channel
assert channel
transport = transports.GameServerDeploymentsServiceGrpcAsyncIOTransport(
credentials=credentials.AnonymousCredentials()... | .
transport = transports.GameServerDeploymentsServiceGrpcTransport(
credentials=credentials.AnonymousCredentials(),
)
client = GameServerDeploymentsServiceClient(transport=transport)
assert client._transport is transport
def test_transport_get_channel():
# A client may be instantiated with a... | 64 | 64 | 87 | 19 | 44 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_transport_get_channel | test_transport_get_channel | 2,494 | 2,506 | 2,494 | 2,495 | d9c359936c77d2df7d651c273ec8ada25036c7c8 | bigcode/the-stack | train |
bf81c6f6d78f420ed9299ed3 | train | function | @pytest.mark.asyncio
async def test_create_game_server_deployment_field_headers_async():
client = GameServerDeploymentsServiceAsyncClient(
credentials=credentials.AnonymousCredentials(),
)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty ... | @pytest.mark.asyncio
async def test_create_game_server_deployment_field_headers_async():
| client = GameServerDeploymentsServiceAsyncClient(
credentials=credentials.AnonymousCredentials(),
)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = game_server_deployments.CreateGameServerDeploymentRequest()
requ... | = call.mock_calls[0]
assert args[0] == request
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
@pytest.mark.asyncio
async def test_create_game_server_deployment_field_headers_async():
| 76 | 77 | 259 | 17 | 59 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_create_game_server_deployment_field_headers_async | test_create_game_server_deployment_field_headers_async | 1,110 | 1,138 | 1,110 | 1,111 | a88d353b29c9f72faaafa6dc4e44d837701f74e2 | bigcode/the-stack | train |
3dbd83af4929febcc20f8311 | train | function | @pytest.mark.asyncio
async def test_delete_game_server_deployment_field_headers_async():
client = GameServerDeploymentsServiceAsyncClient(
credentials=credentials.AnonymousCredentials(),
)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty ... | @pytest.mark.asyncio
async def test_delete_game_server_deployment_field_headers_async():
| client = GameServerDeploymentsServiceAsyncClient(
credentials=credentials.AnonymousCredentials(),
)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = game_server_deployments.DeleteGameServerDeploymentRequest()
requ... | _ = call.mock_calls[0]
assert args[0] == request
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
@pytest.mark.asyncio
async def test_delete_game_server_deployment_field_headers_async():
| 76 | 77 | 258 | 17 | 59 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_delete_game_server_deployment_field_headers_async | test_delete_game_server_deployment_field_headers_async | 1,344 | 1,372 | 1,344 | 1,345 | 112ce1a3fd27c96eb07eabd39a643a9b69118293 | bigcode/the-stack | train |
b79467fc0a3889a7d9e841c7 | train | function | def test_game_server_deployments_service_client_get_transport_class():
transport = GameServerDeploymentsServiceClient.get_transport_class()
assert transport == transports.GameServerDeploymentsServiceGrpcTransport
transport = GameServerDeploymentsServiceClient.get_transport_class("grpc")
assert transpor... | def test_game_server_deployments_service_client_get_transport_class():
| transport = GameServerDeploymentsServiceClient.get_transport_class()
assert transport == transports.GameServerDeploymentsServiceGrpcTransport
transport = GameServerDeploymentsServiceClient.get_transport_class("grpc")
assert transport == transports.GameServerDeploymentsServiceGrpcTransport
| assert client._transport._credentials == creds
client = client_class.from_service_account_json("dummy/file/path.json")
assert client._transport._credentials == creds
assert client._transport._host == "gameservices.googleapis.com:443"
def test_game_server_deployments_service_client_get_... | 64 | 64 | 67 | 13 | 51 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_game_server_deployments_service_client_get_transport_class | test_game_server_deployments_service_client_get_transport_class | 120 | 125 | 120 | 120 | 6f7fe443afe5e1288951db1b83529c8e5cd664b6 | bigcode/the-stack | train |
40147bc6901c2781da52fdc3 | train | function | def test_get_game_server_deployment_from_dict():
test_get_game_server_deployment(request_type=dict)
| def test_get_game_server_deployment_from_dict():
| test_get_game_server_deployment(request_type=dict)
| # Establish that the response is the type that we expect.
assert isinstance(response, game_server_deployments.GameServerDeployment)
assert response.name == "name_value"
assert response.etag == "etag_value"
assert response.description == "description_value"
def test_get_game_server_deployment_from_di... | 64 | 64 | 21 | 10 | 54 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_get_game_server_deployment_from_dict | test_get_game_server_deployment_from_dict | 835 | 836 | 835 | 835 | f4d9c2e1850f56541495c17339a7bd1736775204 | bigcode/the-stack | train |
ec0982f851055ab3ff139312 | train | function | def test_parse_game_server_deployment_path():
expected = {
"project": "octopus",
"location": "oyster",
"deployment": "nudibranch",
}
path = GameServerDeploymentsServiceClient.game_server_deployment_path(**expected)
# Check that the path construction is reversible.
actual = G... | def test_parse_game_server_deployment_path():
| expected = {
"project": "octopus",
"location": "oyster",
"deployment": "nudibranch",
}
path = GameServerDeploymentsServiceClient.game_server_deployment_path(**expected)
# Check that the path construction is reversible.
actual = GameServerDeploymentsServiceClient.parse_game_s... | }/gameServerDeployments/{deployment}".format(
project=project, location=location, deployment=deployment,
)
actual = GameServerDeploymentsServiceClient.game_server_deployment_path(
project, location, deployment
)
assert expected == actual
def test_parse_game_server_deployment_path():
| 64 | 64 | 90 | 9 | 54 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_parse_game_server_deployment_path | test_parse_game_server_deployment_path | 2,874 | 2,884 | 2,874 | 2,874 | 54fdf6350ff5e5c2ce5ac5bfa80a3bbb99dcacb0 | bigcode/the-stack | train |
4f2e258749efa7d9cfb01d39 | train | function | def test_fetch_deployment_state_field_headers():
client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(),
)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = game_server_deployments.... | def test_fetch_deployment_state_field_headers():
| client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(),
)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = game_server_deployments.FetchDeploymentStateRequest()
request.name = ... | _, args, _ = call.mock_calls[0]
assert args[0] == request
# Establish that the response is the type that we expect.
assert isinstance(response, game_server_deployments.FetchDeploymentStateResponse)
assert response.unavailable == ["unavailable_value"]
def test_fetch_deployment_state_field_... | 69 | 70 | 236 | 9 | 60 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_fetch_deployment_state_field_headers | test_fetch_deployment_state_field_headers | 2,396 | 2,421 | 2,396 | 2,396 | 93176e616bca38680eb2d81c74c610ca65b5f42b | bigcode/the-stack | train |
c348b6670d8c2c8b50a34405 | train | function | @pytest.mark.asyncio
async def test_preview_game_server_deployment_rollout_async(
transport: str = "grpc_asyncio",
):
client = GameServerDeploymentsServiceAsyncClient(
credentials=credentials.AnonymousCredentials(), transport=transport,
)
# Everything is optional in proto3 as far as the runtime... | @pytest.mark.asyncio
async def test_preview_game_server_deployment_rollout_async(
transport: str = "grpc_asyncio",
):
| client = GameServerDeploymentsServiceAsyncClient(
credentials=credentials.AnonymousCredentials(), transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
# and we are mocking out the actual API, so just send an empty request.
request = game_server_deplo... | assert isinstance(
response, game_server_deployments.PreviewGameServerDeploymentRolloutResponse
)
assert response.unavailable == ["unavailable_value"]
assert response.etag == "etag_value"
def test_preview_game_server_deployment_rollout_from_dict():
test_preview_game_server_deployment_rollou... | 96 | 96 | 322 | 28 | 68 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_preview_game_server_deployment_rollout_async | test_preview_game_server_deployment_rollout_async | 2,214 | 2,253 | 2,214 | 2,217 | 8cd4df1cf13027b4d7a67171fc80a83058d4b7d5 | bigcode/the-stack | train |
235aea28a499ff8d56f4b7c3 | train | function | def test_create_game_server_deployment_flattened_error():
client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(),
)
# Attempting to call a method with both a request object and flattened
# fields is an error.
with pytest.raises(ValueError):
clien... | def test_create_game_server_deployment_flattened_error():
| client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(),
)
# Attempting to call a method with both a request object and flattened
# fields is an error.
with pytest.raises(ValueError):
client.create_game_server_deployment(
game_server_d... | _ = call.mock_calls[0]
assert args[0].parent == "parent_value"
assert args[
0
].game_server_deployment == game_server_deployments.GameServerDeployment(
name="name_value"
)
def test_create_game_server_deployment_flattened_error():
| 64 | 64 | 113 | 12 | 52 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_create_game_server_deployment_flattened_error | test_create_game_server_deployment_flattened_error | 1,176 | 1,190 | 1,176 | 1,176 | ddce4bfae9a96df3ed36d70900093dcba7b4c557 | bigcode/the-stack | train |
78d426e02dce1e83dea7e655 | train | function | @pytest.mark.asyncio
async def test_list_game_server_deployments_flattened_async():
client = GameServerDeploymentsServiceAsyncClient(
credentials=credentials.AnonymousCredentials(),
)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(client.... | @pytest.mark.asyncio
async def test_list_game_server_deployments_flattened_async():
| client = GameServerDeploymentsServiceAsyncClient(
credentials=credentials.AnonymousCredentials(),
)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(client._client._transport.list_game_server_deployments), "__call__"
) as call:
... | both a request object and flattened
# fields is an error.
with pytest.raises(ValueError):
client.list_game_server_deployments(
game_server_deployments.ListGameServerDeploymentsRequest(),
parent="parent_value",
)
@pytest.mark.asyncio
async def test_list_game_server_deploy... | 70 | 70 | 236 | 19 | 51 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_list_game_server_deployments_flattened_async | test_list_game_server_deployments_flattened_async | 562 | 587 | 562 | 563 | 684782df6908cef2c6ab6ae6f6e0962c79b6e7a2 | bigcode/the-stack | train |
fa3be09a80ec20310742e5a4 | train | function | @pytest.mark.asyncio
async def test_fetch_deployment_state_async(transport: str = "grpc_asyncio"):
client = GameServerDeploymentsServiceAsyncClient(
credentials=credentials.AnonymousCredentials(), transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
# an... | @pytest.mark.asyncio
async def test_fetch_deployment_state_async(transport: str = "grpc_asyncio"):
| client = GameServerDeploymentsServiceAsyncClient(
credentials=credentials.AnonymousCredentials(), transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
# and we are mocking out the actual API, so just send an empty request.
request = game_server_deplo... | ()
# Establish that the response is the type that we expect.
assert isinstance(response, game_server_deployments.FetchDeploymentStateResponse)
assert response.unavailable == ["unavailable_value"]
def test_fetch_deployment_state_from_dict():
test_fetch_deployment_state(request_type=dict)
@pytest.mark... | 83 | 83 | 278 | 23 | 60 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_fetch_deployment_state_async | test_fetch_deployment_state_async | 2,361 | 2,393 | 2,361 | 2,362 | 55eb0640308b3ac70007f8f23294aed4caaa72be | bigcode/the-stack | train |
4931b6d014795835c2ef2eea | train | function | def test_game_server_deployments_service_grpc_lro_client():
client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(), transport="grpc",
)
transport = client._transport
# Ensure that we have a api-core operations client.
assert isinstance(transport.operatio... | def test_game_server_deployments_service_grpc_lro_client():
| client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(), transport="grpc",
)
transport = client._transport
# Ensure that we have a api-core operations client.
assert isinstance(transport.operations_client, operations_v1.OperationsClient,)
# Ensure th... | mock_cred,
credentials_file=None,
scopes=("https://www.googleapis.com/auth/cloud-platform",),
ssl_credentials=mock_ssl_cred,
quota_project_id=None,
)
assert transport.grpc_channel == mock_grpc_channel
def test_game_server_deployments_service_grpc_lro_clien... | 64 | 64 | 98 | 14 | 49 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_game_server_deployments_service_grpc_lro_client | test_game_server_deployments_service_grpc_lro_client | 2,803 | 2,813 | 2,803 | 2,803 | 23c3e41296c89e97898b7f9052238cd4e6631f80 | bigcode/the-stack | train |
9220b6086aae52cb967f9f75 | train | function | @pytest.mark.parametrize(
"client_class",
[GameServerDeploymentsServiceClient, GameServerDeploymentsServiceAsyncClient],
)
def test_game_server_deployments_service_client_from_service_account_file(client_class):
creds = credentials.AnonymousCredentials()
with mock.patch.object(
service_account.C... | @pytest.mark.parametrize(
"client_class",
[GameServerDeploymentsServiceClient, GameServerDeploymentsServiceAsyncClient],
)
def test_game_server_deployments_service_client_from_service_account_file(client_class):
| creds = credentials.AnonymousCredentials()
with mock.patch.object(
service_account.Credentials, "from_service_account_file"
) as factory:
factory.return_value = creds
client = client_class.from_service_account_file("dummy/file/path.json")
assert client._transport._credentials... | mentsServiceClient._get_default_mtls_endpoint(non_googleapi)
== non_googleapi
)
@pytest.mark.parametrize(
"client_class",
[GameServerDeploymentsServiceClient, GameServerDeploymentsServiceAsyncClient],
)
def test_game_server_deployments_service_client_from_service_account_file(client_class):
| 64 | 64 | 147 | 43 | 21 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_game_server_deployments_service_client_from_service_account_file | test_game_server_deployments_service_client_from_service_account_file | 101 | 117 | 101 | 105 | b09bca6b7f15360e54db2d36d3990cd429f5095b | bigcode/the-stack | train |
6a69f73f038470df2fbb0d2e | train | function | def test_get_game_server_deployment_flattened_error():
client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(),
)
# Attempting to call a method with both a request object and flattened
# fields is an error.
with pytest.raises(ValueError):
client.g... | def test_get_game_server_deployment_flattened_error():
| client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(),
)
# Attempting to call a method with both a request object and flattened
# fields is an error.
with pytest.raises(ValueError):
client.get_game_server_deployment(
game_server_depl... | Establish that the underlying call was made with the expected
# request object values.
assert len(call.mock_calls) == 1
_, args, _ = call.mock_calls[0]
assert args[0].name == "name_value"
def test_get_game_server_deployment_flattened_error():
| 64 | 64 | 89 | 12 | 52 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_get_game_server_deployment_flattened_error | test_get_game_server_deployment_flattened_error | 961 | 971 | 961 | 961 | 36969d7dd1170447e189a139fefd05d4eaf697a1 | bigcode/the-stack | train |
dfa3c04ed64d98271a56b93d | train | function | @pytest.mark.asyncio
async def test_get_game_server_deployment_rollout_flattened_async():
client = GameServerDeploymentsServiceAsyncClient(
credentials=credentials.AnonymousCredentials(),
)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(c... | @pytest.mark.asyncio
async def test_get_game_server_deployment_rollout_flattened_async():
| client = GameServerDeploymentsServiceAsyncClient(
credentials=credentials.AnonymousCredentials(),
)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(client._client._transport.get_game_server_deployment_rollout), "__call__"
) as call:
... | request object and flattened
# fields is an error.
with pytest.raises(ValueError):
client.get_game_server_deployment_rollout(
game_server_deployments.GetGameServerDeploymentRolloutRequest(),
name="name_value",
)
@pytest.mark.asyncio
async def test_get_game_server_deploym... | 71 | 71 | 237 | 20 | 51 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_get_game_server_deployment_rollout_flattened_async | test_get_game_server_deployment_rollout_flattened_async | 1,883 | 1,908 | 1,883 | 1,884 | cacb435395886b30aebfd84a24b6a19d8dea223f | bigcode/the-stack | train |
78afdc104d40d7c236d3adc5 | train | function | def test_delete_game_server_deployment_from_dict():
test_delete_game_server_deployment(request_type=dict)
| def test_delete_game_server_deployment_from_dict():
| test_delete_game_server_deployment(request_type=dict)
| 1
_, args, _ = call.mock_calls[0]
assert args[0] == game_server_deployments.DeleteGameServerDeploymentRequest()
# Establish that the response is the type that we expect.
assert isinstance(response, future.Future)
def test_delete_game_server_deployment_from_dict():
| 64 | 64 | 21 | 10 | 54 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_delete_game_server_deployment_from_dict | test_delete_game_server_deployment_from_dict | 1,281 | 1,282 | 1,281 | 1,281 | f1a56f3d22192767b7900eeedffbda71ca2bf865 | bigcode/the-stack | train |
83c09968a6610f42f162c216 | train | function | def test_game_server_deployments_service_base_transport_error():
# Passing both a credentials object and credentials_file should raise an error
with pytest.raises(exceptions.DuplicateCredentialArgs):
transport = transports.GameServerDeploymentsServiceTransport(
credentials=credentials.Anonym... | def test_game_server_deployments_service_base_transport_error():
# Passing both a credentials object and credentials_file should raise an error
| with pytest.raises(exceptions.DuplicateCredentialArgs):
transport = transports.GameServerDeploymentsServiceTransport(
credentials=credentials.AnonymousCredentials(),
credentials_file="credentials.json",
)
| GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(),
)
assert isinstance(
client._transport, transports.GameServerDeploymentsServiceGrpcTransport,
)
def test_game_server_deployments_service_base_transport_error():
# Passing both a credentials object and cr... | 64 | 64 | 66 | 27 | 37 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_game_server_deployments_service_base_transport_error | test_game_server_deployments_service_base_transport_error | 2,519 | 2,525 | 2,519 | 2,520 | b46cff96546dad2630ed7a3ea6621fa179034f68 | bigcode/the-stack | train |
dc6a857b82850ce93760a557 | train | function | @pytest.mark.asyncio
async def test_list_game_server_deployments_async_pager():
client = GameServerDeploymentsServiceAsyncClient(
credentials=credentials.AnonymousCredentials,
)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(client._clien... | @pytest.mark.asyncio
async def test_list_game_server_deployments_async_pager():
| client = GameServerDeploymentsServiceAsyncClient(
credentials=credentials.AnonymousCredentials,
)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(client._client._transport.list_game_server_deployments),
"__call__",
new_call... | .ListGameServerDeploymentsResponse(
game_server_deployments=[
game_server_deployments.GameServerDeployment(),
game_server_deployments.GameServerDeployment(),
],
),
RuntimeError,
)
pages = list(client.list_gam... | 111 | 111 | 372 | 18 | 92 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_list_game_server_deployments_async_pager | test_list_game_server_deployments_async_pager | 698 | 747 | 698 | 699 | 7d1546843bc0619aedacc1cc078673ca47aeb6d2 | bigcode/the-stack | train |
34aad1d614962666a457e36f | train | function | @pytest.mark.asyncio
async def test_update_game_server_deployment_field_headers_async():
client = GameServerDeploymentsServiceAsyncClient(
credentials=credentials.AnonymousCredentials(),
)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty ... | @pytest.mark.asyncio
async def test_update_game_server_deployment_field_headers_async():
| client = GameServerDeploymentsServiceAsyncClient(
credentials=credentials.AnonymousCredentials(),
)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = game_server_deployments.UpdateGameServerDeploymentRequest()
requ... | ]
assert args[0] == request
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
assert (
"x-goog-request-params",
"game_server_deployment.name=game_server_deployment.name/value",
) in kw["metadata"]
@pytest.mark.asyncio
async def test_update_game_server_dep... | 82 | 83 | 279 | 17 | 65 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_update_game_server_deployment_field_headers_async | test_update_game_server_deployment_field_headers_async | 1,553 | 1,584 | 1,553 | 1,554 | be83c865814cbdba0260f7a2f7eda405a8edf62a | bigcode/the-stack | train |
adceb9e6bc7814960f20822a | train | function | def test_get_game_server_deployment_rollout_field_headers():
client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(),
)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = game_server_... | def test_get_game_server_deployment_rollout_field_headers():
| client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(),
)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = game_server_deployments.GetGameServerDeploymentRolloutRequest()
reque... | # Establish that the response is the type that we expect.
assert isinstance(response, game_server_deployments.GameServerDeploymentRollout)
assert response.name == "name_value"
assert response.default_game_server_config == "default_game_server_config_value"
assert response.etag == "etag_value"
def te... | 74 | 74 | 249 | 12 | 62 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_get_game_server_deployment_rollout_field_headers | test_get_game_server_deployment_rollout_field_headers | 1,786 | 1,811 | 1,786 | 1,786 | ae285ae5c06bcfa0e5df9266b7446b96feecd72b | bigcode/the-stack | train |
1da27f4b482996a2f316e213 | train | function | @pytest.mark.asyncio
async def test_fetch_deployment_state_field_headers_async():
client = GameServerDeploymentsServiceAsyncClient(
credentials=credentials.AnonymousCredentials(),
)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
... | @pytest.mark.asyncio
async def test_fetch_deployment_state_field_headers_async():
| client = GameServerDeploymentsServiceAsyncClient(
credentials=credentials.AnonymousCredentials(),
)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = game_server_deployments.FetchDeploymentStateRequest()
request.na... | _ = call.mock_calls[0]
assert args[0] == request
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
@pytest.mark.asyncio
async def test_fetch_deployment_state_field_headers_async():
| 75 | 76 | 255 | 16 | 59 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_fetch_deployment_state_field_headers_async | test_fetch_deployment_state_field_headers_async | 2,424 | 2,452 | 2,424 | 2,425 | 57797f9f0e17998b32740888c8ef3de9097c5114 | bigcode/the-stack | train |
4da35c0f9ce81774dcb4016f | train | function | @pytest.mark.asyncio
async def test_get_game_server_deployment_rollout_async(
transport: str = "grpc_asyncio",
):
client = GameServerDeploymentsServiceAsyncClient(
credentials=credentials.AnonymousCredentials(), transport=transport,
)
# Everything is optional in proto3 as far as the runtime is ... | @pytest.mark.asyncio
async def test_get_game_server_deployment_rollout_async(
transport: str = "grpc_asyncio",
):
| client = GameServerDeploymentsServiceAsyncClient(
credentials=credentials.AnonymousCredentials(), transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
# and we are mocking out the actual API, so just send an empty request.
request = game_server_deplo... | (response, game_server_deployments.GameServerDeploymentRollout)
assert response.name == "name_value"
assert response.default_game_server_config == "default_game_server_config_value"
assert response.etag == "etag_value"
def test_get_game_server_deployment_rollout_from_dict():
test_get_game_server_de... | 100 | 100 | 335 | 28 | 72 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_get_game_server_deployment_rollout_async | test_get_game_server_deployment_rollout_async | 1,743 | 1,783 | 1,743 | 1,746 | be47a01b35658dc0cd8074e2e47c1a28e23f0f16 | bigcode/the-stack | train |
382d0d92e119869c01d426fe | train | function | def test_list_game_server_deployments_flattened():
client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(),
)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(client._transport.list_game_server_deployment... | def test_list_game_server_deployments_flattened():
| client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(),
)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(client._transport.list_game_server_deployments), "__call__"
) as call:
# Designate a... | assert args[0] == request
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
def test_list_game_server_deployments_flattened():
| 63 | 64 | 198 | 12 | 51 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_list_game_server_deployments_flattened | test_list_game_server_deployments_flattened | 524 | 545 | 524 | 524 | 3564773ccbc78e743ec8b30b46a86d722af21b51 | bigcode/the-stack | train |
c3921c9f2e8e3c6173f90b2a | train | function | def test_game_server_deployments_service_host_with_port():
client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(),
client_options=client_options.ClientOptions(
api_endpoint="gameservices.googleapis.com:8000"
),
)
assert client._transpo... | def test_game_server_deployments_service_host_with_port():
| client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(),
client_options=client_options.ClientOptions(
api_endpoint="gameservices.googleapis.com:8000"
),
)
assert client._transport._host == "gameservices.googleapis.com:8000"
| ServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(),
client_options=client_options.ClientOptions(
api_endpoint="gameservices.googleapis.com"
),
)
assert client._transport._host == "gameservices.googleapis.com:443"
def test_game_server_deployments_se... | 64 | 64 | 72 | 12 | 52 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_game_server_deployments_service_host_with_port | test_game_server_deployments_service_host_with_port | 2,615 | 2,622 | 2,615 | 2,615 | a18193f7d9ce89e97e4b0f5f6ad7ca2508db9eda | bigcode/the-stack | train |
6149eb337ee08ed369c4d753 | train | function | def test_fetch_deployment_state(
transport: str = "grpc",
request_type=game_server_deployments.FetchDeploymentStateRequest,
):
client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(), transport=transport,
)
# Everything is optional in proto3 as far as the... | def test_fetch_deployment_state(
transport: str = "grpc",
request_type=game_server_deployments.FetchDeploymentStateRequest,
):
| client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(), transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
# and we are mocking out the actual API, so just send an empty request.
request = request_type()
# ... | # Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
assert ("x-goog-request-params", "rollout.name=rollout.name/value",) in kw[
"metadata"
]
def test_fetch_deployment_state(
transport: str = "grpc",
request_type=game_server_deployments.FetchDeploymentStateRequest,
)... | 81 | 82 | 274 | 30 | 51 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_fetch_deployment_state | test_fetch_deployment_state | 2,322 | 2,354 | 2,322 | 2,325 | 1a5586b3de14c67f3fd1bc2461ae82ebeb465a88 | bigcode/the-stack | train |
cbe4aeb3796fb0804e476e3a | train | function | def test_update_game_server_deployment_rollout_flattened_error():
client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(),
)
# Attempting to call a method with both a request object and flattened
# fields is an error.
with pytest.raises(ValueError):
... | def test_update_game_server_deployment_rollout_flattened_error():
| client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(),
)
# Attempting to call a method with both a request object and flattened
# fields is an error.
with pytest.raises(ValueError):
client.update_game_server_deployment_rollout(
game_... | [0]
assert args[0].rollout == game_server_deployments.GameServerDeploymentRollout(
name="name_value"
)
assert args[0].update_mask == field_mask.FieldMask(paths=["paths_value"])
def test_update_game_server_deployment_rollout_flattened_error():
| 63 | 64 | 125 | 14 | 49 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_update_game_server_deployment_rollout_flattened_error | test_update_game_server_deployment_rollout_flattened_error | 2,095 | 2,109 | 2,095 | 2,095 | e9ef7f89b528a0795cccd85f40495ce90c060fa5 | bigcode/the-stack | train |
9e2404a43bf2f7c4037e8a76 | train | function | def test_get_game_server_deployment(
transport: str = "grpc",
request_type=game_server_deployments.GetGameServerDeploymentRequest,
):
client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(), transport=transport,
)
# Everything is optional in proto3 as far... | def test_get_game_server_deployment(
transport: str = "grpc",
request_type=game_server_deployments.GetGameServerDeploymentRequest,
):
| client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(), transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
# and we are mocking out the actual API, so just send an empty request.
request = request_type()
# ... | = []
async for page in (await client.list_game_server_deployments(request={})).pages:
pages.append(page)
for page, token in zip(pages, ["abc", "def", "ghi", ""]):
assert page.raw_page.next_page_token == token
def test_get_game_server_deployment(
transport: str = "grpc",
... | 91 | 91 | 304 | 32 | 58 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_get_game_server_deployment | test_get_game_server_deployment | 796 | 832 | 796 | 799 | 332f9384cf55cd33e1d8972b2f939a7a696ee358 | bigcode/the-stack | train |
e25a44ca8fd6df3e751b1659 | train | function | @pytest.mark.parametrize(
"client_class,transport_class,transport_name",
[
(
GameServerDeploymentsServiceClient,
transports.GameServerDeploymentsServiceGrpcTransport,
"grpc",
),
(
GameServerDeploymentsServiceAsyncClient,
transpo... | @pytest.mark.parametrize(
"client_class,transport_class,transport_name",
[
(
GameServerDeploymentsServiceClient,
transports.GameServerDeploymentsServiceGrpcTransport,
"grpc",
),
(
GameServerDeploymentsServiceAsyncClient,
transpo... | with mock.patch.object(
GameServerDeploymentsServiceClient, "get_transport_class"
) as gtc:
transport = transport_class(credentials=credentials.AnonymousCredentials())
client = client_class(transport=transport)
gtc.assert_not_called()
# Check that if channel is provided via ... | transport._host == "gameservices.googleapis.com:443"
def test_game_server_deployments_service_client_get_transport_class():
transport = GameServerDeploymentsServiceClient.get_transport_class()
assert transport == transports.GameServerDeploymentsServiceGrpcTransport
transport = GameServerDeploymentsServic... | 256 | 256 | 1,314 | 177 | 78 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_game_server_deployments_service_client_client_options | test_game_server_deployments_service_client_client_options | 128 | 296 | 128 | 156 | 16731b37591f56eede4cf4008602961a04accfbd | bigcode/the-stack | train |
a508af788ba77f878dc8ae07 | train | function | def test_list_game_server_deployments_pager():
client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials,
)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(client._transport.list_game_server_deployments), "_... | def test_list_game_server_deployments_pager():
| client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials,
)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(client._transport.list_game_server_deployments), "__call__"
) as call:
# Set the respo... | io
async def test_list_game_server_deployments_flattened_error_async():
client = GameServerDeploymentsServiceAsyncClient(
credentials=credentials.AnonymousCredentials(),
)
# Attempting to call a method with both a request object and flattened
# fields is an error.
with pytest.raises(ValueEr... | 110 | 110 | 367 | 11 | 99 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_list_game_server_deployments_pager | test_list_game_server_deployments_pager | 605 | 654 | 605 | 605 | 584093bf81e62818f76e4eef32a9fae695b30e4c | bigcode/the-stack | train |
b7bb1529223a9158d4f8cd15 | train | function | @mock.patch("grpc.ssl_channel_credentials", autospec=True)
@mock.patch("google.api_core.grpc_helpers.create_channel", autospec=True)
def test_game_server_deployments_service_grpc_transport_channel_mtls_with_client_cert_source(
grpc_create_channel, grpc_ssl_channel_cred
):
# Check that if channel is None, but ap... | @mock.patch("grpc.ssl_channel_credentials", autospec=True)
@mock.patch("google.api_core.grpc_helpers.create_channel", autospec=True)
def test_game_server_deployments_service_grpc_transport_channel_mtls_with_client_cert_source(
grpc_create_channel, grpc_ssl_channel_cred
):
# Check that if channel is None, but ap... | mock_cred = mock.Mock()
mock_ssl_cred = mock.Mock()
grpc_ssl_channel_cred.return_value = mock_ssl_cred
mock_grpc_channel = mock.Mock()
grpc_create_channel.return_value = mock_grpc_channel
transport = transports.GameServerDeploymentsServiceGrpcTransport(
host="squid.clam.whelk",
... | @mock.patch("grpc.ssl_channel_credentials", autospec=True)
@mock.patch("google.api_core.grpc_helpers.create_channel", autospec=True)
def test_game_server_deployments_service_grpc_transport_channel_mtls_with_client_cert_source(
grpc_create_channel, grpc_ssl_channel_cred
):
# Check that if channel is None, but ap... | 93 | 92 | 307 | 93 | 0 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_game_server_deployments_service_grpc_transport_channel_mtls_with_client_cert_source | test_game_server_deployments_service_grpc_transport_channel_mtls_with_client_cert_source | 2,659 | 2,691 | 2,659 | 2,665 | 4d1948056b2faa5ec3db391f97c98ce45755a01b | bigcode/the-stack | train |
5ef48bab1f6699279269cda6 | train | function | def test_create_game_server_deployment_field_headers():
client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(),
)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = game_server_deplo... | def test_create_game_server_deployment_field_headers():
| client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(),
)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = game_server_deployments.CreateGameServerDeploymentRequest()
request.p... | # Establish that the underlying gRPC stub method was called.
assert len(call.mock_calls)
_, args, _ = call.mock_calls[0]
assert args[0] == request
# Establish that the response is the type that we expect.
assert isinstance(response, future.Future)
def test_create_game_server_de... | 72 | 72 | 240 | 10 | 62 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_create_game_server_deployment_field_headers | test_create_game_server_deployment_field_headers | 1,082 | 1,107 | 1,082 | 1,082 | 06b27a2677c12bf93dc0f4adde7356eb1d828dfb | bigcode/the-stack | train |
4cbc0b0ce47dcfbdc259219b | train | function | def test_game_server_deployments_service_grpc_lro_async_client():
client = GameServerDeploymentsServiceAsyncClient(
credentials=credentials.AnonymousCredentials(), transport="grpc_asyncio",
)
transport = client._client._transport
# Ensure that we have a api-core operations client.
assert is... | def test_game_server_deployments_service_grpc_lro_async_client():
| client = GameServerDeploymentsServiceAsyncClient(
credentials=credentials.AnonymousCredentials(), transport="grpc_asyncio",
)
transport = client._client._transport
# Ensure that we have a api-core operations client.
assert isinstance(transport.operations_client, operations_v1.OperationsAsyn... | we have a api-core operations client.
assert isinstance(transport.operations_client, operations_v1.OperationsClient,)
# Ensure that subsequent calls to the property send the exact same object.
assert transport.operations_client is transport.operations_client
def test_game_server_deployments_service_grpc_l... | 64 | 64 | 105 | 15 | 48 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_game_server_deployments_service_grpc_lro_async_client | test_game_server_deployments_service_grpc_lro_async_client | 2,816 | 2,826 | 2,816 | 2,816 | 04db361c3eefb7d2ffc80fcb65c8c5525a072f1f | bigcode/the-stack | train |
0c40bb2ed03bfd1a6048098a | train | function | def test_parse_game_server_deployment_rollout_path():
expected = {
"project": "octopus",
"location": "oyster",
"deployment": "nudibranch",
}
path = GameServerDeploymentsServiceClient.game_server_deployment_rollout_path(
**expected
)
# Check that the path construction... | def test_parse_game_server_deployment_rollout_path():
| expected = {
"project": "octopus",
"location": "oyster",
"deployment": "nudibranch",
}
path = GameServerDeploymentsServiceClient.game_server_deployment_rollout_path(
**expected
)
# Check that the path construction is reversible.
actual = GameServerDeploymentsServ... | }/rollout".format(
project=project, location=location, deployment=deployment,
)
actual = GameServerDeploymentsServiceClient.game_server_deployment_rollout_path(
project, location, deployment
)
assert expected == actual
def test_parse_game_server_deployment_rollout_path():
| 64 | 64 | 104 | 11 | 52 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_parse_game_server_deployment_rollout_path | test_parse_game_server_deployment_rollout_path | 2,843 | 2,857 | 2,843 | 2,843 | 17f4d6b811292e72acac258756c3b7198996d280 | bigcode/the-stack | train |
9053260d5ecbf8ee30c450a5 | train | function | def test_get_game_server_deployment_field_headers():
client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(),
)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = game_server_deployme... | def test_get_game_server_deployment_field_headers():
| client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(),
)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = game_server_deployments.GetGameServerDeploymentRequest()
request.name... | [0] == request
# Establish that the response is the type that we expect.
assert isinstance(response, game_server_deployments.GameServerDeployment)
assert response.name == "name_value"
assert response.etag == "etag_value"
assert response.description == "description_value"
def test_get_game_server... | 71 | 71 | 239 | 10 | 61 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_get_game_server_deployment_field_headers | test_get_game_server_deployment_field_headers | 878 | 903 | 878 | 878 | 6d67bdbe0ecd7fae9e0cf9d1c7ed6c6d2fc3ef89 | bigcode/the-stack | train |
943ea6db8d5bf57923aae621 | train | function | @pytest.mark.asyncio
async def test_get_game_server_deployment_async(transport: str = "grpc_asyncio"):
client = GameServerDeploymentsServiceAsyncClient(
credentials=credentials.AnonymousCredentials(), transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
... | @pytest.mark.asyncio
async def test_get_game_server_deployment_async(transport: str = "grpc_asyncio"):
| client = GameServerDeploymentsServiceAsyncClient(
credentials=credentials.AnonymousCredentials(), transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
# and we are mocking out the actual API, so just send an empty request.
request = game_server_deplo... | type that we expect.
assert isinstance(response, game_server_deployments.GameServerDeployment)
assert response.name == "name_value"
assert response.etag == "etag_value"
assert response.description == "description_value"
def test_get_game_server_deployment_from_dict():
test_get_game_server_depl... | 92 | 92 | 307 | 24 | 68 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_get_game_server_deployment_async | test_get_game_server_deployment_async | 839 | 875 | 839 | 840 | 4616db600ddc7fc29c7d469a3b88d40af80f90dd | bigcode/the-stack | train |
a39d803cc7ee62457eaa3f14 | train | function | @pytest.mark.parametrize(
"client_class,transport_class,transport_name",
[
(
GameServerDeploymentsServiceClient,
transports.GameServerDeploymentsServiceGrpcTransport,
"grpc",
),
(
GameServerDeploymentsServiceAsyncClient,
transpo... | @pytest.mark.parametrize(
"client_class,transport_class,transport_name",
[
(
GameServerDeploymentsServiceClient,
transports.GameServerDeploymentsServiceGrpcTransport,
"grpc",
),
(
GameServerDeploymentsServiceAsyncClient,
transpo... | options = client_options.ClientOptions(credentials_file="credentials.json")
with mock.patch.object(transport_class, "__init__") as patched:
patched.return_value = None
client = client_class(client_options=options)
patched.assert_called_once_with(
credentials=None,
... | @pytest.mark.parametrize(
"client_class,transport_class,transport_name",
[
(
GameServerDeploymentsServiceClient,
transports.GameServerDeploymentsServiceGrpcTransport,
"grpc",
),
(
GameServerDeploymentsServiceAsyncClient,
transpo... | 112 | 64 | 211 | 112 | 0 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_game_server_deployments_service_client_client_options_credentials_file | test_game_server_deployments_service_client_client_options_credentials_file | 333 | 364 | 333 | 351 | 917b719eddc02514c4d98d1be2676f12e9949083 | bigcode/the-stack | train |
ee10e6d15e47862acc4d0a23 | train | function | def test_update_game_server_deployment_field_headers():
client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(),
)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = game_server_deplo... | def test_update_game_server_deployment_field_headers():
| client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(),
)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = game_server_deployments.UpdateGameServerDeploymentRequest()
request.g... | _game_server_deployment(request)
# Establish that the underlying gRPC stub method was called.
assert len(call.mock_calls)
_, args, _ = call.mock_calls[0]
assert args[0] == request
# Establish that the response is the type that we expect.
assert isinstance(response, future.Futu... | 78 | 78 | 260 | 10 | 68 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_update_game_server_deployment_field_headers | test_update_game_server_deployment_field_headers | 1,522 | 1,550 | 1,522 | 1,522 | 42249af0e4d00993dfb13d42c264880c20b96edd | bigcode/the-stack | train |
b5c6c0b66abd2d42f2970a19 | train | function | def test_transport_instance():
# A client may be instantiated with a custom transport instance.
transport = transports.GameServerDeploymentsServiceGrpcTransport(
credentials=credentials.AnonymousCredentials(),
)
client = GameServerDeploymentsServiceClient(transport=transport)
assert client._... | def test_transport_instance():
# A client may be instantiated with a custom transport instance.
| transport = transports.GameServerDeploymentsServiceGrpcTransport(
credentials=credentials.AnonymousCredentials(),
)
client = GameServerDeploymentsServiceClient(transport=transport)
assert client._transport is transport
| credentials=credentials.AnonymousCredentials(),
)
with pytest.raises(ValueError):
client = GameServerDeploymentsServiceClient(
client_options={"scopes": ["1", "2"]}, transport=transport,
)
def test_transport_instance():
# A client may be instantiated with a custom transport inst... | 64 | 64 | 62 | 18 | 46 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_transport_instance | test_transport_instance | 2,485 | 2,491 | 2,485 | 2,486 | bbb0d6ec132070b5dfc358d270788add8af4787d | bigcode/the-stack | train |
45f51f082f58b280cbe7dfa4 | train | function | def test_fetch_deployment_state_from_dict():
test_fetch_deployment_state(request_type=dict)
| def test_fetch_deployment_state_from_dict():
| test_fetch_deployment_state(request_type=dict)
| args[0] == game_server_deployments.FetchDeploymentStateRequest()
# Establish that the response is the type that we expect.
assert isinstance(response, game_server_deployments.FetchDeploymentStateResponse)
assert response.unavailable == ["unavailable_value"]
def test_fetch_deployment_state_from_dict():
| 63 | 64 | 19 | 9 | 54 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_fetch_deployment_state_from_dict | test_fetch_deployment_state_from_dict | 2,357 | 2,358 | 2,357 | 2,357 | e46acf36adbcde01d976fa589df25eb606d2c158 | bigcode/the-stack | train |
87f4faf3ea3a9c65bea67362 | train | function | @pytest.mark.asyncio
async def test_delete_game_server_deployment_flattened_error_async():
client = GameServerDeploymentsServiceAsyncClient(
credentials=credentials.AnonymousCredentials(),
)
# Attempting to call a method with both a request object and flattened
# fields is an error.
with py... | @pytest.mark.asyncio
async def test_delete_game_server_deployment_flattened_error_async():
| client = GameServerDeploymentsServiceAsyncClient(
credentials=credentials.AnonymousCredentials(),
)
# Attempting to call a method with both a request object and flattened
# fields is an error.
with pytest.raises(ValueError):
await client.delete_game_server_deployment(
ga... | underlying call was made with the expected
# request object values.
assert len(call.mock_calls)
_, args, _ = call.mock_calls[0]
assert args[0].name == "name_value"
@pytest.mark.asyncio
async def test_delete_game_server_deployment_flattened_error_async():
| 64 | 64 | 99 | 19 | 45 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_delete_game_server_deployment_flattened_error_async | test_delete_game_server_deployment_flattened_error_async | 1,441 | 1,453 | 1,441 | 1,442 | 936a3e185a60d70b278c38ad4c3135f5500c4220 | bigcode/the-stack | train |
bc773b92c5cc061e805fccc9 | train | function | def test_update_game_server_deployment_rollout(
transport: str = "grpc",
request_type=game_server_deployments.UpdateGameServerDeploymentRolloutRequest,
):
client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(), transport=transport,
)
# Everything is opti... | def test_update_game_server_deployment_rollout(
transport: str = "grpc",
request_type=game_server_deployments.UpdateGameServerDeploymentRolloutRequest,
):
| client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(), transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
# and we are mocking out the actual API, so just send an empty request.
request = request_type()
# ... | is an error.
with pytest.raises(ValueError):
await client.get_game_server_deployment_rollout(
game_server_deployments.GetGameServerDeploymentRolloutRequest(),
name="name_value",
)
def test_update_game_server_deployment_rollout(
transport: str = "grpc",
request_type=g... | 80 | 80 | 267 | 36 | 44 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_update_game_server_deployment_rollout | test_update_game_server_deployment_rollout | 1,926 | 1,957 | 1,926 | 1,929 | 416bb30bba2b2903869c186b873ff4ba896bc12d | bigcode/the-stack | train |
16d89106eb0c46d335dc1264 | train | function | @pytest.mark.asyncio
async def test_get_game_server_deployment_rollout_field_headers_async():
client = GameServerDeploymentsServiceAsyncClient(
credentials=credentials.AnonymousCredentials(),
)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-e... | @pytest.mark.asyncio
async def test_get_game_server_deployment_rollout_field_headers_async():
| client = GameServerDeploymentsServiceAsyncClient(
credentials=credentials.AnonymousCredentials(),
)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = game_server_deployments.GetGameServerDeploymentRolloutRequest()
... | , _ = call.mock_calls[0]
assert args[0] == request
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
@pytest.mark.asyncio
async def test_get_game_server_deployment_rollout_field_headers_async():
| 79 | 80 | 268 | 19 | 60 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_get_game_server_deployment_rollout_field_headers_async | test_get_game_server_deployment_rollout_field_headers_async | 1,814 | 1,842 | 1,814 | 1,815 | a4ff924c24884c3930f229ae0e69ede5b37df18a | bigcode/the-stack | train |
8e9b4009d111aff25eeb3ec1 | train | function | def test_preview_game_server_deployment_rollout_field_headers():
client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(),
)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = game_ser... | def test_preview_game_server_deployment_rollout_field_headers():
| client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(),
)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = game_server_deployments.PreviewGameServerDeploymentRolloutRequest()
r... | [0]
assert args[0] == request
# Establish that the response is the type that we expect.
assert isinstance(
response, game_server_deployments.PreviewGameServerDeploymentRolloutResponse
)
assert response.unavailable == ["unavailable_value"]
assert response.etag == "etag_value"
def ... | 81 | 81 | 270 | 12 | 69 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_preview_game_server_deployment_rollout_field_headers | test_preview_game_server_deployment_rollout_field_headers | 2,256 | 2,285 | 2,256 | 2,256 | 9c2def3c426fa3b4953b396ac549a470927c2d16 | bigcode/the-stack | train |
eb841587572ef70194b53433 | train | function | @pytest.mark.parametrize(
"api_mtls_endpoint", ["mtls.squid.clam.whelk", "mtls.squid.clam.whelk:443"]
)
@mock.patch("google.api_core.grpc_helpers.create_channel", autospec=True)
def test_game_server_deployments_service_grpc_transport_channel_mtls_with_adc(
grpc_create_channel, api_mtls_endpoint
):
# Check t... | @pytest.mark.parametrize(
"api_mtls_endpoint", ["mtls.squid.clam.whelk", "mtls.squid.clam.whelk:443"]
)
@mock.patch("google.api_core.grpc_helpers.create_channel", autospec=True)
def test_game_server_deployments_service_grpc_transport_channel_mtls_with_adc(
grpc_create_channel, api_mtls_endpoint
):
# Check t... | mock_grpc_channel = mock.Mock()
grpc_create_channel.return_value = mock_grpc_channel
# Mock google.auth.transport.grpc.SslCredentials class.
mock_ssl_cred = mock.Mock()
with mock.patch.multiple(
"google.auth.transport.grpc.SslCredentials",
__init__=mock.Mock(return_value=None),
... | @pytest.mark.parametrize(
"api_mtls_endpoint", ["mtls.squid.clam.whelk", "mtls.squid.clam.whelk:443"]
)
@mock.patch("google.api_core.grpc_helpers.create_channel", autospec=True)
def test_game_server_deployments_service_grpc_transport_channel_mtls_with_adc(
grpc_create_channel, api_mtls_endpoint
):
# Check t... | 116 | 100 | 336 | 116 | 0 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_game_server_deployments_service_grpc_transport_channel_mtls_with_adc | test_game_server_deployments_service_grpc_transport_channel_mtls_with_adc | 2,729 | 2,763 | 2,729 | 2,737 | 7a749dbac7ecc9533a774baa2597ce752434544c | bigcode/the-stack | train |
7a5cf0bcf827e4db79c55daa | train | function | def test_game_server_deployments_service_auth_adc():
# If no credentials are provided, we should use ADC credentials.
with mock.patch.object(auth, "default") as adc:
adc.return_value = (credentials.AnonymousCredentials(), None)
GameServerDeploymentsServiceClient()
adc.assert_called_once_... | def test_game_server_deployments_service_auth_adc():
# If no credentials are provided, we should use ADC credentials.
| with mock.patch.object(auth, "default") as adc:
adc.return_value = (credentials.AnonymousCredentials(), None)
GameServerDeploymentsServiceClient()
adc.assert_called_once_with(
scopes=("https://www.googleapis.com/auth/cloud-platform",),
quota_project_id=None,
)... | )
load_creds.assert_called_once_with(
"credentials.json",
scopes=("https://www.googleapis.com/auth/cloud-platform",),
quota_project_id="octopus",
)
def test_game_server_deployments_service_auth_adc():
# If no credentials are provided, we should use ADC cre... | 64 | 64 | 87 | 25 | 39 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_game_server_deployments_service_auth_adc | test_game_server_deployments_service_auth_adc | 2,580 | 2,588 | 2,580 | 2,581 | 9d80eb3fdbf2cd432698539f33ebcf212d38b623 | bigcode/the-stack | train |
849f2459cceb98b28ce29e13 | train | function | def test_update_game_server_deployment_rollout_field_headers():
client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(),
)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = game_serv... | def test_update_game_server_deployment_rollout_field_headers():
| client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(),
)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = game_server_deployments.UpdateGameServerDeploymentRolloutRequest()
re... | _rollout(request)
# Establish that the underlying gRPC stub method was called.
assert len(call.mock_calls)
_, args, _ = call.mock_calls[0]
assert args[0] == request
# Establish that the response is the type that we expect.
assert isinstance(response, future.Future)
def test_up... | 78 | 78 | 260 | 12 | 66 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_update_game_server_deployment_rollout_field_headers | test_update_game_server_deployment_rollout_field_headers | 1,998 | 2,025 | 1,998 | 1,998 | 6bc04695d2bc3db15f4004fee82d372a1ea64591 | bigcode/the-stack | train |
c5a1d6ce12fa8b5083a7a69c | train | function | @pytest.mark.asyncio
async def test_update_game_server_deployment_rollout_async(
transport: str = "grpc_asyncio",
):
client = GameServerDeploymentsServiceAsyncClient(
credentials=credentials.AnonymousCredentials(), transport=transport,
)
# Everything is optional in proto3 as far as the runtime ... | @pytest.mark.asyncio
async def test_update_game_server_deployment_rollout_async(
transport: str = "grpc_asyncio",
):
| client = GameServerDeploymentsServiceAsyncClient(
credentials=credentials.AnonymousCredentials(), transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
# and we are mocking out the actual API, so just send an empty request.
request = game_server_deplo... | outRequest()
)
# Establish that the response is the type that we expect.
assert isinstance(response, future.Future)
def test_update_game_server_deployment_rollout_from_dict():
test_update_game_server_deployment_rollout(request_type=dict)
@pytest.mark.asyncio
async def test_update_game_server_depl... | 79 | 79 | 266 | 28 | 51 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_update_game_server_deployment_rollout_async | test_update_game_server_deployment_rollout_async | 1,964 | 1,995 | 1,964 | 1,967 | ae46a54722e186e815dd9a2714c80b53456322ec | bigcode/the-stack | train |
bf1bd271857f009274e591e8 | train | function | def test_game_server_deployment_rollout_path():
project = "squid"
location = "clam"
deployment = "whelk"
expected = "projects/{project}/locations/{location}/gameServerDeployments/{deployment}/rollout".format(
project=project, location=location, deployment=deployment,
)
actual = GameServ... | def test_game_server_deployment_rollout_path():
| project = "squid"
location = "clam"
deployment = "whelk"
expected = "projects/{project}/locations/{location}/gameServerDeployments/{deployment}/rollout".format(
project=project, location=location, deployment=deployment,
)
actual = GameServerDeploymentsServiceClient.game_server_deploymen... | # Ensure that we have a api-core operations client.
assert isinstance(transport.operations_client, operations_v1.OperationsAsyncClient,)
# Ensure that subsequent calls to the property send the exact same object.
assert transport.operations_client is transport.operations_client
def test_game_server_depl... | 64 | 64 | 101 | 10 | 53 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_game_server_deployment_rollout_path | test_game_server_deployment_rollout_path | 2,829 | 2,840 | 2,829 | 2,829 | f6ddf74195b8cfa1ab5efd35b370b1e65c7cf0b5 | bigcode/the-stack | train |
f5ed82faa6d689a2febc6ddf | train | function | def test_get_game_server_deployment_rollout_from_dict():
test_get_game_server_deployment_rollout(request_type=dict)
| def test_get_game_server_deployment_rollout_from_dict():
| test_get_game_server_deployment_rollout(request_type=dict)
| expect.
assert isinstance(response, game_server_deployments.GameServerDeploymentRollout)
assert response.name == "name_value"
assert response.default_game_server_config == "default_game_server_config_value"
assert response.etag == "etag_value"
def test_get_game_server_deployment_rollout_from_dict():... | 64 | 64 | 25 | 12 | 52 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_get_game_server_deployment_rollout_from_dict | test_get_game_server_deployment_rollout_from_dict | 1,739 | 1,740 | 1,739 | 1,739 | 6515eb8c4f39dd883d3a9489a91192647ae00748 | bigcode/the-stack | train |
4c47c0a7f4ea281b61a20064 | train | function | def test_delete_game_server_deployment_field_headers():
client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(),
)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = game_server_deplo... | def test_delete_game_server_deployment_field_headers():
| client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(),
)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = game_server_deployments.DeleteGameServerDeploymentRequest()
request.n... | # Establish that the underlying gRPC stub method was called.
assert len(call.mock_calls)
_, args, _ = call.mock_calls[0]
assert args[0] == request
# Establish that the response is the type that we expect.
assert isinstance(response, future.Future)
def test_delete_game_server_deploymen... | 71 | 71 | 239 | 10 | 61 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_delete_game_server_deployment_field_headers | test_delete_game_server_deployment_field_headers | 1,316 | 1,341 | 1,316 | 1,316 | 9d815e1032120b70b9f2725ecce032afd4bbd9bd | bigcode/the-stack | train |
ffdb0e833f941049735ff76c | train | function | def test_game_server_deployments_service_base_transport():
# Instantiate the base transport.
with mock.patch(
"google.cloud.gaming_v1.services.game_server_deployments_service.transports.GameServerDeploymentsServiceTransport.__init__"
) as Transport:
Transport.return_value = None
tran... | def test_game_server_deployments_service_base_transport():
# Instantiate the base transport.
| with mock.patch(
"google.cloud.gaming_v1.services.game_server_deployments_service.transports.GameServerDeploymentsServiceTransport.__init__"
) as Transport:
Transport.return_value = None
transport = transports.GameServerDeploymentsServiceTransport(
credentials=credentials.Ano... | ():
# Passing both a credentials object and credentials_file should raise an error
with pytest.raises(exceptions.DuplicateCredentialArgs):
transport = transports.GameServerDeploymentsServiceTransport(
credentials=credentials.AnonymousCredentials(),
credentials_file="credentials.j... | 73 | 73 | 245 | 18 | 55 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_game_server_deployments_service_base_transport | test_game_server_deployments_service_base_transport | 2,528 | 2,558 | 2,528 | 2,529 | 250a93fe8506ee9f84e61e6d6c1af0892405a8c0 | bigcode/the-stack | train |
10417c87ba1f1ada28577af0 | train | function | def test_update_game_server_deployment_rollout_from_dict():
test_update_game_server_deployment_rollout(request_type=dict)
| def test_update_game_server_deployment_rollout_from_dict():
| test_update_game_server_deployment_rollout(request_type=dict)
| call.mock_calls[0]
assert (
args[0]
== game_server_deployments.UpdateGameServerDeploymentRolloutRequest()
)
# Establish that the response is the type that we expect.
assert isinstance(response, future.Future)
def test_update_game_server_deployment_rollout_from_dict():
| 64 | 64 | 25 | 12 | 52 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_update_game_server_deployment_rollout_from_dict | test_update_game_server_deployment_rollout_from_dict | 1,960 | 1,961 | 1,960 | 1,960 | 57a3be59b1c74e68eb2893c3d729bbae70f65bf4 | bigcode/the-stack | train |
0b99451053e20868a1b3080f | train | function | def test_update_game_server_deployment_rollout_flattened():
client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(),
)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(client._transport.update_game_server... | def test_update_game_server_deployment_rollout_flattened():
| client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(),
)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(client._transport.update_game_server_deployment_rollout), "__call__"
) as call:
# De... | .mock_calls[0]
assert args[0] == request
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
assert ("x-goog-request-params", "rollout.name=rollout.name/value",) in kw[
"metadata"
]
def test_update_game_server_deployment_rollout_flattened():
| 78 | 79 | 264 | 13 | 65 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_update_game_server_deployment_rollout_flattened | test_update_game_server_deployment_rollout_flattened | 2,062 | 2,092 | 2,062 | 2,062 | fe524f20cb3aa2eb498de7e58112a63d160b1178 | bigcode/the-stack | train |
9df89f828e9f8ed0713b24b4 | train | function | def test__get_default_mtls_endpoint():
api_endpoint = "example.googleapis.com"
api_mtls_endpoint = "example.mtls.googleapis.com"
sandbox_endpoint = "example.sandbox.googleapis.com"
sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com"
non_googleapi = "api.example.com"
assert GameServerD... | def test__get_default_mtls_endpoint():
| api_endpoint = "example.googleapis.com"
api_mtls_endpoint = "example.mtls.googleapis.com"
sandbox_endpoint = "example.sandbox.googleapis.com"
sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com"
non_googleapi = "api.example.com"
assert GameServerDeploymentsServiceClient._get_default_mt... | be the same.
# This method modifies the default endpoint so the client can produce a different
# mtls endpoint for endpoint testing purposes.
def modify_default_endpoint(client):
return (
"foo.googleapis.com"
if ("localhost" in client.DEFAULT_ENDPOINT)
else client.DEFAULT_ENDPOINT
)
def... | 70 | 70 | 235 | 9 | 61 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test__get_default_mtls_endpoint | test__get_default_mtls_endpoint | 69 | 98 | 69 | 69 | f5e410aaee93d32425daf2bfc39a34cef0c62613 | bigcode/the-stack | train |
70a23b18e7cf40c1040957ff | train | function | @pytest.mark.asyncio
async def test_create_game_server_deployment_flattened_async():
client = GameServerDeploymentsServiceAsyncClient(
credentials=credentials.AnonymousCredentials(),
)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(client... | @pytest.mark.asyncio
async def test_create_game_server_deployment_flattened_async():
| client = GameServerDeploymentsServiceAsyncClient(
credentials=credentials.AnonymousCredentials(),
)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(client._client._transport.create_game_server_deployment), "__call__"
) as call:
... | flattened
# fields is an error.
with pytest.raises(ValueError):
client.create_game_server_deployment(
game_server_deployments.CreateGameServerDeploymentRequest(),
parent="parent_value",
game_server_deployment=game_server_deployments.GameServerDeployment(
... | 85 | 85 | 286 | 18 | 67 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_create_game_server_deployment_flattened_async | test_create_game_server_deployment_flattened_async | 1,193 | 1,229 | 1,193 | 1,194 | 19c21a76e55fb6664dd61a73bcce45e166e7add2 | bigcode/the-stack | train |
9a9d52b99c2153d0b6aeefe9 | train | function | def modify_default_endpoint(client):
return (
"foo.googleapis.com"
if ("localhost" in client.DEFAULT_ENDPOINT)
else client.DEFAULT_ENDPOINT
)
| def modify_default_endpoint(client):
| return (
"foo.googleapis.com"
if ("localhost" in client.DEFAULT_ENDPOINT)
else client.DEFAULT_ENDPOINT
)
| client_cert_source_callback():
return b"cert bytes", b"key bytes"
# If default endpoint is localhost, then default mtls endpoint will be the same.
# This method modifies the default endpoint so the client can produce a different
# mtls endpoint for endpoint testing purposes.
def modify_default_endpoint(client):
| 64 | 64 | 33 | 6 | 58 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | modify_default_endpoint | modify_default_endpoint | 61 | 66 | 61 | 61 | eb96599c64f6541467b0c427252c158ad4b36c8a | bigcode/the-stack | train |
6c6344bdbfeb1160c4bf7c29 | train | function | def test_game_server_deployments_service_grpc_asyncio_transport_channel():
channel = aio.insecure_channel("http://localhost/")
# Check that if channel is provided, mtls endpoint and client_cert_source
# won't be used.
callback = mock.MagicMock()
transport = transports.GameServerDeploymentsServiceGr... | def test_game_server_deployments_service_grpc_asyncio_transport_channel():
| channel = aio.insecure_channel("http://localhost/")
# Check that if channel is provided, mtls endpoint and client_cert_source
# won't be used.
callback = mock.MagicMock()
transport = transports.GameServerDeploymentsServiceGrpcAsyncIOTransport(
host="squid.clam.whelk",
channel=channe... | ls.squid.clam.whelk",
client_cert_source=callback,
)
assert transport.grpc_channel == channel
assert transport._host == "squid.clam.whelk:443"
assert not callback.called
def test_game_server_deployments_service_grpc_asyncio_transport_channel():
| 64 | 64 | 145 | 15 | 48 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_game_server_deployments_service_grpc_asyncio_transport_channel | test_game_server_deployments_service_grpc_asyncio_transport_channel | 2,642 | 2,656 | 2,642 | 2,642 | 47b694426629abaaeb575636fc86b980d5401c88 | bigcode/the-stack | train |
07087f4b89a7975158a7e43a | train | function | @pytest.mark.asyncio
async def test_create_game_server_deployment_flattened_error_async():
client = GameServerDeploymentsServiceAsyncClient(
credentials=credentials.AnonymousCredentials(),
)
# Attempting to call a method with both a request object and flattened
# fields is an error.
with py... | @pytest.mark.asyncio
async def test_create_game_server_deployment_flattened_error_async():
| client = GameServerDeploymentsServiceAsyncClient(
credentials=credentials.AnonymousCredentials(),
)
# Attempting to call a method with both a request object and flattened
# fields is an error.
with pytest.raises(ValueError):
await client.create_game_server_deployment(
ga... | ]
assert args[0].parent == "parent_value"
assert args[
0
].game_server_deployment == game_server_deployments.GameServerDeployment(
name="name_value"
)
@pytest.mark.asyncio
async def test_create_game_server_deployment_flattened_error_async():
| 64 | 64 | 122 | 19 | 45 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_create_game_server_deployment_flattened_error_async | test_create_game_server_deployment_flattened_error_async | 1,232 | 1,247 | 1,232 | 1,233 | 8b14b42ed78d279dac090e43810fb127b1417568 | bigcode/the-stack | train |
87b88a2674cd327646204eae | train | function | @pytest.mark.asyncio
async def test_update_game_server_deployment_rollout_flattened_async():
client = GameServerDeploymentsServiceAsyncClient(
credentials=credentials.AnonymousCredentials(),
)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
typ... | @pytest.mark.asyncio
async def test_update_game_server_deployment_rollout_flattened_async():
| client = GameServerDeploymentsServiceAsyncClient(
credentials=credentials.AnonymousCredentials(),
)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(client._client._transport.update_game_server_deployment_rollout),
"__call__",
)... | error.
with pytest.raises(ValueError):
client.update_game_server_deployment_rollout(
game_server_deployments.UpdateGameServerDeploymentRolloutRequest(),
rollout=game_server_deployments.GameServerDeploymentRollout(
name="name_value"
),
update_m... | 90 | 90 | 301 | 20 | 70 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_update_game_server_deployment_rollout_flattened_async | test_update_game_server_deployment_rollout_flattened_async | 2,112 | 2,147 | 2,112 | 2,113 | 9d1d6d0f77528135369ba272d36b29e84ec6398c | bigcode/the-stack | train |
7966fd69defd11fe417173ab | train | function | def test_list_game_server_deployments_field_headers():
client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(),
)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = game_server_deploy... | def test_list_game_server_deployments_field_headers():
| client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(),
)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = game_server_deployments.ListGameServerDeploymentsRequest()
request.pa... | ]
assert args[0] == request
# Establish that the response is the type that we expect.
assert isinstance(response, pagers.ListGameServerDeploymentsAsyncPager)
assert response.next_page_token == "next_page_token_value"
assert response.unreachable == ["unreachable_value"]
def test_list_game_ser... | 73 | 74 | 247 | 11 | 62 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_list_game_server_deployments_field_headers | test_list_game_server_deployments_field_headers | 465 | 490 | 465 | 465 | eeaed09147611754ca17b1e74547ea6c00b1d4b7 | bigcode/the-stack | train |
7a9b1e1b9a817d20e26c6a4f | train | function | @pytest.mark.asyncio
async def test_list_game_server_deployments_async_pages():
client = GameServerDeploymentsServiceAsyncClient(
credentials=credentials.AnonymousCredentials,
)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(client._clien... | @pytest.mark.asyncio
async def test_list_game_server_deployments_async_pages():
| client = GameServerDeploymentsServiceAsyncClient(
credentials=credentials.AnonymousCredentials,
)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(client._client._transport.list_game_server_deployments),
"__call__",
new_call... | ),
RuntimeError,
)
async_pager = await client.list_game_server_deployments(request={},)
assert async_pager.next_page_token == "abc"
responses = []
async for response in async_pager:
responses.append(response)
assert len(responses) == 6
as... | 105 | 105 | 351 | 17 | 88 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_list_game_server_deployments_async_pages | test_list_game_server_deployments_async_pages | 750 | 793 | 750 | 751 | e7aec9a617dae81115084e353fc15524a6bfc8a3 | bigcode/the-stack | train |
9723b3bc4090f41d288dfd87 | train | function | def test_update_game_server_deployment_from_dict():
test_update_game_server_deployment(request_type=dict)
| def test_update_game_server_deployment_from_dict():
| test_update_game_server_deployment(request_type=dict)
| 1
_, args, _ = call.mock_calls[0]
assert args[0] == game_server_deployments.UpdateGameServerDeploymentRequest()
# Establish that the response is the type that we expect.
assert isinstance(response, future.Future)
def test_update_game_server_deployment_from_dict():
| 64 | 64 | 21 | 10 | 54 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_update_game_server_deployment_from_dict | test_update_game_server_deployment_from_dict | 1,487 | 1,488 | 1,487 | 1,487 | 66bc86035e3a6c44ff9e39665264e4d7c10ee4d8 | bigcode/the-stack | train |
f5a79a20d299e525bd6b62bf | train | function | def test_transport_grpc_default():
# A client should use the gRPC transport by default.
client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(),
)
assert isinstance(
client._transport, transports.GameServerDeploymentsServiceGrpcTransport,
)
| def test_transport_grpc_default():
# A client should use the gRPC transport by default.
| client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(),
)
assert isinstance(
client._transport, transports.GameServerDeploymentsServiceGrpcTransport,
)
| = transport.grpc_channel
assert channel
transport = transports.GameServerDeploymentsServiceGrpcAsyncIOTransport(
credentials=credentials.AnonymousCredentials(),
)
channel = transport.grpc_channel
assert channel
def test_transport_grpc_default():
# A client should use the gRPC transport... | 64 | 64 | 60 | 20 | 43 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_transport_grpc_default | test_transport_grpc_default | 2,509 | 2,516 | 2,509 | 2,510 | 57350063d26d07d42bf92d7a419a05aca9adf2e0 | bigcode/the-stack | train |
c08946482726f8f7b0f8706e | train | function | def test_delete_game_server_deployment_flattened_error():
client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(),
)
# Attempting to call a method with both a request object and flattened
# fields is an error.
with pytest.raises(ValueError):
clien... | def test_delete_game_server_deployment_flattened_error():
| client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(),
)
# Attempting to call a method with both a request object and flattened
# fields is an error.
with pytest.raises(ValueError):
client.delete_game_server_deployment(
game_server_d... | Establish that the underlying call was made with the expected
# request object values.
assert len(call.mock_calls) == 1
_, args, _ = call.mock_calls[0]
assert args[0].name == "name_value"
def test_delete_game_server_deployment_flattened_error():
| 64 | 64 | 90 | 12 | 52 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_delete_game_server_deployment_flattened_error | test_delete_game_server_deployment_flattened_error | 1,399 | 1,410 | 1,399 | 1,399 | 01805fdc1948a2985b8d8ade8bf2b7445ff51280 | bigcode/the-stack | train |
2a86bd9bbbea398818ac049c | train | function | @pytest.mark.asyncio
async def test_create_game_server_deployment_async(transport: str = "grpc_asyncio"):
client = GameServerDeploymentsServiceAsyncClient(
credentials=credentials.AnonymousCredentials(), transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
... | @pytest.mark.asyncio
async def test_create_game_server_deployment_async(transport: str = "grpc_asyncio"):
| client = GameServerDeploymentsServiceAsyncClient(
credentials=credentials.AnonymousCredentials(), transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
# and we are mocking out the actual API, so just send an empty request.
request = game_server_deplo... | _server_deployments.CreateGameServerDeploymentRequest()
# Establish that the response is the type that we expect.
assert isinstance(response, future.Future)
def test_create_game_server_deployment_from_dict():
test_create_game_server_deployment(request_type=dict)
@pytest.mark.asyncio
async def test_create... | 76 | 76 | 255 | 24 | 52 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_create_game_server_deployment_async | test_create_game_server_deployment_async | 1,051 | 1,079 | 1,051 | 1,052 | 18e6d59f63ac1c8c429c59660cefdafb89f465c0 | bigcode/the-stack | train |
672fa6ffa40a485f97aed429 | train | function | def test_update_game_server_deployment_flattened_error():
client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(),
)
# Attempting to call a method with both a request object and flattened
# fields is an error.
with pytest.raises(ValueError):
clien... | def test_update_game_server_deployment_flattened_error():
| client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(),
)
# Attempting to call a method with both a request object and flattened
# fields is an error.
with pytest.raises(ValueError):
client.update_game_server_deployment(
game_server_d... | ]
assert args[
0
].game_server_deployment == game_server_deployments.GameServerDeployment(
name="name_value"
)
assert args[0].update_mask == field_mask.FieldMask(paths=["paths_value"])
def test_update_game_server_deployment_flattened_error():
| 63 | 64 | 120 | 12 | 51 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_update_game_server_deployment_flattened_error | test_update_game_server_deployment_flattened_error | 1,622 | 1,636 | 1,622 | 1,622 | 6068dde5643a8c44228da1a48444ea627618e50f | bigcode/the-stack | train |
e0938d2802f1e424ba13c598 | train | function | def client_cert_source_callback():
return b"cert bytes", b"key bytes"
| def client_cert_source_callback():
| return b"cert bytes", b"key bytes"
| 1.types import game_server_deployments
from google.longrunning import operations_pb2
from google.oauth2 import service_account
from google.protobuf import field_mask_pb2 as field_mask # type: ignore
from google.protobuf import timestamp_pb2 as timestamp # type: ignore
def client_cert_source_callback():
| 64 | 64 | 18 | 6 | 57 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | client_cert_source_callback | client_cert_source_callback | 54 | 55 | 54 | 54 | 434b7840ef4d9d3464b78b6876ca7bf4bc6840b1 | bigcode/the-stack | train |
1ab631ccf20745e754a6efd5 | train | function | def test_game_server_deployments_service_transport_auth_adc():
# If credentials and host are not provided, the transport class should use
# ADC credentials.
with mock.patch.object(auth, "default") as adc:
adc.return_value = (credentials.AnonymousCredentials(), None)
transports.GameServerDepl... | def test_game_server_deployments_service_transport_auth_adc():
# If credentials and host are not provided, the transport class should use
# ADC credentials.
| with mock.patch.object(auth, "default") as adc:
adc.return_value = (credentials.AnonymousCredentials(), None)
transports.GameServerDeploymentsServiceGrpcTransport(
host="squid.clam.whelk", quota_project_id="octopus"
)
adc.assert_called_once_with(
scopes=("http... | ServiceClient()
adc.assert_called_once_with(
scopes=("https://www.googleapis.com/auth/cloud-platform",),
quota_project_id=None,
)
def test_game_server_deployments_service_transport_auth_adc():
# If credentials and host are not provided, the transport class should use
# AD... | 64 | 64 | 119 | 33 | 31 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_game_server_deployments_service_transport_auth_adc | test_game_server_deployments_service_transport_auth_adc | 2,591 | 2,602 | 2,591 | 2,593 | 48911e7f00dd69a8c12ae494db31601f695593bc | bigcode/the-stack | train |
66af6b2c2a59a68516a6cbd5 | train | function | @pytest.mark.asyncio
async def test_update_game_server_deployment_rollout_field_headers_async():
client = GameServerDeploymentsServiceAsyncClient(
credentials=credentials.AnonymousCredentials(),
)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a no... | @pytest.mark.asyncio
async def test_update_game_server_deployment_rollout_field_headers_async():
| client = GameServerDeploymentsServiceAsyncClient(
credentials=credentials.AnonymousCredentials(),
)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = game_server_deployments.UpdateGameServerDeploymentRolloutRequest()
... | _calls[0]
assert args[0] == request
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
assert ("x-goog-request-params", "rollout.name=rollout.name/value",) in kw[
"metadata"
]
@pytest.mark.asyncio
async def test_update_game_server_deployment_rollout_field_headers_... | 83 | 84 | 280 | 19 | 64 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_update_game_server_deployment_rollout_field_headers_async | test_update_game_server_deployment_rollout_field_headers_async | 2,028 | 2,059 | 2,028 | 2,029 | 44b56e33cea225f60b58402b935d6b174163e961 | bigcode/the-stack | train |
94afebfbcfe5087b90082db8 | train | function | @pytest.mark.asyncio
async def test_preview_game_server_deployment_rollout_field_headers_async():
client = GameServerDeploymentsServiceAsyncClient(
credentials=credentials.AnonymousCredentials(),
)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a n... | @pytest.mark.asyncio
async def test_preview_game_server_deployment_rollout_field_headers_async():
| client = GameServerDeploymentsServiceAsyncClient(
credentials=credentials.AnonymousCredentials(),
)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = game_server_deployments.PreviewGameServerDeploymentRolloutRequest()
... | .mock_calls[0]
assert args[0] == request
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
assert ("x-goog-request-params", "rollout.name=rollout.name/value",) in kw[
"metadata"
]
@pytest.mark.asyncio
async def test_preview_game_server_deployment_rollout_field_he... | 84 | 85 | 286 | 19 | 65 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_preview_game_server_deployment_rollout_field_headers_async | test_preview_game_server_deployment_rollout_field_headers_async | 2,288 | 2,319 | 2,288 | 2,289 | 25d7e1ec5cacde5629c6b620dadc9b82936990fd | bigcode/the-stack | train |
a90ad7ce153a933c77289160 | train | function | def test_update_game_server_deployment(
transport: str = "grpc",
request_type=game_server_deployments.UpdateGameServerDeploymentRequest,
):
client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(), transport=transport,
)
# Everything is optional in proto3 ... | def test_update_game_server_deployment(
transport: str = "grpc",
request_type=game_server_deployments.UpdateGameServerDeploymentRequest,
):
| client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(), transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
# and we are mocking out the actual API, so just send an empty request.
request = request_type()
# ... | # fields is an error.
with pytest.raises(ValueError):
await client.delete_game_server_deployment(
game_server_deployments.DeleteGameServerDeploymentRequest(),
name="name_value",
)
def test_update_game_server_deployment(
transport: str = "grpc",
request_type=game_s... | 75 | 75 | 252 | 32 | 43 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_update_game_server_deployment | test_update_game_server_deployment | 1,456 | 1,484 | 1,456 | 1,459 | 8fb47da9d21b3574aa4f285697f5caf1c1e2e187 | bigcode/the-stack | train |
de173f83613e12ae3fb068cb | train | function | def test_preview_game_server_deployment_rollout(
transport: str = "grpc",
request_type=game_server_deployments.PreviewGameServerDeploymentRolloutRequest,
):
client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(), transport=transport,
)
# Everything is op... | def test_preview_game_server_deployment_rollout(
transport: str = "grpc",
request_type=game_server_deployments.PreviewGameServerDeploymentRolloutRequest,
):
| client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(), transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
# and we are mocking out the actual API, so just send an empty request.
request = request_type()
# ... | client.update_game_server_deployment_rollout(
game_server_deployments.UpdateGameServerDeploymentRolloutRequest(),
rollout=game_server_deployments.GameServerDeploymentRollout(
name="name_value"
),
update_mask=field_mask.FieldMask(paths=["paths_value"]),
... | 97 | 97 | 324 | 37 | 60 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_preview_game_server_deployment_rollout | test_preview_game_server_deployment_rollout | 2,168 | 2,207 | 2,168 | 2,171 | 5ff57ef915c7b4acd54a880e88f055c2ed575711 | bigcode/the-stack | train |
628a1cf80bb29ad7a1b4eb6a | train | function | @pytest.mark.asyncio
async def test_get_game_server_deployment_field_headers_async():
client = GameServerDeploymentsServiceAsyncClient(
credentials=credentials.AnonymousCredentials(),
)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty val... | @pytest.mark.asyncio
async def test_get_game_server_deployment_field_headers_async():
| client = GameServerDeploymentsServiceAsyncClient(
credentials=credentials.AnonymousCredentials(),
)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = game_server_deployments.GetGameServerDeploymentRequest()
request... | _ = call.mock_calls[0]
assert args[0] == request
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
@pytest.mark.asyncio
async def test_get_game_server_deployment_field_headers_async():
| 76 | 77 | 258 | 17 | 59 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_get_game_server_deployment_field_headers_async | test_get_game_server_deployment_field_headers_async | 906 | 934 | 906 | 907 | fe6bdafb6041b0ad74a75ad53eb859df82ce4f92 | bigcode/the-stack | train |
da1671b792aa10961e42886c | train | function | def test_create_game_server_deployment_from_dict():
test_create_game_server_deployment(request_type=dict)
| def test_create_game_server_deployment_from_dict():
| test_create_game_server_deployment(request_type=dict)
| 1
_, args, _ = call.mock_calls[0]
assert args[0] == game_server_deployments.CreateGameServerDeploymentRequest()
# Establish that the response is the type that we expect.
assert isinstance(response, future.Future)
def test_create_game_server_deployment_from_dict():
| 64 | 64 | 21 | 10 | 54 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_create_game_server_deployment_from_dict | test_create_game_server_deployment_from_dict | 1,047 | 1,048 | 1,047 | 1,047 | 66abd124a48b13dd67969bdcd6afac52b33a562b | bigcode/the-stack | train |
6d577a97a70a4d114d671d1b | train | function | def test_list_game_server_deployments_from_dict():
test_list_game_server_deployments(request_type=dict)
| def test_list_game_server_deployments_from_dict():
| test_list_game_server_deployments(request_type=dict)
| ()
# Establish that the response is the type that we expect.
assert isinstance(response, pagers.ListGameServerDeploymentsPager)
assert response.next_page_token == "next_page_token_value"
assert response.unreachable == ["unreachable_value"]
def test_list_game_server_deployments_from_dict():
| 63 | 64 | 23 | 11 | 52 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_list_game_server_deployments_from_dict | test_list_game_server_deployments_from_dict | 423 | 424 | 423 | 423 | d20646890af14948fc0ae5b9fd08d4a7c20449bb | bigcode/the-stack | train |
751e7f3cd07f874887574a9b | train | function | @pytest.mark.asyncio
async def test_list_game_server_deployments_field_headers_async():
client = GameServerDeploymentsServiceAsyncClient(
credentials=credentials.AnonymousCredentials(),
)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty v... | @pytest.mark.asyncio
async def test_list_game_server_deployments_field_headers_async():
| client = GameServerDeploymentsServiceAsyncClient(
credentials=credentials.AnonymousCredentials(),
)
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = game_server_deployments.ListGameServerDeploymentsRequest()
reque... | _ = call.mock_calls[0]
assert args[0] == request
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
@pytest.mark.asyncio
async def test_list_game_server_deployments_field_headers_async():
| 78 | 79 | 266 | 18 | 60 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_list_game_server_deployments_field_headers_async | test_list_game_server_deployments_field_headers_async | 493 | 521 | 493 | 494 | 1c60df087d9afc854ead312ed6591f157bdff637 | bigcode/the-stack | train |
3a5332e34e0fbd578cbeed46 | train | function | def test_get_game_server_deployment_flattened():
client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(),
)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(client._transport.get_game_server_deployment), ... | def test_get_game_server_deployment_flattened():
| client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(),
)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(client._transport.get_game_server_deployment), "__call__"
) as call:
# Designate an ... | ]
assert args[0] == request
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
def test_get_game_server_deployment_flattened():
| 63 | 64 | 192 | 11 | 52 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_get_game_server_deployment_flattened | test_get_game_server_deployment_flattened | 937 | 958 | 937 | 937 | 9afc599270031abece20159770406add953cf280 | bigcode/the-stack | train |
fc342f53d7e511382a15dca7 | train | function | @pytest.mark.parametrize(
"client_class,transport_class,transport_name",
[
(
GameServerDeploymentsServiceClient,
transports.GameServerDeploymentsServiceGrpcTransport,
"grpc",
),
(
GameServerDeploymentsServiceAsyncClient,
transpo... | @pytest.mark.parametrize(
"client_class,transport_class,transport_name",
[
(
GameServerDeploymentsServiceClient,
transports.GameServerDeploymentsServiceGrpcTransport,
"grpc",
),
(
GameServerDeploymentsServiceAsyncClient,
transpo... | options = client_options.ClientOptions(scopes=["1", "2"],)
with mock.patch.object(transport_class, "__init__") as patched:
patched.return_value = None
client = client_class(client_options=options)
patched.assert_called_once_with(
credentials=None,
credentials_file... | @pytest.mark.parametrize(
"client_class,transport_class,transport_name",
[
(
GameServerDeploymentsServiceClient,
transports.GameServerDeploymentsServiceGrpcTransport,
"grpc",
),
(
GameServerDeploymentsServiceAsyncClient,
transpo... | 111 | 64 | 215 | 111 | 0 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_game_server_deployments_service_client_client_options_scopes | test_game_server_deployments_service_client_client_options_scopes | 299 | 330 | 299 | 317 | d5e99cad3ad0abe9238af9e739b2e812349dae09 | bigcode/the-stack | train |
bb716b85dd2b7646ad07466a | train | function | @mock.patch("grpc.ssl_channel_credentials", autospec=True)
@mock.patch("google.api_core.grpc_helpers_async.create_channel", autospec=True)
def test_game_server_deployments_service_grpc_asyncio_transport_channel_mtls_with_client_cert_source(
grpc_create_channel, grpc_ssl_channel_cred
):
# Check that if channel i... | @mock.patch("grpc.ssl_channel_credentials", autospec=True)
@mock.patch("google.api_core.grpc_helpers_async.create_channel", autospec=True)
def test_game_server_deployments_service_grpc_asyncio_transport_channel_mtls_with_client_cert_source(
grpc_create_channel, grpc_ssl_channel_cred
):
# Check that if channel i... | mock_cred = mock.Mock()
mock_ssl_cred = mock.Mock()
grpc_ssl_channel_cred.return_value = mock_ssl_cred
mock_grpc_channel = mock.Mock()
grpc_create_channel.return_value = mock_grpc_channel
transport = transports.GameServerDeploymentsServiceGrpcAsyncIOTransport(
host="squid.clam.whelk",... | @mock.patch("grpc.ssl_channel_credentials", autospec=True)
@mock.patch("google.api_core.grpc_helpers_async.create_channel", autospec=True)
def test_game_server_deployments_service_grpc_asyncio_transport_channel_mtls_with_client_cert_source(
grpc_create_channel, grpc_ssl_channel_cred
):
# Check that if channel i... | 96 | 93 | 312 | 96 | 0 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_game_server_deployments_service_grpc_asyncio_transport_channel_mtls_with_client_cert_source | test_game_server_deployments_service_grpc_asyncio_transport_channel_mtls_with_client_cert_source | 2,694 | 2,726 | 2,694 | 2,700 | 05cf1526ec7a9ac49ba406618672b8e2bf156d51 | bigcode/the-stack | train |
c2aeacb43d9634dd2ee5b80e | train | function | def test_game_server_deployment_path():
project = "squid"
location = "clam"
deployment = "whelk"
expected = "projects/{project}/locations/{location}/gameServerDeployments/{deployment}".format(
project=project, location=location, deployment=deployment,
)
actual = GameServerDeploymentsSer... | def test_game_server_deployment_path():
| project = "squid"
location = "clam"
deployment = "whelk"
expected = "projects/{project}/locations/{location}/gameServerDeployments/{deployment}".format(
project=project, location=location, deployment=deployment,
)
actual = GameServerDeploymentsServiceClient.game_server_deployment_path(
... | mentsServiceClient.game_server_deployment_rollout_path(
**expected
)
# Check that the path construction is reversible.
actual = GameServerDeploymentsServiceClient.parse_game_server_deployment_rollout_path(
path
)
assert expected == actual
def test_game_server_deployment_path():
| 64 | 64 | 94 | 8 | 55 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_game_server_deployment_path | test_game_server_deployment_path | 2,860 | 2,871 | 2,860 | 2,860 | f37eee5e2036413616bd6f944beaa3bdfdee881d | bigcode/the-stack | train |
d04b62eba7d0e9578d3d9b3b | train | function | @pytest.mark.asyncio
async def test_get_game_server_deployment_rollout_flattened_error_async():
client = GameServerDeploymentsServiceAsyncClient(
credentials=credentials.AnonymousCredentials(),
)
# Attempting to call a method with both a request object and flattened
# fields is an error.
wi... | @pytest.mark.asyncio
async def test_get_game_server_deployment_rollout_flattened_error_async():
| client = GameServerDeploymentsServiceAsyncClient(
credentials=credentials.AnonymousCredentials(),
)
# Attempting to call a method with both a request object and flattened
# fields is an error.
with pytest.raises(ValueError):
await client.get_game_server_deployment_rollout(
... | was made with the expected
# request object values.
assert len(call.mock_calls)
_, args, _ = call.mock_calls[0]
assert args[0].name == "name_value"
@pytest.mark.asyncio
async def test_get_game_server_deployment_rollout_flattened_error_async():
| 64 | 64 | 105 | 21 | 43 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_get_game_server_deployment_rollout_flattened_error_async | test_get_game_server_deployment_rollout_flattened_error_async | 1,911 | 1,923 | 1,911 | 1,912 | e696e0bb9c75a27dc7123d6ed4c9d9178c0f55d4 | bigcode/the-stack | train |
8dbb2d3cbe2897a4b4be8c40 | train | function | @pytest.mark.asyncio
async def test_list_game_server_deployments_flattened_error_async():
client = GameServerDeploymentsServiceAsyncClient(
credentials=credentials.AnonymousCredentials(),
)
# Attempting to call a method with both a request object and flattened
# fields is an error.
with pyt... | @pytest.mark.asyncio
async def test_list_game_server_deployments_flattened_error_async():
| client = GameServerDeploymentsServiceAsyncClient(
credentials=credentials.AnonymousCredentials(),
)
# Attempting to call a method with both a request object and flattened
# fields is an error.
with pytest.raises(ValueError):
await client.list_game_server_deployments(
gam... | call was made with the expected
# request object values.
assert len(call.mock_calls)
_, args, _ = call.mock_calls[0]
assert args[0].parent == "parent_value"
@pytest.mark.asyncio
async def test_list_game_server_deployments_flattened_error_async():
| 64 | 64 | 102 | 20 | 44 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_list_game_server_deployments_flattened_error_async | test_list_game_server_deployments_flattened_error_async | 590 | 602 | 590 | 591 | bd23efd38d71e87df71b5a0dd0d7853ff4e307be | bigcode/the-stack | train |
41b13ad3f182f8a58fa33f42 | train | function | def test_create_game_server_deployment_flattened():
client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(),
)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(client._transport.create_game_server_deploym... | def test_create_game_server_deployment_flattened():
| client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(),
)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(client._transport.create_game_server_deployment), "__call__"
) as call:
# Designate ... | _, args, _ = call.mock_calls[0]
assert args[0] == request
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
def test_create_game_server_deployment_flattened():
| 74 | 75 | 250 | 11 | 63 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_create_game_server_deployment_flattened | test_create_game_server_deployment_flattened | 1,141 | 1,173 | 1,141 | 1,141 | 8f5a09375ea5f3554eb29c8440d050c10d584e0c | bigcode/the-stack | train |
dc4c400a93117f473301b3ab | train | function | @pytest.mark.asyncio
async def test_update_game_server_deployment_rollout_flattened_error_async():
client = GameServerDeploymentsServiceAsyncClient(
credentials=credentials.AnonymousCredentials(),
)
# Attempting to call a method with both a request object and flattened
# fields is an error.
... | @pytest.mark.asyncio
async def test_update_game_server_deployment_rollout_flattened_error_async():
| client = GameServerDeploymentsServiceAsyncClient(
credentials=credentials.AnonymousCredentials(),
)
# Attempting to call a method with both a request object and flattened
# fields is an error.
with pytest.raises(ValueError):
await client.update_game_server_deployment_rollout(
... | 0].rollout == game_server_deployments.GameServerDeploymentRollout(
name="name_value"
)
assert args[0].update_mask == field_mask.FieldMask(paths=["paths_value"])
@pytest.mark.asyncio
async def test_update_game_server_deployment_rollout_flattened_error_async():
| 63 | 64 | 134 | 21 | 42 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_update_game_server_deployment_rollout_flattened_error_async | test_update_game_server_deployment_rollout_flattened_error_async | 2,150 | 2,165 | 2,150 | 2,151 | b76eb01c83ef2829799f6937e28937780503cce6 | bigcode/the-stack | train |
538442f2b715def5f9a25b84 | train | function | def test_update_game_server_deployment_flattened():
client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(),
)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(client._transport.update_game_server_deploym... | def test_update_game_server_deployment_flattened():
| client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(),
)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(client._transport.update_game_server_deployment), "__call__"
) as call:
# Designate ... | 0]
assert args[0] == request
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
assert (
"x-goog-request-params",
"game_server_deployment.name=game_server_deployment.name/value",
) in kw["metadata"]
def test_update_game_server_deployment_flattened():
| 77 | 78 | 263 | 11 | 66 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_update_game_server_deployment_flattened | test_update_game_server_deployment_flattened | 1,587 | 1,619 | 1,587 | 1,587 | 9adb16f113bd48dcacc04aae0810def223de7814 | bigcode/the-stack | train |
0d5d4e628c9aaa73744d01dd | train | function | def test_credentials_transport_error():
# It is an error to provide credentials and a transport instance.
transport = transports.GameServerDeploymentsServiceGrpcTransport(
credentials=credentials.AnonymousCredentials(),
)
with pytest.raises(ValueError):
client = GameServerDeploymentsServ... | def test_credentials_transport_error():
# It is an error to provide credentials and a transport instance.
| transport = transports.GameServerDeploymentsServiceGrpcTransport(
credentials=credentials.AnonymousCredentials(),
)
with pytest.raises(ValueError):
client = GameServerDeploymentsServiceClient(
credentials=credentials.AnonymousCredentials(), transport=transport,
)
# I... | request
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
def test_credentials_transport_error():
# It is an error to provide credentials and a transport instance.
| 64 | 65 | 219 | 20 | 44 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_credentials_transport_error | test_credentials_transport_error | 2,455 | 2,482 | 2,455 | 2,456 | 79c54fa3f4f8cb509bc641153d24ebcb4a55a228 | bigcode/the-stack | train |
30ac6ec6f167f4bcddd3b517 | train | function | @pytest.mark.asyncio
async def test_update_game_server_deployment_flattened_error_async():
client = GameServerDeploymentsServiceAsyncClient(
credentials=credentials.AnonymousCredentials(),
)
# Attempting to call a method with both a request object and flattened
# fields is an error.
with py... | @pytest.mark.asyncio
async def test_update_game_server_deployment_flattened_error_async():
| client = GameServerDeploymentsServiceAsyncClient(
credentials=credentials.AnonymousCredentials(),
)
# Attempting to call a method with both a request object and flattened
# fields is an error.
with pytest.raises(ValueError):
await client.update_game_server_deployment(
ga... | 0
].game_server_deployment == game_server_deployments.GameServerDeployment(
name="name_value"
)
assert args[0].update_mask == field_mask.FieldMask(paths=["paths_value"])
@pytest.mark.asyncio
async def test_update_game_server_deployment_flattened_error_async():
| 63 | 64 | 129 | 19 | 44 | Yingxin-Jiang/python-game-servers | tests/unit/gapic/gaming_v1/test_game_server_deployments_service.py | Python | test_update_game_server_deployment_flattened_error_async | test_update_game_server_deployment_flattened_error_async | 1,678 | 1,693 | 1,678 | 1,679 | f6660b41c4650a0d1aa71ef6f8a93ec6b4510815 | bigcode/the-stack | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.