Test bulk upsert of multiple items
(name)
| 250 | results.fail(f"json: {key}", expected, actual) |
| 251 | |
| 252 | def test_bulk_upsert(name): |
| 253 | """Test bulk upsert of multiple items""" |
| 254 | print("\n[Test: Bulk Upsert]") |
| 255 | |
| 256 | items = [(f"bulk_{i}", f"value_{i}") for i in range(100)] |
| 257 | |
| 258 | run_in_txn(name, lambda t: bulk_upsert(name, t, items)) |
| 259 | |
| 260 | # Verify random samples |
| 261 | sample_indices = [0, 25, 50, 75, 99] |
| 262 | all_ok = True |
| 263 | for i in sample_indices: |
| 264 | key, expected = items[i] |
| 265 | actual = lookup(name, key) |
| 266 | if actual != expected: |
| 267 | all_ok = False |
| 268 | results.fail(f"bulk item {i}", expected, actual) |
| 269 | |
| 270 | if all_ok: |
| 271 | results.ok("bulk upsert (100 items, sampled)") |
| 272 | |
| 273 | def test_key_not_found(name): |
| 274 | """Test lookup of non-existent key""" |
no test coverage detected