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

Function test_metastring

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

Source from the content-addressed store, hash-verified

77
78
79def test_metastring():
80 encoder = MetaStringEncoder(special_char1=".", special_char2="_")
81 decoder = MetaStringDecoder(special_char1=".", special_char2="_")
82
83 for i in range(1, 128):
84 try:
85 string = create_string(i)
86 metastring = encoder.encode(string)
87 assert metastring.encoding != Encoding.UTF_8
88 assert metastring.original == string
89
90 new_string = decoder.decode(metastring.encoded_data, metastring.encoding)
91 assert new_string == string
92 except Exception as e:
93 pytest.fail(f"Failed at {i} with exception: {str(e)}")
94
95
96def test_encode_empty_string():

Callers

nothing calls this directly

Calls 6

encodeMethod · 0.95
decodeMethod · 0.95
MetaStringEncoderClass · 0.90
MetaStringDecoderClass · 0.90
failMethod · 0.80
create_stringFunction · 0.70

Tested by

no test coverage detected