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

Function test_batch_encode

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

Source from the content-addressed store, hash-verified

238
239@pytest.mark.parametrize("make_enc", ENCODING_FACTORIES)
240def test_batch_encode(make_enc: Callable[[], tiktoken.Encoding]):
241 enc = make_enc()
242 text1 = "hello world"
243 text2 = "goodbye world"
244
245 assert enc.encode_batch([text1]) == [enc.encode(text1)]
246 assert enc.encode_batch([text1, text2]) == [enc.encode(text1), enc.encode(text2)]
247
248 assert enc.encode_ordinary_batch([text1]) == [enc.encode_ordinary(text1)]
249 assert enc.encode_ordinary_batch([text1, text2]) == [
250 enc.encode_ordinary(text1),
251 enc.encode_ordinary(text2),
252 ]
253
254
255@pytest.mark.parametrize("make_enc", ENCODING_FACTORIES)

Callers

nothing calls this directly

Calls 4

encode_batchMethod · 0.80
encode_ordinary_batchMethod · 0.80
encode_ordinaryMethod · 0.80
encodeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…