MCPcopy Create free account
hub / github.com/cosdata/cosdata / test_binary_like_content

Function test_binary_like_content

tests/test-key-value-store.py:317–332  ·  view source on GitHub ↗

Test values that look like binary data

(name)

Source from the content-addressed store, hash-verified

315 results.ok("multiple sequential transactions")
316
317def test_binary_like_content(name):
318 """Test values that look like binary data"""
319 print("\n[Test: Binary-like Content]")
320
321 # Base64-encoded data
322 import base64
323 binary_data = bytes(range(256))
324 b64_value = base64.b64encode(binary_data).decode('ascii')
325
326 run_in_txn(name, lambda t: upsert(name, t, "base64_key", b64_value))
327
328 actual = lookup(name, "base64_key")
329 if actual == b64_value:
330 results.ok("base64 encoded data")
331 else:
332 results.fail("base64 encoded data", b64_value[:50], actual[:50])
333
334def test_key_variations(name):
335 """Test various key formats"""

Callers 1

mainFunction · 0.85

Calls 5

run_in_txnFunction · 0.85
okMethod · 0.80
failMethod · 0.80
upsertFunction · 0.70
lookupFunction · 0.70

Tested by

no test coverage detected