55 lines
1.7 KiB
Python
55 lines
1.7 KiB
Python
|
|
"""Basic tests for CAD-Documenter pipeline."""
|
||
|
|
|
||
|
|
import pytest
|
||
|
|
from pathlib import Path
|
||
|
|
|
||
|
|
|
||
|
|
def test_imports():
|
||
|
|
"""Test that all modules can be imported."""
|
||
|
|
from cad_documenter import __version__
|
||
|
|
from cad_documenter.cli import main
|
||
|
|
from cad_documenter.pipeline import DocumentationPipeline
|
||
|
|
from cad_documenter.video_processor import VideoProcessor
|
||
|
|
from cad_documenter.audio_analyzer import AudioAnalyzer
|
||
|
|
from cad_documenter.vision_analyzer import VisionAnalyzer
|
||
|
|
from cad_documenter.doc_generator import DocGenerator
|
||
|
|
|
||
|
|
assert __version__ == "0.1.0"
|
||
|
|
|
||
|
|
|
||
|
|
def test_transcript_dataclass():
|
||
|
|
"""Test Transcript dataclass functionality."""
|
||
|
|
from cad_documenter.audio_analyzer import Transcript, TranscriptSegment
|
||
|
|
|
||
|
|
segments = [
|
||
|
|
TranscriptSegment(start=0.0, end=5.0, text="This is the main bracket"),
|
||
|
|
TranscriptSegment(start=5.0, end=10.0, text="It holds the motor"),
|
||
|
|
TranscriptSegment(start=10.0, end=15.0, text="Made of aluminum"),
|
||
|
|
]
|
||
|
|
|
||
|
|
transcript = Transcript(segments=segments, full_text="This is the main bracket. It holds the motor. Made of aluminum.")
|
||
|
|
|
||
|
|
# Test get_text_at
|
||
|
|
text = transcript.get_text_at(7.0, window=3.0)
|
||
|
|
assert "holds the motor" in text
|
||
|
|
assert "main bracket" in text
|
||
|
|
|
||
|
|
|
||
|
|
def test_component_dataclass():
|
||
|
|
"""Test Component dataclass."""
|
||
|
|
from cad_documenter.vision_analyzer import Component
|
||
|
|
|
||
|
|
component = Component(
|
||
|
|
name="Main Bracket",
|
||
|
|
description="Primary structural member",
|
||
|
|
function="Holds the motor",
|
||
|
|
material="Aluminum 6061-T6",
|
||
|
|
features=["4x M6 holes", "Fillet radii"],
|
||
|
|
)
|
||
|
|
|
||
|
|
assert component.name == "Main Bracket"
|
||
|
|
assert len(component.features) == 2
|
||
|
|
|
||
|
|
|
||
|
|
# TODO: Add integration tests with sample videos
|