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>
45 lines
1.6 KiB
Python
45 lines
1.6 KiB
Python
import sys
|
|
import unittest
|
|
from pathlib import Path
|
|
|
|
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "scripts"))
|
|
|
|
from lib import query
|
|
|
|
|
|
class QueryV3Tests(unittest.TestCase):
|
|
def test_extract_core_subject_strips_prefix_and_noise(self):
|
|
result = query.extract_core_subject("What are the best Claude Code skills for startups?")
|
|
self.assertEqual("claude code startups", result)
|
|
|
|
def test_extract_core_subject_supports_suffix_stripping_and_max_words(self):
|
|
result = query.extract_core_subject(
|
|
"How to use Claude Code prompting techniques",
|
|
strip_suffixes=True,
|
|
max_words=2,
|
|
)
|
|
self.assertEqual("claude code", result)
|
|
|
|
def test_extract_core_subject_preserves_original_when_noise_removes_everything(self):
|
|
result = query.extract_core_subject("all tokens", noise=frozenset({"all", "tokens"}))
|
|
self.assertEqual("all tokens", result)
|
|
|
|
def test_extract_core_subject_handles_empty_query_and_custom_noise(self):
|
|
self.assertEqual("", query.extract_core_subject(" "))
|
|
result = query.extract_core_subject(
|
|
"OpenClaw release notes",
|
|
noise=frozenset({"release"}),
|
|
max_words=2,
|
|
)
|
|
self.assertEqual("openclaw notes", result)
|
|
|
|
def test_extract_compound_terms_finds_hyphenated_and_title_cased_phrases(self):
|
|
terms = query.extract_compound_terms("Best multi-agent patterns in Claude Code and React Native")
|
|
self.assertIn("multi-agent", terms)
|
|
self.assertIn("Claude Code", terms)
|
|
self.assertIn("React Native", terms)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|