| import glob | |
| import unittest | |
| from custom_tokenizer_adapters import load_custom_tokenizer | |
| ROOT = "/tmp/tokenizer-extract.GBtvQ0/repo" | |
| PATTERNS = ["Arek/**/*.json", "KasiaMP/wyniki/tokenizer z boilerplate.json", "KasiaMP/wyniki/wyniki*.json", "ola/*.json", "patryk/*.json"] | |
| SAMPLES = ["Zażółć gęślą jaźń.", "Łódź 2026 — € 😀\n\tKoniec"] | |
| class CustomAdaptersTest(unittest.TestCase): | |
| def test_every_custom_artifact_roundtrips(self): | |
| paths = sorted({p for pattern in PATTERNS for p in glob.glob(f"{ROOT}/{pattern}", recursive=True)}) | |
| self.assertEqual(len(paths), 25) | |
| for path in paths: | |
| with self.subTest(path=path): | |
| tokenizer = load_custom_tokenizer(path) | |
| for sample in SAMPLES: | |
| self.assertEqual(tokenizer.decode(tokenizer.encode(sample)), sample) | |
| if __name__ == "__main__": | |
| unittest.main() | |