48 lines
1.7 KiB
Python
48 lines
1.7 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_function_complete():
|
|
"""Test that has_multiline_text() is a complete function with body."""
|
|
from utils.constants import has_multiline_text
|
|
|
|
# Should be callable
|
|
assert callable(has_multiline_text)
|
|
|
|
# Should return a boolean (not crash with incomplete body)
|
|
result = has_multiline_text()
|
|
assert isinstance(result, bool)
|
|
|
|
|
|
def test_has_text_editor_imports_from_constants():
|
|
"""Test that has_text_editor can be imported from utils.constants."""
|
|
from utils.constants import has_text_editor
|
|
|
|
# Verify it's callable (should be a function)
|
|
assert callable(has_text_editor)
|
|
|
|
# Should return a boolean without crashing
|
|
result = has_text_editor()
|
|
assert isinstance(result, bool)
|
|
|
|
|
|
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 |