0a9ff16dfc
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>
59 lines
1.8 KiB
Python
59 lines
1.8 KiB
Python
import sys
|
|
import unittest
|
|
from pathlib import Path
|
|
|
|
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "scripts"))
|
|
|
|
from lib import entity_extract
|
|
|
|
|
|
class TestExtractSubreddits(unittest.TestCase):
|
|
def test_extracts_primary_subreddit(self):
|
|
items = [{"subreddit": "r/MachineLearning"}]
|
|
result = entity_extract._extract_subreddits(items)
|
|
self.assertIn("MachineLearning", result)
|
|
|
|
def test_extracts_subreddit_without_prefix(self):
|
|
items = [{"subreddit": "localLLaMA"}]
|
|
result = entity_extract._extract_subreddits(items)
|
|
self.assertIn("localLLaMA", result)
|
|
|
|
def test_extracts_cross_references_from_comment_insights(self):
|
|
items = [
|
|
{
|
|
"subreddit": "technology",
|
|
"comment_insights": ["check out r/MachineLearning and r/LocalLLaMA for more"],
|
|
}
|
|
]
|
|
result = entity_extract._extract_subreddits(items)
|
|
self.assertIn("MachineLearning", result)
|
|
self.assertIn("LocalLLaMA", result)
|
|
|
|
def test_extracts_cross_references_from_top_comments(self):
|
|
items = [
|
|
{
|
|
"subreddit": "AI",
|
|
"top_comments": [
|
|
{"excerpt": "see r/StableDiffusion for image gen stuff"},
|
|
],
|
|
}
|
|
]
|
|
result = entity_extract._extract_subreddits(items)
|
|
self.assertIn("StableDiffusion", result)
|
|
|
|
def test_ranks_by_frequency(self):
|
|
items = [
|
|
{"subreddit": "A"},
|
|
{"subreddit": "A"},
|
|
{"subreddit": "B"},
|
|
]
|
|
result = entity_extract._extract_subreddits(items)
|
|
self.assertEqual(result[0], "A")
|
|
|
|
def test_empty_items(self):
|
|
self.assertEqual([], entity_extract._extract_subreddits([]))
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|