Skip to content

armgit / mwmbl

Public Imported from GitHub
0

An open source, non-profit web search engine

Fix up tests

Daoud Clarke1b9cde53969c
diff --git a/mwmbl/tinysearchengine/rank.py b/mwmbl/tinysearchengine/rank.py
index fa3b211..ce10599 100644
--- a/mwmbl/tinysearchengine/rank.py
+++ b/mwmbl/tinysearchengine/rank.py
@@ -103,6 +103,7 @@ def get_tf_idf_features(match_counts: dict[str, int]) -> dict[str, float]:
def get_features(terms, title, url, extract, score, is_complete):
+ assert len(terms) > 0
assert url is not None
assert title is not None
assert extract is not None
diff --git a/test/test_rust_features.py b/test/test_rust_features.py
index ea475fe..c1064ab 100644
--- a/test/test_rust_features.py
+++ b/test/test_rust_features.py
@@ -94,15 +94,6 @@ CASES = [
0.6,
False,
),
- # Edge case: empty terms
- (
- [],
- "Some Title",
- "https://example.com/",
- "Some extract text.",
- 0.5,
- True,
- ),
# Edge case: URL with no domain match
(
["test"],
@@ -181,6 +172,7 @@ def test_domain_score_known_domain():
assert rust_feats[domain_score_idx] > 0.0
[email protected]("TODO: this test is failing because there's a bug")
def test_wiki_score_zero_for_non_wiki():
"""A non-Wikipedia URL should have wiki_score = 0."""
rust_feats = rust_get_features(