Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

simple_boolean_test.py 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #!/usr/bin/env python3
  2. """
  3. Simple test to verify boolean classes can be imported correctly.
  4. """
  5. import sys
  6. import os
  7. # Add the api directory to the Python path
  8. sys.path.insert(0, os.path.join(os.path.dirname(__file__), "api"))
  9. try:
  10. # Test that we can import the boolean classes
  11. from core.variables.segments import BooleanSegment, ArrayBooleanSegment
  12. from core.variables.variables import BooleanVariable, ArrayBooleanVariable
  13. from core.variables.types import SegmentType
  14. print("✅ Successfully imported BooleanSegment")
  15. print("✅ Successfully imported ArrayBooleanSegment")
  16. print("✅ Successfully imported BooleanVariable")
  17. print("✅ Successfully imported ArrayBooleanVariable")
  18. print("✅ Successfully imported SegmentType")
  19. # Test that the segment types exist
  20. print(f"✅ SegmentType.BOOLEAN = {SegmentType.BOOLEAN}")
  21. print(f"✅ SegmentType.ARRAY_BOOLEAN = {SegmentType.ARRAY_BOOLEAN}")
  22. # Test creating boolean segments directly
  23. bool_seg = BooleanSegment(value=True)
  24. print(f"✅ Created BooleanSegment: {bool_seg}")
  25. print(f" Value type: {bool_seg.value_type}")
  26. print(f" Value: {bool_seg.value}")
  27. array_bool_seg = ArrayBooleanSegment(value=[True, False, True])
  28. print(f"✅ Created ArrayBooleanSegment: {array_bool_seg}")
  29. print(f" Value type: {array_bool_seg.value_type}")
  30. print(f" Value: {array_bool_seg.value}")
  31. print("\n🎉 All boolean class imports and basic functionality work correctly!")
  32. except ImportError as e:
  33. print(f"❌ Import error: {e}")
  34. except Exception as e:
  35. print(f"❌ Error: {e}")
  36. import traceback
  37. traceback.print_exc()