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

Function test_key_variations

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

Test various key formats

(name)

Source from the content-addressed store, hash-verified

332 results.fail("base64 encoded data", b64_value[:50], actual[:50])
333
334def test_key_variations(name):
335 """Test various key formats"""
336 print("\n[Test: Key Variations]")
337
338 keys = [
339 ("short", "a"),
340 ("numeric", "12345"),
341 ("uuid", "550e8400-e29b-41d4-a716-446655440000"),
342 ("path_like", "users/123/profile"),
343 ("dot_separated", "com.example.app.setting"),
344 ("long_key", "k" * 200),
345 ]
346
347 run_in_txn(name, lambda t: [upsert(name, t, k, f"val_{n}") for n, k in keys])
348
349 for label, key in keys:
350 actual = lookup(name, key)
351 expected = f"val_{label}"
352 if actual == expected:
353 results.ok(f"key: {label}")
354 else:
355 results.fail(f"key: {label}", expected, actual)
356
357# ============== MAIN ==============
358

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