Files
wehub-resource-sync 2860fb5d18
Security / Dependency review (push) Has been skipped
Scorecard / Scorecard analysis (push) Failing after 0s
Validate / eval (push) Failing after 0s
Security / Dependency audit (push) Failing after 1s
Security / Secret scan (push) Failing after 1s
Validate / tests (push) Failing after 0s
Validate / mcp-tests (push) Failing after 1s
GitHub Actions Security Analysis with zizmor 🌈 / zizmor (push) Failing after 1s
Security / SAST scan (push) Failing after 13m52s
chore: import upstream snapshot with attribution
2026-07-13 12:05:33 +08:00

40 lines
1.5 KiB
Python

import unittest
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()