MCPcopy Create free account
hub / github.com/CaviraOSS/OpenMemory / test_sdk_initialization

Function test_sdk_initialization

tests/py-sdk/test-sdk.py:29–70  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

27 pass
28
29def test_sdk_initialization():
30 print('📋 Testing SDK Initialization...\n')
31
32 # Test 1: Should fail without required config
33 try:
34 OpenMemory()
35 assert_test(False, 'Should throw error without required config')
36 except ValueError:
37 assert_test(True, 'Correctly throws error without required config')
38
39 # Test 2: Should fail without path
40 try:
41 OpenMemory(tier='fast', embeddings={'provider': 'synthetic'})
42 assert_test(False, 'Should throw error without path')
43 except ValueError as e:
44 assert_test('requires "path"' in str(e), 'Error message mentions missing path')
45
46 # Test 3: Should fail without tier
47 try:
48 OpenMemory(path=TEST_DB_PATH, embeddings={'provider': 'synthetic'})
49 assert_test(False, 'Should throw error without tier')
50 except ValueError as e:
51 assert_test('requires "tier"' in str(e), 'Error message mentions missing tier')
52
53 # Test 4: Should fail without embeddings
54 try:
55 OpenMemory(path=TEST_DB_PATH, tier='fast')
56 assert_test(False, 'Should throw error without embeddings')
57 except ValueError as e:
58 assert_test('embeddings' in str(e), 'Error message mentions missing embeddings')
59
60 # Test 5: Should initialize with proper config
61 try:
62 mem = OpenMemory(
63 path=TEST_DB_PATH,
64 tier='fast',
65 embeddings={'provider': 'synthetic'}
66 )
67 assert_test(mem is not None, 'Successfully initializes with proper config')
68 mem.close()
69 except Exception as e:
70 assert_test(False, f'Initialization failed: {str(e)}')
71
72def test_memory_operations():
73 print('\n🧠 Testing Memory Operations...\n')

Callers 1

run_testsFunction · 0.85

Calls 4

closeMethod · 0.95
OpenMemoryClass · 0.90
assert_testFunction · 0.85
strFunction · 0.50

Tested by

no test coverage detected