mirror of
https://github.com/shadoll/moma.git
synced 2026-08-28 03:27:34 +00:00
feat: add pytest configuration and implement tests for file and metadata extraction
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
import pytest
|
||||
from pathlib import Path
|
||||
from renamer.extractors.mediainfo_extractor import MediaInfoExtractor
|
||||
|
||||
|
||||
class TestMediaInfoExtractor:
|
||||
@pytest.fixture
|
||||
def extractor(self):
|
||||
return MediaInfoExtractor()
|
||||
|
||||
@pytest.fixture
|
||||
def test_file(self):
|
||||
"""Use the filenames.txt file for testing"""
|
||||
return Path(__file__).parent / "filenames.txt"
|
||||
|
||||
def test_extract_resolution(self, extractor, test_file):
|
||||
"""Test extracting resolution from media info"""
|
||||
resolution = extractor.extract_resolution(test_file)
|
||||
# Text files don't have video resolution
|
||||
assert resolution is None
|
||||
|
||||
def test_extract_hdr(self, extractor, test_file):
|
||||
"""Test extracting HDR info"""
|
||||
hdr = extractor.extract_hdr(test_file)
|
||||
# Text files don't have HDR
|
||||
assert hdr is None
|
||||
|
||||
def test_extract_audio_langs(self, extractor, test_file):
|
||||
"""Test extracting audio languages"""
|
||||
langs = extractor.extract_audio_langs(test_file)
|
||||
# Text files don't have audio tracks
|
||||
assert langs == ''
|
||||
|
||||
def test_extract_video_dimensions(self, extractor, test_file):
|
||||
"""Test extracting video dimensions"""
|
||||
dims = extractor.extract_video_dimensions(test_file)
|
||||
# Text files don't have video dimensions
|
||||
assert dims is None
|
||||
Reference in New Issue
Block a user