2023-09-20 11:03:52 +02:00
|
|
|
from pathlib import Path
|
2023-09-25 18:39:10 +02:00
|
|
|
from unittest.mock import Mock
|
2023-08-31 17:33:12 +02:00
|
|
|
import pytest
|
|
|
|
|
2023-09-25 18:39:10 +02:00
|
|
|
from haystack.preview.testing.test_utils import set_all_seeds
|
|
|
|
|
|
|
|
set_all_seeds(0)
|
|
|
|
|
2023-08-31 17:33:12 +02:00
|
|
|
|
|
|
|
@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
|
2023-09-20 11:03:52 +02:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture()
|
|
|
|
def test_files_path():
|
|
|
|
return Path(__file__).parent / "test_files"
|