Skip to content

Commit f3335b8

Browse files
authored
Merge pull request #1890 from tisnik/lcore-2493-fixed-data-files-opening-code
LCORE-2493: Fixed data files opening and reading code
2 parents c2615eb + 9fb77d8 commit f3335b8

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

tests/benchmarks/test_token_estimator.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
"""Benchmarks for token estimator."""
22

3+
from pathlib import Path
4+
35
from pytest_benchmark.fixture import BenchmarkFixture
46

57
from utils.token_estimator import (
@@ -133,7 +135,8 @@ def benchmark_file_tokenization(benchmark: BenchmarkFixture, filename: str) -> N
133135
-------
134136
None
135137
"""
136-
with open("tests/benchmarks/data/" + filename, encoding="utf-8") as fin:
138+
data_dir = Path(__file__).parent / "data"
139+
with (data_dir / filename).open(encoding="utf-8") as fin:
137140
input_string = fin.read()
138141
# tokenize the file content
139142
benchmark(estimate_tokens, input_string)

0 commit comments

Comments
 (0)