# Path: google/cloud/trace_v1/services/trace_service/pagers.py
# class ListTracesPager:
# class ListTracesAsyncPager:
#     def __init__(
#         self,
#         method: Callable[..., trace.ListTracesResponse],
#         request: trace.ListTracesRequest,
#         response: trace.ListTracesResponse,
#         *,
#         metadata: Sequence[Tuple[str, str]] = ()
#     ):
#     def __getattr__(self, name: str) -> Any:
#     def pages(self) -> Iterator[trace.ListTracesResponse]:
#     def __iter__(self) -> Iterator[trace.Trace]:
#     def __repr__(self) -> str:
#     def __init__(
#         self,
#         method: Callable[..., Awaitable[trace.ListTracesResponse]],
#         request: trace.ListTracesRequest,
#         response: trace.ListTracesResponse,
#         *,
#         metadata: Sequence[Tuple[str, str]] = ()
#     ):
#     def __getattr__(self, name: str) -> Any:
#     async def pages(self) -> AsyncIterator[trace.ListTracesResponse]:
#     def __aiter__(self) -> AsyncIterator[trace.Trace]:
#         async def async_generator():
#     def __repr__(self) -> str:
# 
# Path: google/cloud/trace_v1/types/trace.py
# class Trace(proto.Message):
# class Traces(proto.Message):
# class TraceSpan(proto.Message):
#     class SpanKind(proto.Enum):
# class ListTracesRequest(proto.Message):
#     class ViewType(proto.Enum):
# class ListTracesResponse(proto.Message):
# class GetTraceRequest(proto.Message):
# class PatchTracesRequest(proto.Message):
#         SPAN_KIND_UNSPECIFIED = 0
#         RPC_SERVER = 1
#         RPC_CLIENT = 2
#         VIEW_TYPE_UNSPECIFIED = 0
#         MINIMAL = 1
#         ROOTSPAN = 2
#         COMPLETE = 3
#     def raw_page(self):


import os
import mock
import grpc
import math
import pytest
import google.auth
from grpc.experimental import aio
from proto.marshal.rules.dates import DurationRule, TimestampRule
from google.api_core import client_options
from google.api_core import exceptions as core_exceptions
from google.api_core import gapic_v1
from google.api_core import grpc_helpers
from google.api_core import grpc_helpers_async
from google.api_core import path_template
from google.auth import credentials as ga_credentials
from google.auth.exceptions import MutualTLSChannelError
from google.cloud.trace_v1.services.trace_service import TraceServiceAsyncClient
from google.cloud.trace_v1.services.trace_service import TraceServiceClient
from google.cloud.trace_v1.services.trace_service import pagers
from google.cloud.trace_v1.services.trace_service import transports
from google.cloud.trace_v1.types import trace
from google.oauth2 import service_account
from google.protobuf import timestamp_pb2  # type: ignore
        _, args, _ = call.mock_calls[0]
        assert args[0] == trace.ListTracesRequest()


@pytest.mark.asyncio
async def test_list_traces_async(
    transport: str = "grpc_asyncio", request_type=trace.ListTracesRequest
):
    client = TraceServiceAsyncClient(
        credentials=ga_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()

    # Mock the actual call within the gRPC stub, and fake the request.
    with mock.patch.object(type(client.transport.list_traces), "__call__") as call:
        # Designate an appropriate return value for the call.
        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
            trace.ListTracesResponse(next_page_token="next_page_token_value",)
        )
        response = await client.list_traces(request)

        # Establish that the underlying gRPC stub method was called.
        assert len(call.mock_calls)
        _, args, _ = call.mock_calls[0]
        assert args[0] == trace.ListTracesRequest()

    # Establish that the response is the type that we expect.

# Path: google/cloud/trace_v1/services/trace_service/pagers.py
# class ListTracesPager:
# class ListTracesAsyncPager:
#     def __init__(
#         self,
#         method: Callable[..., trace.ListTracesResponse],
#         request: trace.ListTracesRequest,
#         response: trace.ListTracesResponse,
#         *,
#         metadata: Sequence[Tuple[str, str]] = ()
#     ):
#     def __getattr__(self, name: str) -> Any:
#     def pages(self) -> Iterator[trace.ListTracesResponse]:
#     def __iter__(self) -> Iterator[trace.Trace]:
#     def __repr__(self) -> str:
#     def __init__(
#         self,
#         method: Callable[..., Awaitable[trace.ListTracesResponse]],
#         request: trace.ListTracesRequest,
#         response: trace.ListTracesResponse,
#         *,
#         metadata: Sequence[Tuple[str, str]] = ()
#     ):
#     def __getattr__(self, name: str) -> Any:
#     async def pages(self) -> AsyncIterator[trace.ListTracesResponse]:
#     def __aiter__(self) -> AsyncIterator[trace.Trace]:
#         async def async_generator():
#     def __repr__(self) -> str:
# 
# Path: google/cloud/trace_v1/types/trace.py
# class Trace(proto.Message):
# class Traces(proto.Message):
# class TraceSpan(proto.Message):
#     class SpanKind(proto.Enum):
# class ListTracesRequest(proto.Message):
#     class ViewType(proto.Enum):
# class ListTracesResponse(proto.Message):
# class GetTraceRequest(proto.Message):
# class PatchTracesRequest(proto.Message):
#         SPAN_KIND_UNSPECIFIED = 0
#         RPC_SERVER = 1
#         RPC_CLIENT = 2
#         VIEW_TYPE_UNSPECIFIED = 0
#         MINIMAL = 1
#         ROOTSPAN = 2
#         COMPLETE = 3
#     def raw_page(self):


# Path: tests/unit/gapic/trace_v1/test_trace_service.py
import os
import mock
import grpc
import math
import pytest
import google.auth
from grpc.experimental import aio
from proto.marshal.rules.dates import DurationRule, TimestampRule
from google.api_core import client_options
from google.api_core import exceptions as core_exceptions
from google.api_core import gapic_v1
from google.api_core import grpc_helpers
from google.api_core import grpc_helpers_async
from google.api_core import path_template
from google.auth import credentials as ga_credentials
from google.auth.exceptions import MutualTLSChannelError
from google.cloud.trace_v1.services.trace_service import TraceServiceAsyncClient
from google.cloud.trace_v1.services.trace_service import TraceServiceClient
from google.cloud.trace_v1.services.trace_service import pagers
from google.cloud.trace_v1.services.trace_service import transports
from google.cloud.trace_v1.types import trace
from google.oauth2 import service_account
from google.protobuf import timestamp_pb2  # type: ignore

        _, args, _ = call.mock_calls[0]
        assert args[0] == trace.ListTracesRequest()


@pytest.mark.asyncio
async def test_list_traces_async(
    transport: str = "grpc_asyncio", request_type=trace.ListTracesRequest
):
    client = TraceServiceAsyncClient(
        credentials=ga_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()

    # Mock the actual call within the gRPC stub, and fake the request.
    with mock.patch.object(type(client.transport.list_traces), "__call__") as call:
        # Designate an appropriate return value for the call.
        call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
            trace.ListTracesResponse(next_page_token="next_page_token_value",)
        )
        response = await client.list_traces(request)

        # Establish that the underlying gRPC stub method was called.
        assert len(call.mock_calls)
        _, args, _ = call.mock_calls[0]
        assert args[0] == trace.ListTracesRequest()

    # Establish that the response is the type that we expect.

    assert isinstance(response, pagers.ListTracesAsyncPager)