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

Function test_basic_upsert_lookup

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

Test basic insert and retrieval

(name)

Source from the content-addressed store, hash-verified

137# ============== TESTS ==============
138
139def test_basic_upsert_lookup(name):
140 """Test basic insert and retrieval"""
141 print("\n[Test: Basic Upsert/Lookup]")
142
143 def do_upsert(txn_id):
144 upsert(name, txn_id, "key1", "value1")
145 upsert(name, txn_id, "key2", "value2")
146
147 run_in_txn(name, do_upsert)
148
149 v1 = lookup(name, "key1")
150 v2 = lookup(name, "key2")
151
152 if v1 == "value1":
153 results.ok("key1 lookup")
154 else:
155 results.fail("key1 lookup", "value1", v1)
156
157 if v2 == "value2":
158 results.ok("key2 lookup")
159 else:
160 results.fail("key2 lookup", "value2", v2)
161
162def test_unicode_content(name):
163 """Test Unicode characters in keys and values"""

Callers 1

mainFunction · 0.85

Calls 4

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

Tested by

no test coverage detected