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
+4 -4
View File
@@ -10,8 +10,8 @@ class TestFileInfoExtractor:
@pytest.fixture
def test_file(self):
"""Use the filenames.txt file for testing"""
return Path(__file__).parent / "filenames.txt"
"""Use the filename_patterns.json dataset file for testing"""
return Path(__file__).parent / "datasets" / "filenames" / "filename_patterns.json"
def test_extract_size(self, extractor):
"""Test extracting file size"""
@@ -29,10 +29,10 @@ class TestFileInfoExtractor:
"""Test extracting file name"""
name = extractor.extract_file_name()
assert isinstance(name, str)
assert name == "filenames.txt"
assert name == "filename_patterns.json"
def test_extract_file_path(self, extractor):
"""Test extracting file path"""
path = extractor.extract_file_path()
assert isinstance(path, str)
assert "filenames.txt" in path
assert "filename_patterns.json" in path