haystack/test/preview/conftest.py

14 lines
300 B
Python
Raw Normal View History

from unittest.mock import Mock
import pytest
@pytest.fixture()
def mock_tokenizer():
"""
Tokenizes the string by splitting on spaces.
"""
tokenizer = Mock()
tokenizer.encode = lambda text: text.split()
tokenizer.decode = lambda tokens: " ".join(tokens)
return tokenizer