(make_enc: Callable[[], tiktoken.Encoding])
| 157 | |
| 158 | @pytest.mark.parametrize("make_enc", ENCODING_FACTORIES) |
| 159 | def 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 | # ==================== |
nothing calls this directly
no test coverage detected
searching dependent graphs…