Add comprehensive tests for formatter classes, services, and utilities

- Introduced tests for various formatter classes including TextFormatter, DurationFormatter, SizeFormatter, DateFormatter, and more to ensure correct formatting behavior.
- Added tests for service classes such as FileTreeService, MetadataService, and RenameService, covering directory validation, metadata extraction, and file renaming functionalities.
- Implemented utility tests for LanguageCodeExtractor, PatternExtractor, and FrameClassMatcher to validate their extraction and matching capabilities.
- Updated test cases to use datasets for better maintainability and clarity.
- Enhanced error handling tests to ensure robustness against missing or invalid data.
This commit is contained in:
sha
2025-12-31 14:04:33 +00:00
parent c5fbd367fc
commit 262c0a7b7d
45 changed files with 3346 additions and 1057 deletions
+7 -5
View File
@@ -1,15 +1,17 @@
import pytest
import json
from pathlib import Path
from ..extractors.filename_extractor import FilenameExtractor
from ..constants import FRAME_CLASSES
def load_test_filenames():
"""Load test filenames from filenames.txt"""
test_file = Path(__file__).parent / "filenames.txt"
if test_file.exists():
with open(test_file, 'r', encoding='utf-8') as f:
return [line.strip() for line in f if line.strip()]
"""Load test filenames from dataset"""
dataset_file = Path(__file__).parent / "datasets" / "filenames" / "filename_patterns.json"
if dataset_file.exists():
with open(dataset_file, 'r', encoding='utf-8') as f:
data = json.load(f)
return [case['filename'] for case in data['test_cases']]
return []