"""Tests for BOM tools.""" import csv import pytest @pytest.mark.unit def test_analyze_bom_no_csv(project_path): """analyze_bom with no CSV files should return empty results gracefully.""" from mckicad.tools.bom import analyze_bom result = analyze_bom(project_path) # Should succeed but find no data assert isinstance(result, dict) @pytest.mark.unit def test_analyze_bom_with_csv(tmp_project_dir, project_path): """analyze_bom should parse a BOM CSV file.""" from mckicad.tools.bom import analyze_bom # Create a simple BOM CSV bom_path = tmp_project_dir / "test_project-bom.csv" with open(bom_path, "w", newline="") as f: writer = csv.writer(f) writer.writerow(["Reference", "Value", "Footprint", "Qty"]) writer.writerow(["R1", "10k", "0805", "1"]) writer.writerow(["R2", "4.7k", "0805", "1"]) writer.writerow(["C1", "100nF", "0805", "1"]) result = analyze_bom(project_path) assert isinstance(result, dict)