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