# Path: graphscale/kvetch/data_storage.py
# def data_to_body(data: Dict[str, Any]) -> bytes:
#     return zlib.compress(pickle.dumps(data))
#     # this should switch to json, but I need to do some special support
#     # for correct serializing and deserializing UUIDS and other types
#     # return zlib.compress(json.dumps(data).encode())
# 
# def body_to_data(body: bytes) -> Dict[str, Any]:
#     if body is None:
#         return {}
#     return cast(Dict[str, Any], pickle.loads(zlib.decompress(body)))


import redis
import pytest
from graphscale.kvetch.data_storage import data_to_body, body_to_data
from uuid import uuid4



@pytest.mark.skip
def test_redis() -> None:
    redis_instance = redis.StrictRedis(host='localhost', port=6379, db=0, decode_responses=True)
    redis_instance.set('foo', 'bar')
    assert redis_instance.get('foo') == 'bar'


@pytest.mark.skip
def test_store_kvetch_obj() -> None:
    redis_instance = redis.StrictRedis(host='localhost', port=6379, db=0, decode_responses=False)
    data = {'num': 4, 'str': 'some string'}
    obj_id = uuid4()
    body = data_to_body(data)

# Path: graphscale/kvetch/data_storage.py
# def data_to_body(data: Dict[str, Any]) -> bytes:
#     return zlib.compress(pickle.dumps(data))
#     # this should switch to json, but I need to do some special support
#     # for correct serializing and deserializing UUIDS and other types
#     # return zlib.compress(json.dumps(data).encode())
# 
# def body_to_data(body: bytes) -> Dict[str, Any]:
#     if body is None:
#         return {}
#     return cast(Dict[str, Any], pickle.loads(zlib.decompress(body)))


# Path: tests/test_redis.py
import redis
import pytest
from graphscale.kvetch.data_storage import data_to_body, body_to_data
from uuid import uuid4




@pytest.mark.skip
def test_redis() -> None:
    redis_instance = redis.StrictRedis(host='localhost', port=6379, db=0, decode_responses=True)
    redis_instance.set('foo', 'bar')
    assert redis_instance.get('foo') == 'bar'


@pytest.mark.skip
def test_store_kvetch_obj() -> None:
    redis_instance = redis.StrictRedis(host='localhost', port=6379, db=0, decode_responses=False)
    data = {'num': 4, 'str': 'some string'}
    obj_id = uuid4()
    body = data_to_body(data)

    redis_instance.set(obj_id, body)