import pytest
from cyclone.parsers.exceptions import CycloneParseError, CycloneValidationError


def test_parse_error_carries_segment_index():
    err = CycloneParseError("bad CLM", segment_index=42)
    assert err.segment_index == 42
    assert "bad CLM" in str(err)
    assert "segment 42" in str(err)


def test_validation_error_carries_rule_id():
    err = CycloneValidationError("NPI bad", rule_id="R020_npi_format", claim_id="C1")
    assert err.rule_id == "R020_npi_format"
    assert err.claim_id == "C1"
    assert "[R020_npi_format]" in str(err)


def test_parse_error_inherits_from_exception():
    assert issubclass(CycloneParseError, Exception)
    assert issubclass(CycloneValidationError, Exception)
