mirror of
https://github.com/shadoll/moma.git
synced 2026-08-28 11:33:25 +00:00
feat: Enhance metadata extraction and formatting, improve extractor architecture, and update documentation
This commit is contained in:
@@ -4,32 +4,35 @@ from renamer.extractors.fileinfo_extractor import FileInfoExtractor
|
||||
|
||||
|
||||
class TestFileInfoExtractor:
|
||||
@pytest.fixture
|
||||
def extractor(self, test_file):
|
||||
return FileInfoExtractor(test_file)
|
||||
|
||||
@pytest.fixture
|
||||
def test_file(self):
|
||||
"""Use the filenames.txt file for testing"""
|
||||
return Path(__file__).parent / "filenames.txt"
|
||||
|
||||
def test_extract_size(self, test_file):
|
||||
def test_extract_size(self, extractor):
|
||||
"""Test extracting file size"""
|
||||
size = FileInfoExtractor.extract_size(test_file)
|
||||
size = extractor.extract_size()
|
||||
assert isinstance(size, int)
|
||||
assert size > 0
|
||||
|
||||
def test_extract_modification_time(self, test_file):
|
||||
def test_extract_modification_time(self, extractor):
|
||||
"""Test extracting modification time"""
|
||||
mtime = FileInfoExtractor.extract_modification_time(test_file)
|
||||
mtime = extractor.extract_modification_time()
|
||||
assert isinstance(mtime, float)
|
||||
assert mtime > 0
|
||||
|
||||
def test_extract_file_name(self, test_file):
|
||||
def test_extract_file_name(self, extractor):
|
||||
"""Test extracting file name"""
|
||||
name = FileInfoExtractor.extract_file_name(test_file)
|
||||
name = extractor.extract_file_name()
|
||||
assert isinstance(name, str)
|
||||
assert name == "filenames.txt"
|
||||
|
||||
def test_extract_file_path(self, test_file):
|
||||
def test_extract_file_path(self, extractor):
|
||||
"""Test extracting file path"""
|
||||
path = FileInfoExtractor.extract_file_path(test_file)
|
||||
path = extractor.extract_file_path()
|
||||
assert isinstance(path, str)
|
||||
assert "filenames.txt" in path
|
||||
assert str(test_file) == path
|
||||
assert "filenames.txt" in path
|
||||
Reference in New Issue
Block a user