- 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.
21 lines
655 B
Python
21 lines
655 B
Python
"""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
|