import pytest from pydantic import ValidationError from src.domain.schemas import MembershipRowCreate, MembershipRowUpdate, OrganizationCreate, RefOrgTypeCreate def test_ref_org_type_validates_type_code_length(): with pytest.raises(ValidationError): RefOrgTypeCreate( type_code="TOO_LONG_CODE", type_name="Test type", description="Test description", ) def test_membership_create_rejects_share_pct_above_100(): with pytest.raises(ValidationError): MembershipRowCreate( group_id="GK001", org_id=1, share_pct=150, ) def test_membership_update_rejects_negative_share_pct(): with pytest.raises(ValidationError): MembershipRowUpdate(share_pct=-0.1) def test_organization_create_rejects_too_short_inn(): with pytest.raises(ValidationError): OrganizationCreate( inn="123456789", kpp="770101001", full_name="ООО Тест", org_type_code="UL", is_resident=True, )