MCPcopy Create free account
hub / github.com/KentBeck/BPlusTree3 / test_string_keys

Function test_string_keys

python/tests/test_c_extension_comprehensive.py:224–246  ·  view source on GitHub ↗

Test with string keys to ensure comparison works correctly.

()

Source from the content-addressed store, hash-verified

222
223
224def test_string_keys():
225 """Test with string keys to ensure comparison works correctly."""
226 print("Testing string keys...")
227 tree = bplustree_c.BPlusTree(capacity=4)
228
229 string_keys = ["apple", "banana", "cherry", "date", "elderberry", "fig", "grape"]
230 for key in string_keys:
231 tree[key] = len(key)
232
233 # Verify all string keys
234 for key in string_keys:
235 value = tree[key]
236 expected = len(key)
237 assert value == expected, f"tree['{key}'] should be {expected}, got {value}"
238
239 # Check sorted order
240 keys = list(tree.keys())
241 expected_keys = sorted(string_keys)
242 assert (
243 keys == expected_keys
244 ), f"String keys not in sorted order. Expected {expected_keys}, got {keys}"
245
246 print("✓ String key tests passed")
247
248
249def test_mixed_types():

Callers

nothing calls this directly

Calls 1

keysMethod · 0.45

Tested by

no test coverage detected