def test_analyze(filepath): metadata = ReplayGainAnalyzer.analyze(filepath, dict()) # We give rgain3 some leeway here by specifying a tolerance tolerance = 0.60 expected_replaygain = 5.2 assert abs(metadata["replay_gain"] - expected_replaygain) < tolerance
def test_invalid_wma(): metadata = ReplayGainAnalyzer.analyze( u'tests/test_data/44100Hz-16bit-stereo-invalid.wma', dict())
def test_ogg_stereo(): metadata = ReplayGainAnalyzer.analyze( u'tests/test_data/44100Hz-16bit-stereo.ogg', dict()) check_default_metadata(metadata)
def test_mp3_mono(): metadata = ReplayGainAnalyzer.analyze( u'tests/test_data/44100Hz-16bit-mono.mp3', dict()) check_default_metadata(metadata)
def test_mp3_utf8(): metadata = ReplayGainAnalyzer.analyze( u'tests/test_data/44100Hz-16bit-stereo-utf8.mp3', dict()) check_default_metadata(metadata)
def test_invalid_filepath(): metadata = ReplayGainAnalyzer.analyze(u'non-existent-file', dict())
def test_missing_replaygain(): old_rg = ReplayGainAnalyzer.REPLAYGAIN_EXECUTABLE ReplayGainAnalyzer.REPLAYGAIN_EXECUTABLE = 'foosdaf' metadata = ReplayGainAnalyzer.analyze( u'tests/test_data/44100Hz-16bit-stereo-utf8.mp3', dict()) ReplayGainAnalyzer.REPLAYGAIN_EXECUTABLE = old_rg # Need to put this back
def test_mp3_missing_id3_header(): metadata = ReplayGainAnalyzer.analyze( u'tests/test_data/44100Hz-16bit-mp3-missingid3header.mp3', dict())
def test_analyze_missing_replaygain(): old = ReplayGainAnalyzer.REPLAYGAIN_EXECUTABLE ReplayGainAnalyzer.REPLAYGAIN_EXECUTABLE = "foobar" ReplayGainAnalyzer.analyze("tests/test_data/44100Hz-16bit-mono.mp3", dict()) ReplayGainAnalyzer.REPLAYGAIN_EXECUTABLE = old