Skip to content

Commit

Permalink
update test file
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-gtokernliang committed Jan 3, 2025
1 parent 5519a61 commit 83c4d06
Showing 1 changed file with 0 additions and 47 deletions.
47 changes: 0 additions & 47 deletions tests/unit/test_otel_instrument.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
Tests for OTEL instrument decorator.
"""

from unittest import TestCase
from unittest import main

import pandas as pd
Expand All @@ -12,8 +11,6 @@
from trulens.core.session import TruSession
from trulens.experimental.otel_tracing.core.init import init
from trulens.experimental.otel_tracing.core.instrument import instrument
from trulens.experimental.otel_tracing.core.span import validate_selector_name
from trulens.otel.semconv.trace import SpanAttributes

from tests.test import TruTestCase
from tests.util.df_comparison import (
Expand Down Expand Up @@ -142,49 +139,5 @@ def test_instrument_decorator(self) -> None:
)


class TestOtelValidation(TestCase):
def test_validate_selector_name(self):
with self.subTest("No selector name"):
self.assertEqual(
validate_selector_name({}),
{},
)

with self.subTest(
f"Both {SpanAttributes.SELECTOR_NAME_KEY} and {SpanAttributes.SELECTOR_NAME} cannot be set."
):
self.assertRaises(
ValueError,
validate_selector_name,
{
SpanAttributes.SELECTOR_NAME_KEY: "key",
SpanAttributes.SELECTOR_NAME: "name",
},
)

with self.subTest("Non-string"):
self.assertRaises(
ValueError,
validate_selector_name,
{
SpanAttributes.SELECTOR_NAME_KEY: 42,
},
)

with self.subTest(f"Valid {SpanAttributes.SELECTOR_NAME}"):
self.assertEqual(
validate_selector_name({SpanAttributes.SELECTOR_NAME: "name"}),
{SpanAttributes.SELECTOR_NAME_KEY: "name"},
)

with self.subTest(f"Valid {SpanAttributes.SELECTOR_NAME_KEY}"):
self.assertEqual(
validate_selector_name({
SpanAttributes.SELECTOR_NAME_KEY: "name"
}),
{SpanAttributes.SELECTOR_NAME_KEY: "name"},
)


if __name__ == "__main__":
main()

0 comments on commit 83c4d06

Please sign in to comment.