-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathverify_native.py
More file actions
83 lines (69 loc) · 2.5 KB
/
verify_native.py
File metadata and controls
83 lines (69 loc) · 2.5 KB
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
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/usr/bin/env python3
"""
Verification script for Native Protocol API modules.
"""
def verify_native_modules():
"""Verify that all native modules can be imported correctly.
This function checks imports, abstract classes, and data types.
Returns True if all verifications pass, False otherwise.
"""
try:
# Test native module imports
from cloud_runtimes.native.redis import RedisRuntimes
from cloud_runtimes.native.sql import SqlRuntimes
from cloud_runtimes.native.s3 import S3Runtimes
# Test native types import
from cloud_runtimes.types.native import (
RedisExecuteRequest,
RedisExecuteResponse,
RedisZMember,
SqlExecuteRequest,
SqlExecuteResponse,
SqlQueryRequest,
SqlQueryResponse,
S3GetObjectRequest,
S3GetObjectResponse,
S3PutObjectRequest,
S3PutObjectResponse,
)
print("✅ All native imports successful!")
# Test abstract class behavior
try:
RedisRuntimes()
print("❌ RedisRuntimes should be abstract!")
except TypeError:
print("✅ RedisRuntimes is properly abstract!")
try:
SqlRuntimes()
print("❌ SqlRuntimes should be abstract!")
except TypeError:
print("✅ SqlRuntimes is properly abstract!")
try:
S3Runtimes()
print("❌ S3Runtimes should be abstract!")
except TypeError:
print("✅ S3Runtimes is properly abstract!")
# Test data type instantiation
redis_req = RedisExecuteRequest(command="GET", args=["key1"])
print(f"✅ RedisExecuteRequest created: {redis_req.command}")
sql_req = SqlExecuteRequest(sql="SELECT * FROM users")
print(f"✅ SqlExecuteRequest created: {sql_req.sql}")
s3_req = S3GetObjectRequest(bucket="test-bucket", key="test-key")
print(f"✅ S3GetObjectRequest created: {s3_req.bucket}/{s3_req.key}")
redis_member = RedisZMember(member="user1", score=100.0)
print(f"✅ RedisZMember created: {redis_member.member} -> {redis_member.score}")
print("\n🎉 All native module verifications passed! Python Native Protocol API modules are working correctly.")
return True
except ImportError as ie:
print(f"❌ Import failed: {ie}")
import traceback
traceback.print_exc()
return False
except Exception as e:
print(f"❌ Native verification failed: {e}")
import traceback
traceback.print_exc()
return False
if __name__ == "__main__":
success = verify_native_modules()
exit(0 if success else 1)