#!/usr/bin/python3
"""
Autopkgtest for flowblade package.
Tests basic import functionality and numpy integration.
"""

import sys

def test_basic_imports():
    """Test that flowblade modules can be imported."""
    print("Testing basic flowblade imports...")
    
    try:
        # Test numpy import (the main dependency we're testing)
        import numpy
        print("✓ numpy imported successfully")
        
        # Test other critical dependencies
        import cairo
        print("✓ cairo imported successfully")
        
        import PIL
        print("✓ PIL imported successfully")
        
        import cv2
        print("✓ opencv (cv2) imported successfully")
        
        # Test that numpy works with basic operations
        arr = numpy.array([1, 2, 3, 4, 5])
        assert arr.sum() == 15, "numpy array operations failed"
        print("✓ numpy array operations work correctly")
        
        # Test numpy dtype functionality
        arr_float = numpy.array([1.0, 2.0, 3.0], dtype=numpy.float64)
        assert arr_float.dtype == numpy.float64, "numpy dtype handling failed"
        print("✓ numpy dtype handling works correctly")
        
        print("\nAll import tests passed successfully!")
        return 0
        
    except ImportError as e:
        print(f"✗ Import failed: {e}", file=sys.stderr)
        return 1
    except AssertionError as e:
        print(f"✗ Test assertion failed: {e}", file=sys.stderr)
        return 1
    except Exception as e:
        print(f"✗ Unexpected error: {e}", file=sys.stderr)
        return 1

if __name__ == "__main__":
    sys.exit(test_basic_imports())
