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,35 +4,29 @@ from renamer.extractors.metadata_extractor import MetadataExtractor
|
||||
|
||||
|
||||
class TestMetadataExtractor:
|
||||
@pytest.fixture
|
||||
def extractor(self, test_file):
|
||||
return MetadataExtractor(test_file)
|
||||
|
||||
@pytest.fixture
|
||||
def test_file(self):
|
||||
"""Use the filenames.txt file for testing"""
|
||||
return Path(__file__).parent / "filenames.txt"
|
||||
|
||||
def test_extract_title(self, test_file):
|
||||
def test_extract_title(self, extractor):
|
||||
"""Test extracting title from metadata"""
|
||||
title = MetadataExtractor.extract_title(test_file)
|
||||
title = extractor.extract_title()
|
||||
# Text files don't have metadata, so should be None
|
||||
assert title is None
|
||||
|
||||
def test_extract_duration(self, test_file):
|
||||
def test_extract_duration(self, extractor):
|
||||
"""Test extracting duration from metadata"""
|
||||
duration = MetadataExtractor.extract_duration(test_file)
|
||||
duration = extractor.extract_duration()
|
||||
# Text files don't have duration
|
||||
assert duration is None
|
||||
|
||||
def test_extract_artist(self, test_file):
|
||||
def test_extract_artist(self, extractor):
|
||||
"""Test extracting artist from metadata"""
|
||||
artist = MetadataExtractor.extract_artist(test_file)
|
||||
artist = extractor.extract_artist()
|
||||
# Text files don't have artist
|
||||
assert artist is None
|
||||
|
||||
def test_extract_all_metadata(self, test_file):
|
||||
"""Test extracting all metadata"""
|
||||
metadata = MetadataExtractor.extract_all_metadata(test_file)
|
||||
expected = {
|
||||
'title': None,
|
||||
'duration': None,
|
||||
'artist': None
|
||||
}
|
||||
assert metadata == expected
|
||||
assert artist is None
|
||||
Reference in New Issue
Block a user