mirror of
https://github.com/shadoll/moma.git
synced 2026-08-28 11:33:25 +00:00
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:
@@ -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 []
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user