fix(schemas): use enum types as field types + enforce symbol length
- Replace all Literal[...] type annotations with corresponding enum classes (TickerAction, TimeHorizon, MarketOutlook, VideoStatus, TranscriptSource) for MeetKevinTickerMention, MeetKevinAnalysis, and API response models (VideoSummary, VideoDetail, StockMention, StockSummary, TimelineBucket) - Add min_length=1, max_length=10 validation to MeetKevinTickerMention.symbol - Split test_conviction_edge_cases into two separate boundary tests - Strengthen test_valid_ticker_mention with assertions for all 6 fields - Trim no-information docstrings from TranscriptSegment, StockTimeline - All 60 schema tests pass
This commit is contained in:
parent
75534de71b
commit
8a412e6ae9
2 changed files with 24 additions and 31 deletions
|
|
@ -593,7 +593,7 @@ class TestTokenResponse:
|
|||
|
||||
class TestMeetKevinTickerMention:
|
||||
def test_valid_ticker_mention(self) -> None:
|
||||
from shared.schemas.meet_kevin import MeetKevinTickerMention
|
||||
from shared.schemas.meet_kevin import MeetKevinTickerMention, TickerAction, TimeHorizon
|
||||
|
||||
mention = MeetKevinTickerMention(
|
||||
symbol="AAPL",
|
||||
|
|
@ -604,7 +604,11 @@ class TestMeetKevinTickerMention:
|
|||
video_timestamp_seconds=120,
|
||||
)
|
||||
assert mention.symbol == "AAPL"
|
||||
assert mention.action == TickerAction.BUY
|
||||
assert mention.conviction == 0.85
|
||||
assert mention.time_horizon == TimeHorizon.MONTHS
|
||||
assert mention.rationale_quote == "Strong earnings growth expected"
|
||||
assert mention.video_timestamp_seconds == 120
|
||||
|
||||
def test_symbol_auto_uppercases(self) -> None:
|
||||
from shared.schemas.meet_kevin import MeetKevinTickerMention
|
||||
|
|
@ -642,28 +646,29 @@ class TestMeetKevinTickerMention:
|
|||
rationale_quote="Negative conviction",
|
||||
)
|
||||
|
||||
def test_conviction_edge_cases(self) -> None:
|
||||
def test_conviction_boundary_zero_valid(self) -> None:
|
||||
from shared.schemas.meet_kevin import MeetKevinTickerMention
|
||||
|
||||
# Test 0.0
|
||||
m1 = MeetKevinTickerMention(
|
||||
m = MeetKevinTickerMention(
|
||||
symbol="GOOG",
|
||||
action="avoid",
|
||||
conviction=0.0,
|
||||
time_horizon="unspecified",
|
||||
rationale_quote="No confidence",
|
||||
)
|
||||
assert m1.conviction == 0.0
|
||||
assert m.conviction == 0.0
|
||||
|
||||
# Test 1.0
|
||||
m2 = MeetKevinTickerMention(
|
||||
def test_conviction_boundary_one_valid(self) -> None:
|
||||
from shared.schemas.meet_kevin import MeetKevinTickerMention
|
||||
|
||||
m = MeetKevinTickerMention(
|
||||
symbol="MSFT",
|
||||
action="buy",
|
||||
conviction=1.0,
|
||||
time_horizon="long_term",
|
||||
rationale_quote="Maximum confidence",
|
||||
)
|
||||
assert m2.conviction == 1.0
|
||||
assert m.conviction == 1.0
|
||||
|
||||
def test_timestamp_optional(self) -> None:
|
||||
from shared.schemas.meet_kevin import MeetKevinTickerMention
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue