20 lines
789 B
Python
20 lines
789 B
Python
import pytest
|
|
from pathlib import Path
|
|
from tweet_classifier.web_generator import WebReportGenerator
|
|
|
|
def test_web_generator_finds_csv_in_output_dir(tmp_path):
|
|
output_dir = tmp_path / "ok"
|
|
output_dir.mkdir()
|
|
|
|
# Create a CSV in output_dir
|
|
csv_file = output_dir / "my_tweets.csv"
|
|
csv_file.write_text("filepath,status,detected_category,confidence,ocr_text\n/path/to/img,processed,Cat,0.9,Text")
|
|
|
|
# Instantiate with a non-existent path but pointing to the output_dir
|
|
# The WebReportGenerator will now check in output_dir
|
|
generator = WebReportGenerator(csv_path=Path("my_tweets.csv"), output_dir=output_dir)
|
|
|
|
# This should now point to output_dir / "my_tweets.csv"
|
|
assert generator.csv_path.exists()
|
|
assert generator.csv_path == csv_file
|