mirror of
https://github.com/shadoll/moma.git
synced 2026-08-29 11:33:31 +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:
@@ -0,0 +1,20 @@
|
||||
"""Year validation constants for filename parsing.
|
||||
|
||||
This module contains constants used for validating years extracted from filenames.
|
||||
"""
|
||||
|
||||
import datetime
|
||||
|
||||
# Current year for validation
|
||||
CURRENT_YEAR = datetime.datetime.now().year
|
||||
|
||||
# Minimum valid year for movies/media (start of cinema era)
|
||||
MIN_VALID_YEAR = 1900
|
||||
|
||||
# Allow years slightly into the future (for upcoming releases)
|
||||
YEAR_FUTURE_BUFFER = 10
|
||||
|
||||
# Valid year range: MIN_VALID_YEAR to (CURRENT_YEAR + YEAR_FUTURE_BUFFER)
|
||||
def is_valid_year(year: int) -> bool:
|
||||
"""Check if a year is within the valid range for media files."""
|
||||
return MIN_VALID_YEAR <= year <= CURRENT_YEAR + YEAR_FUTURE_BUFFER
|
||||
Reference in New Issue
Block a user