haystack/test/preview/conftest.py

20 lines
423 B
Python
Raw Normal View History

from pathlib import Path
from unittest.mock import Mock, patch
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
@pytest.fixture()
def test_files_path():
return Path(__file__).parent / "test_files"