This commit was merged in pull request #376.
This commit is contained in:
@@ -19,6 +19,53 @@ def _reset_session_singleton():
|
||||
mod._agent = None
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# _annotate_confidence() helper
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
class TestAnnotateConfidence:
|
||||
"""Unit tests for the DRY confidence annotation helper."""
|
||||
|
||||
def test_below_threshold_adds_tag(self):
|
||||
from timmy.session import _annotate_confidence
|
||||
|
||||
result = _annotate_confidence("Hello world", 0.55)
|
||||
assert "[confidence: 55%]" in result
|
||||
|
||||
def test_above_threshold_no_tag(self):
|
||||
from timmy.session import _annotate_confidence
|
||||
|
||||
result = _annotate_confidence("Hello world", 0.85)
|
||||
assert "[confidence:" not in result
|
||||
assert result == "Hello world"
|
||||
|
||||
def test_at_threshold_no_tag(self):
|
||||
from timmy.session import _annotate_confidence
|
||||
|
||||
result = _annotate_confidence("Hello world", 0.7)
|
||||
assert "[confidence:" not in result
|
||||
|
||||
def test_none_confidence_no_tag(self):
|
||||
from timmy.session import _annotate_confidence
|
||||
|
||||
result = _annotate_confidence("Hello world", None)
|
||||
assert "[confidence:" not in result
|
||||
assert result == "Hello world"
|
||||
|
||||
def test_zero_confidence_adds_tag(self):
|
||||
from timmy.session import _annotate_confidence
|
||||
|
||||
result = _annotate_confidence("Hello world", 0.0)
|
||||
assert "[confidence: 0%]" in result
|
||||
|
||||
def test_preserves_original_text(self):
|
||||
from timmy.session import _annotate_confidence
|
||||
|
||||
result = _annotate_confidence("Original text here", 0.3)
|
||||
assert result.startswith("Original text here")
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# chat()
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user