Create a tokenizer instance with mocked dependencies
(mock_sp_model, vocab_file)
| 46 | |
| 47 | @pytest.fixture |
| 48 | def tokenizer(mock_sp_model, vocab_file): |
| 49 | """Create a tokenizer instance with mocked dependencies""" |
| 50 | with patch.object(SentencePieceProcessor, "Load", return_value=None): |
| 51 | with patch("sentencepiece.SentencePieceProcessor") as mock_spm: |
| 52 | mock_spm.return_value = mock_sp_model |
| 53 | return Ernie4_5Tokenizer(vocab_file=vocab_file) |
| 54 | |
| 55 | |
| 56 | # ===== Initialization Tests (Parametrized) ===== |
no test coverage detected