Files
last30days-skill/tests/test_normalize_v3.py
T
Matt Van Horn 0a9ff16dfc feat: v3.0.0 - intelligent search, GitHub person/project mode, ELI5, 13+ sources
v3 rewrites the search engine from the ground up:

- Intelligent pre-research: resolves X handles, GitHub repos, subreddits,
  TikTok hashtags, and YouTube channels before searching
- GitHub person-mode: PR velocity, top repos by stars, release notes
- GitHub project-mode: live star counts, README, releases, top issues
- ELI5 mode: plain language synthesis, no jargon
- 13+ sources: Reddit, X, YouTube, TikTok, Instagram, HN, Polymarket,
  GitHub, Threads, Pinterest, Perplexity, Bluesky, Web
- Free Reddit comments via public JSON (no API key needed)
- Fun judge v2: humor scoring baked into narrative
- Cookie consent before browser scanning
- 10,000 free ScrapeCreators calls
- 1,012 tests

Thank you to the community contributors whose issues and PRs shaped v3:
@uppinote20 (#143), @zerone0x (#134, #136), @thinkun (#116),
@thomasmktong (#124), @fanispoulinakisai-boop (#100), @pejmanjohn (#78),
@zl190 (#115), @hnshah (#84, #85, #86)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-08 10:52:23 -07:00

72 lines
2.1 KiB
Python

import sys
import unittest
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "scripts"))
from lib import normalize
class NormalizeV3Tests(unittest.TestCase):
def test_youtube_evergreen_fallback_keeps_older_items_when_recent_pool_is_empty(self):
items = [
{
"video_id": "vid-1",
"title": "Deploy to Fly.io tutorial",
"url": "https://youtube.com/watch?v=vid-1",
"channel_name": "Example",
"date": "2026-01-10",
"engagement": {"views": 1000, "likes": 50, "comments": 10},
}
]
normalized = normalize.normalize_source_items(
"youtube",
items,
"2026-02-15",
"2026-03-17",
freshness_mode="evergreen_ok",
)
self.assertEqual(1, len(normalized))
self.assertEqual("2026-01-10", normalized[0].published_at)
def test_grounding_still_drops_older_items_in_evergreen_mode(self):
items = [
{
"id": "g-1",
"title": "Fly.io guide",
"url": "https://example.com/fly-guide",
"date": "2026-01-08",
"date_confidence": "high",
"snippet": "Step-by-step guide.",
}
]
normalized = normalize.normalize_source_items(
"grounding",
items,
"2026-02-15",
"2026-03-17",
freshness_mode="evergreen_ok",
)
self.assertEqual([], normalized)
def test_grounding_requires_a_usable_date(self):
items = [
{
"id": "g-1",
"title": "Undated result",
"url": "https://example.com/undated",
"snippet": "No date attached.",
}
]
normalized = normalize.normalize_source_items(
"grounding",
items,
"2026-02-15",
"2026-03-17",
)
self.assertEqual([], normalized)
if __name__ == "__main__":
unittest.main()