Files
Text-Texture-Generator-for-…/tests/unit/test_imports.py
2025-10-13 00:10:24 +02:00

37 lines
1.4 KiB
Python

"""Unit tests for import integrity of renamed/removed symbols."""
import pytest
import sys
from pathlib import Path
# Add src to path for imports
src_path = Path(__file__).parent.parent.parent / "src"
sys.path.insert(0, str(src_path))
def test_has_multiline_text_not_importable():
"""Ensure has_multiline_text was fully removed."""
with pytest.raises(ImportError, match="cannot import name 'has_multiline_text'"):
from utils.constants import has_multiline_text
def test_has_text_editor_not_importable():
"""Ensure has_text_editor helper was removed with the multiline feature."""
with pytest.raises(ImportError, match="cannot import name 'has_text_editor'"):
from utils.constants import has_text_editor
def test_new_operator_name_imports_from_operators():
"""Test that TEXT_TEXTURE_OT_edit_text (NEW name) can be imported from operators."""
from src.operators import TEXT_TEXTURE_OT_edit_text
# Verify it's a Blender operator class
assert hasattr(TEXT_TEXTURE_OT_edit_text, 'bl_idname')
assert TEXT_TEXTURE_OT_edit_text.bl_idname == 'text_texture.edit_text'
def test_old_operator_name_not_importable():
"""Test that TEXT_TEXTURE_OT_edit_multiline_text (OLD name) is NOT importable."""
with pytest.raises(ImportError, match="cannot import name 'TEXT_TEXTURE_OT_edit_multiline_text'"):
from src.operators import TEXT_TEXTURE_OT_edit_multiline_text