Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

refactor(api): remove redundant casts in tencent trace unit tests (#44158)

Azusa0108134012f40ae
diff --git a/api/providers/trace/trace-tencent/tests/unit_tests/tencent_trace/test_client.py b/api/providers/trace/trace-tencent/tests/unit_tests/tencent_trace/test_client.py
index aca90ec45ce..cf2cf4a1be0 100644
--- a/api/providers/trace/trace-tencent/tests/unit_tests/tencent_trace/test_client.py
+++ b/api/providers/trace/trace-tencent/tests/unit_tests/tencent_trace/test_client.py
@@ -557,7 +557,7 @@ def test_record_methods_handle_exceptions(
def test_metrics_initializes_grpc_metric_exporter() -> None:
client = _build_client()
metric_reader = metric_reader_instances[-1]
- exporter = cast(DummyGrpcMetricExporter, metric_reader.exporter)
+ exporter = metric_reader.exporter
assert isinstance(exporter, DummyGrpcMetricExporter)
assert metric_reader.export_interval_millis == client.metrics_export_interval_sec * 1000
@@ -570,7 +570,7 @@ def test_metrics_initializes_http_protobuf_metric_exporter(monkeypatch: pytest.M
monkeypatch.setenv("OTEL_EXPORTER_OTLP_PROTOCOL", "http/protobuf")
client = _build_client()
metric_reader = metric_reader_instances[-1]
- exporter = cast(DummyHttpMetricExporter, metric_reader.exporter)
+ exporter = metric_reader.exporter
assert isinstance(exporter, DummyHttpMetricExporter)
assert metric_reader.export_interval_millis == client.metrics_export_interval_sec * 1000
@@ -582,7 +582,7 @@ def test_metrics_initializes_http_json_metric_exporter(monkeypatch: pytest.Monke
monkeypatch.setenv("OTEL_EXPORTER_OTLP_PROTOCOL", "http/json")
client = _build_client()
metric_reader = metric_reader_instances[-1]
- exporter = cast(DummyJsonMetricExporter, metric_reader.exporter)
+ exporter = metric_reader.exporter
assert isinstance(exporter, DummyJsonMetricExporter)
assert metric_reader.export_interval_millis == client.metrics_export_interval_sec * 1000
@@ -597,7 +597,7 @@ def test_metrics_http_json_metric_exporter_falls_back_without_temporality(monkey
monkeypatch.setattr(exporter_module, "OTLPMetricExporter", DummyJsonMetricExporterNoTemporality)
_ = _build_client()
metric_reader = metric_reader_instances[-1]
- exporter = cast(DummyJsonMetricExporterNoTemporality, metric_reader.exporter)
+ exporter = metric_reader.exporter
assert isinstance(exporter, DummyJsonMetricExporterNoTemporality)
assert "preferred_temporality" not in exporter.kwargs