File size: 867 Bytes
dbb04e4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import asyncio
import sys
import logging
from unittest.mock import AsyncMock

from mnemocore.core.async_storage import AsyncRedisStorage

logging.basicConfig(level=logging.DEBUG)

async def main():
    print("Starting debug_async.py...")
    try:
        mock_client = AsyncMock()
        print("Mock client created.")

        storage = AsyncRedisStorage(client=mock_client)
        print("AsyncRedisStorage initialized.")

        node_id = "mem_debug"
        data = {"content": "debug"}

        print("Calling store_memory...")
        await storage.store_memory(node_id, data)
        print("store_memory returned.")

        mock_client.set.assert_called_once()
        print("Assertion passed.")

    except Exception as e:
        print(f"Error: {e}")
        sys.exit(1)

if __name__ == "__main__":
    asyncio.run(main())