Files
autocad-mcp-pro/tests/test_dimensions.py
T
Umutcan Edizsalan 0c7f64ceb6 fix(correctness-bundle): I16 correctness fixes + dead code removal + ruff clean
N1: COM hatch non-associative (AddHatch associativity=False)
N2: ezdxf refuses DWG saves with clear error; server.py derives fmt from extension
R19: dimension_aligned dist→distance; dimension_angular correct add_angular_dim_2l args (base/line1/line2/location)
R9: polar array 360° no-duplicate (divisor=n when fill_angle%360<ε)
R13: entity_offset side_x/side_y honored in ezdxf via cross-product (LINE) and distance-to-center (CIRCLE)
R18: drawing_new bootstrap failure surfaces status="degraded" instead of swallowing silently
Dead code: engineering/section.py, gear.generate_tooth_profile, CommandResult, _ACI_NAMES, set_layer_active, ensure_linetypes, ComBackend._batch_mode instance attr, engineering/__init__ build-seam comment
Ruff: 38 auto-fixed + 5 manual → codebase is now ruff-clean; CI lint is now blocking

184 tests pass.
2026-06-18 11:34:30 +03:00

39 lines
1.1 KiB
Python

"""Tests for dimension creation via ezdxf backend."""
from __future__ import annotations
import pytest
pytestmark = pytest.mark.asyncio
async def test_dimension_linear(backend):
info = await backend.dimension_linear(0, 0, 100, 0, 50, 20, rotation=0)
assert info.handle
assert info.type == "DIMENSION"
async def test_dimension_aligned(backend):
info = await backend.dimension_aligned(0, 0, 100, 50, 50, 60)
assert info.handle
assert info.type == "DIMENSION"
async def test_dimension_angular(backend):
info = await backend.dimension_angular(0, 0, 100, 0, 0, 100, 50, 50)
assert info.handle
assert info.type == "DIMENSION"
async def test_dimension_radius(backend):
await backend.entity_create_circle(50, 50, 30)
info = await backend.dimension_radius(50, 50, 80, 50, leader_length=15)
assert info.handle
assert info.type == "DIMENSION"
async def test_dimension_diameter(backend):
info = await backend.dimension_diameter(20, 50, 80, 50, leader_length=10)
assert info.handle
assert info.type == "DIMENSION"