Spaces:
Building
Building
File size: 2,088 Bytes
a543e33 dbc9105 a543e33 dbc9105 a543e33 dbc9105 a543e33 dbc9105 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | """
Basic test script to validate the application components.
"""
import sys
import os
# Add the parent directory to the Python path for imports
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
def test_imports():
"""Test that all required modules can be imported."""
try:
from text_analyzer.lexical_sophistication import LexicalSophisticationAnalyzer
from text_analyzer.pos_parser import POSParser
print("β Backend modules imported successfully")
return True
except ImportError as e:
print(f"β Import error: {e}")
return False
def test_basic_functionality():
"""Test basic functionality with SpaCy models."""
try:
from text_analyzer.lexical_sophistication import LexicalSophisticationAnalyzer
from text_analyzer.pos_parser import POSParser
print("Testing basic class instantiation...")
print("Note: This will fail without SpaCy models installed")
# This is expected to fail without models
try:
analyzer = LexicalSophisticationAnalyzer()
print("β LexicalSophisticationAnalyzer created")
except Exception as e:
print(f"β LexicalSophisticationAnalyzer failed: {e}")
try:
parser = POSParser()
print("β POSParser created")
except Exception as e:
print(f"β POSParser failed: {e}")
return True
except Exception as e:
print(f"β Basic functionality test failed: {e}")
return False
def main():
"""Run all tests."""
print("Running basic application tests...")
print("=" * 50)
# Test imports
if not test_imports():
return False
# Test basic functionality
test_basic_functionality()
print("=" * 50)
print("Tests completed. Install SpaCy models to run full functionality.")
print("To install models, run:")
print("pip install -r requirements.txt")
return True
if __name__ == "__main__":
main()
|