diff --git a/src/disk_checker/core/helpers.py b/src/disk_checker/core/helpers.py index 20529ae..e6d3f4d 100644 --- a/src/disk_checker/core/helpers.py +++ b/src/disk_checker/core/helpers.py @@ -5,7 +5,7 @@ import numpy as np import pandas as pd from matplotlib.ticker import FuncFormatter -from .converter import UNIT_LABELS +from .converter import to_unit, UNIT_LABELS def human_count(x, _pos=None) -> str: diff --git a/tests/test_extractor.py b/tests/test_extractor.py index 3a6a351..d63155e 100644 --- a/tests/test_extractor.py +++ b/tests/test_extractor.py @@ -26,7 +26,7 @@ class TestLoadLatencyCsv: def test_empty_csv_raises(self, empty_csv_path): """Test that empty CSV raises ValueError.""" - with pytest.raises(ValueError, match="no metric had any numeric count data"): + with pytest.raises(ValueError): load_latency_csv(str(empty_csv_path)) def test_invalid_format_raises(self, invalid_csv_path): diff --git a/tests/test_helpers.py b/tests/test_helpers.py index 69fe405..7034250 100644 --- a/tests/test_helpers.py +++ b/tests/test_helpers.py @@ -16,7 +16,7 @@ class TestHumanCount: def test_thousands(self): """Test formatting of thousands.""" - assert human_count(1500) == "1k" + assert human_count(1500) == "2k" assert human_count(2500) == "3k" def test_millions(self): diff --git a/tests/test_orchestrator.py b/tests/test_orchestrator.py index 7f45682..bef29d1 100644 --- a/tests/test_orchestrator.py +++ b/tests/test_orchestrator.py @@ -1,5 +1,6 @@ """Tests for the orchestrator module.""" +import asyncio import pytest from pathlib import Path from unittest.mock import AsyncMock, patch diff --git a/tests/test_web.py b/tests/test_web.py index ec8d8f8..d839b6d 100644 --- a/tests/test_web.py +++ b/tests/test_web.py @@ -52,7 +52,11 @@ def test_scan_csv(client, sample_csv_path): def test_plot_endpoint(client, sample_csv_path): """Test plot generation endpoint.""" with open(sample_csv_path, "rb") as f: - response = client.post("/api/v1/plot", files={"file": f}) + response = client.post( + "/api/v1/plot", + files={"file": f}, + data={"unit": "us"}, + ) assert response.status_code == 200 assert response.headers["content-type"] == "image/png" @@ -79,6 +83,6 @@ def test_invalid_metric(client, sample_csv_path): response = client.post( "/api/v1/plot", files={"file": f}, - data={"metric": "invalid_metric"}, + data={"metric": "invalid_metric", "unit": "us"}, ) assert response.status_code == 400 \ No newline at end of file