Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /GRID-INTELLIGENCE_GRID /safety /test_verification.py
| """Final verification test for fixes.""" | |
| import os | |
| import sys | |
| sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) | |
| import asyncio | |
| from safety.ai_workflow_safety import TemporalSafetyConfig | |
| from safety.context_safe_engine_manager import ContextSafeEngineManager | |
| async def main(): | |
| """Verify all fixes.""" | |
| manager = ContextSafeEngineManager(max_cache_size=5, cleanup_interval_seconds=1) | |
| print("Verification Test:") | |
| print("=" * 60) | |
| # Test 1: Timestamp consistency for existing engine | |
| print("\n1. Testing timestamp consistency (existing engine)...") | |
| await manager.get_engine("user1") | |
| await asyncio.sleep(0.01) | |
| await manager.get_engine("user1") # Should use same timestamp | |
| # Test 2: User_id validation | |
| print("\n2. Testing user_id validation...") | |
| try: | |
| await manager.get_engine("user@test") | |
| print(" ✗ FAILED: Invalid user_id accepted") | |
| except ValueError as e: | |
| print(f" PASSED: Invalid user_id rejected: {e}") | |
| # Test 3: Config bounds | |
| print("\n3. Testing config bounds...") | |
| try: | |
| config = TemporalSafetyConfig(stamina_cost_per_char=15.0) | |
| await manager.get_engine("test", config) | |
| print(" ✗ FAILED: Invalid config accepted") | |
| except ValueError as e: | |
| print(f" PASSED: Invalid config rejected: {e}") | |
| try: | |
| config = TemporalSafetyConfig(heat_threshold=150.0) | |
| await manager.get_engine("test2", config) | |
| print(" ✗ FAILED: Invalid heat_threshold accepted") | |
| except ValueError as e: | |
| print(f" PASSED: Invalid heat_threshold rejected: {e}") | |
| print("\n" + "=" * 60) | |
| print("Verification complete. Check debug.log for timestamp consistency.") | |
| print("=" * 60) | |
| if __name__ == "__main__": | |
| asyncio.run(main()) | |
Xet Storage Details
- Size:
- 1.81 kB
- Xet hash:
- 2779e55010a0463c9b79d3a595d3c3dbe680dff0298c42f66920017c44a6da36
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.