test: add -> None return type annotations to all test methods
This commit is contained in:
@@ -8,7 +8,7 @@ from shellhist.core.search import fuzzy_search, rank_by_frequency
|
||||
class TestFuzzySearch:
|
||||
"""Test fuzzy search functionality."""
|
||||
|
||||
def setup_method(self):
|
||||
def setup_method(self) -> None:
|
||||
"""Set up test fixtures."""
|
||||
self.store = HistoryStore()
|
||||
|
||||
@@ -29,32 +29,32 @@ class TestFuzzySearch:
|
||||
entry = HistoryEntry(command=cmd, line_number=i)
|
||||
self.store.add_entry(entry)
|
||||
|
||||
def test_basic_search(self):
|
||||
def test_basic_search(self) -> None:
|
||||
"""Test basic fuzzy search."""
|
||||
results = fuzzy_search(self.store, "git status", threshold=50)
|
||||
|
||||
assert len(results) > 0
|
||||
assert any(r[0].command == "git status" for r in results)
|
||||
|
||||
def test_search_with_threshold(self):
|
||||
def test_search_with_threshold(self) -> None:
|
||||
"""Test search with custom threshold."""
|
||||
results = fuzzy_search(self.store, "git commit message", threshold=80)
|
||||
|
||||
assert all(r[1] >= 80 for r in results)
|
||||
|
||||
def test_search_no_match(self):
|
||||
def test_search_no_match(self) -> None:
|
||||
"""Test search with no matches."""
|
||||
results = fuzzy_search(self.store, "xyz123nonexistent", threshold=70)
|
||||
|
||||
assert len(results) == 0
|
||||
|
||||
def test_search_limit(self):
|
||||
def test_search_limit(self) -> None:
|
||||
"""Test search result limit."""
|
||||
results = fuzzy_search(self.store, "git", threshold=50, limit=3)
|
||||
|
||||
assert len(results) <= 3
|
||||
|
||||
def test_search_reverse_sort(self):
|
||||
def test_search_reverse_sort(self) -> None:
|
||||
"""Test search with reverse sorting."""
|
||||
results_normal = fuzzy_search(self.store, "git", threshold=50, reverse=False)
|
||||
results_reverse = fuzzy_search(self.store, "git", threshold=50, reverse=True)
|
||||
@@ -62,7 +62,7 @@ class TestFuzzySearch:
|
||||
if len(results_normal) > 1:
|
||||
assert results_normal != results_reverse
|
||||
|
||||
def test_search_recent_boost(self):
|
||||
def test_search_recent_boost(self) -> None:
|
||||
"""Test that recent commands get boosted."""
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
@@ -92,7 +92,7 @@ class TestFuzzySearch:
|
||||
class TestRankByFrequency:
|
||||
"""Test frequency ranking functionality."""
|
||||
|
||||
def setup_method(self):
|
||||
def setup_method(self) -> None:
|
||||
"""Set up test fixtures."""
|
||||
self.store = HistoryStore()
|
||||
|
||||
@@ -104,7 +104,7 @@ class TestRankByFrequency:
|
||||
|
||||
self.store.add_entry(HistoryEntry(command="ls"))
|
||||
|
||||
def test_rank_by_frequency(self):
|
||||
def test_rank_by_frequency(self) -> None:
|
||||
"""Test ranking results by frequency."""
|
||||
entry = HistoryEntry(command="git status")
|
||||
results = [(entry, 100)]
|
||||
@@ -114,7 +114,7 @@ class TestRankByFrequency:
|
||||
assert len(ranked) == 1
|
||||
assert ranked[0][2] == 5
|
||||
|
||||
def test_rank_multiple(self):
|
||||
def test_rank_multiple(self) -> None:
|
||||
"""Test ranking multiple results."""
|
||||
entry1 = HistoryEntry(command="git status")
|
||||
entry2 = HistoryEntry(command="git log")
|
||||
|
||||
Reference in New Issue
Block a user