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

Function test_special_characters

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

Test special characters and escape sequences

(name)

Source from the content-addressed store, hash-verified

180 results.fail(f"unicode: {key[:20]}", expected, actual)
181
182def test_special_characters(name):
183 """Test special characters and escape sequences"""
184 print("\n[Test: Special Characters]")
185
186 test_cases = [
187 ("newline_key", "line1\nline2\nline3"),
188 ("tab_key", "col1\tcol2\tcol3"),
189 ("quote_key", 'single\' and "double" quotes'),
190 ("backslash_key", "path\\to\\file"),
191 ("null_char_key", "before\x00after"),
192 ("mixed_special", "a\tb\nc\\d\"e'f"),
193 ]
194
195 run_in_txn(name, lambda t: [upsert(name, t, k, v) for k, v in test_cases])
196
197 for key, expected in test_cases:
198 actual = lookup(name, key)
199 if actual == expected:
200 results.ok(f"special: {key}")
201 else:
202 results.fail(f"special: {key}", expected, actual)
203
204def test_large_value(name):
205 """Test storing large values"""

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