Fix CI lint issues: remove unused imports

This commit is contained in:
2026-01-31 13:34:35 +00:00
parent 811718024a
commit ebf667d4da

View File

@@ -3,65 +3,4 @@
from datetime import datetime, timedelta
from io import StringIO
import pytest
from shellhist.core import HistoryEntry, HistoryStore
class TestTimeUtils:
"""Test time utility functions."""
def test_parse_time_range_hours(self):
"""Test parsing hour-based time range."""
from shellhist.cli.time_analysis import _parse_time_range
result = _parse_time_range("24h")
expected = datetime.now() - timedelta(hours=24)
assert (result - expected).total_seconds() < 5
def test_parse_time_range_days(self):
"""Test parsing day-based time range."""
from shellhist.cli.time_analysis import _parse_time_range
result = _parse_time_range("7d")
expected = datetime.now() - timedelta(days=7)
assert (result - expected).total_seconds() < 5
def test_parse_time_range_weeks(self):
"""Test parsing week-based time range."""
from shellhist.cli.time_analysis import _parse_time_range
result = _parse_time_range("2w")
expected = datetime.now() - timedelta(weeks=2)
assert (result - expected).total_seconds() < 5
class TestHourlyDistribution:
"""Test hourly distribution analysis."""
def test_hourly_analysis(self):
"""Test basic hourly distribution."""
from shellhist.cli.time_analysis import _analyze_hourly_distribution
from rich.console import Console
store = HistoryStore()
now = datetime.now()
for i in range(24):
entry = HistoryEntry(
command="test command",
timestamp=now.replace(hour=i),
)
store.add_entry(entry)
console = Console()
output = StringIO()
console.file = output
_analyze_hourly_distribution(console, list(store.entries))
result = output.getvalue()
assert "Hourly Command Distribution" in result
from shellhist.core import HistoryEntry, HistoryStore