MCPcopy
hub / github.com/openai/tiktoken / test_single_token_roundtrip

Function test_single_token_roundtrip

tests/test_encoding.py:159–167  ·  view source on GitHub ↗
(make_enc: Callable[[], tiktoken.Encoding])

Source from the content-addressed store, hash-verified

157
158@pytest.mark.parametrize("make_enc", ENCODING_FACTORIES)
159def test_single_token_roundtrip(make_enc: Callable[[], tiktoken.Encoding]):
160 enc = make_enc()
161
162 for token in range(enc.n_vocab):
163 try:
164 token_bytes = enc.decode_single_token_bytes(token)
165 except KeyError:
166 continue
167 assert enc.encode_single_token(token_bytes) == token
168
169
170# ====================

Callers

nothing calls this directly

Calls 2

encode_single_tokenMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…