#!/usr/bin/env python3
"""
Minimal test of the pywasot library.
"""

import sys
sys.path.insert(0, 'python')

print("Testing basic pywasot import...")
try:
    from pywasot import Parser
    print("✓ Import successful")
except Exception as e:
    print(f"✗ Import failed: {e}")
    import traceback
    traceback.print_exc()
    sys.exit(1)

print("Testing parser creation...")
try:
    class TestParser(Parser):
        def on_block_started(self, event):
            print(f"Block started: {event.meta_line.type_name}")
        
        def on_text(self, event):
            print(f"Text: {event.lines}")
        
        def on_block_finished(self, event):
            print("Block finished")
    
    parser = TestParser()
    print("✓ Parser created")
except Exception as e:
    print(f"✗ Parser creation failed: {e}")
    import traceback
    traceback.print_exc()
    sys.exit(1)

print("Testing simple parsing...")
try:
    simple_content = ".div\nText content\n./"
    print(f"Parsing: {repr(simple_content)}")
    parser.parse_string(simple_content)
    print("✓ Parsing completed")
except Exception as e:
    print(f"✗ Parsing failed: {e}")
    import traceback
    traceback.print_exc()
    sys.exit(1)

print("All tests passed!")