MCPcopy Create free account
hub / github.com/apache/fory / test_encode_metastring_lower_special

Function test_encode_metastring_lower_special

python/pyfory/tests/test_metastring.py:26–42  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

24
25
26def test_encode_metastring_lower_special():
27 encoder = MetaStringEncoder(special_char1=".", special_char2="_")
28 decoder = MetaStringDecoder(special_char1=".", special_char2="_")
29
30 # Test for encoding and decoding
31 encoded = encoder._encode_lower_special("abc_def")
32 assert len(encoded) == 5
33 assert len(encoder.encode("org.apache.fory.benchmark.data").encoded_data) == 19
34 assert len(encoder.encode("MediaContent").encoded_data) == 9
35 decoded = decoder.decode(encoded, Encoding.LOWER_SPECIAL)
36 assert decoded == "abc_def"
37
38 for i in range(128):
39 builder = "".join(chr(ord("a") + j % 26) for j in range(i))
40 encoded = encoder._encode_lower_special(builder)
41 decoded = decoder.decode(encoded, Encoding.LOWER_SPECIAL)
42 assert decoded == builder
43
44
45def test_encode_metastring_lower_upper_digit_special():

Callers

nothing calls this directly

Calls 5

_encode_lower_specialMethod · 0.95
encodeMethod · 0.95
decodeMethod · 0.95
MetaStringEncoderClass · 0.90
MetaStringDecoderClass · 0.90

Tested by

no test coverage detected