# 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
    with mock.patch.dict(
        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"}
    ):
        with pytest.raises(ValueError):
            client = client_class(transport=transport_name)

    # Check the case quota_project_id is provided
    options = client_options.ClientOptions(quota_project_id="octopus")
    with mock.patch.object(transport_class, "__init__") as patched:
        patched.return_value = None
        client = client_class(client_options=options, transport=transport_name)
        patched.assert_called_once_with(
            credentials=None,
            credentials_file=None,
            host=client.DEFAULT_ENDPOINT,
            scopes=None,
            client_cert_source_for_mtls=None,
            quota_project_id="octopus",
            client_info=transports.base.DEFAULT_CLIENT_INFO,
            always_use_jwt_access=True,
        )


@pytest.mark.parametrize(
    "client_class,transport_class,transport_name,use_client_cert_env",
    [
        (TraceServiceClient, transports.TraceServiceGrpcTransport, "grpc", "true"),
        (
            TraceServiceAsyncClient,
            transports.TraceServiceGrpcAsyncIOTransport,

# 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

    with mock.patch.dict(
        os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"}
    ):
        with pytest.raises(ValueError):
            client = client_class(transport=transport_name)

    # Check the case quota_project_id is provided
    options = client_options.ClientOptions(quota_project_id="octopus")
    with mock.patch.object(transport_class, "__init__") as patched:
        patched.return_value = None
        client = client_class(client_options=options, transport=transport_name)
        patched.assert_called_once_with(
            credentials=None,
            credentials_file=None,
            host=client.DEFAULT_ENDPOINT,
            scopes=None,
            client_cert_source_for_mtls=None,
            quota_project_id="octopus",
            client_info=transports.base.DEFAULT_CLIENT_INFO,
            always_use_jwt_access=True,
        )


@pytest.mark.parametrize(
    "client_class,transport_class,transport_name,use_client_cert_env",
    [
        (TraceServiceClient, transports.TraceServiceGrpcTransport, "grpc", "true"),
        (
            TraceServiceAsyncClient,
            transports.TraceServiceGrpcAsyncIOTransport,

            "grpc_asyncio",