From be436d1286fcca8ec4c6a5829fe5842f4ce9f80e Mon Sep 17 00:00:00 2001 From: Borewit Date: Wed, 16 Aug 2017 22:14:16 +0200 Subject: [PATCH] quodlibet/mutagen#207: respect E501 max line length of 79 --- tests/test_wave.py | 65 ++++++++++++++++++++++++++++++---------------- 1 file changed, 42 insertions(+), 23 deletions(-) diff --git a/tests/test_wave.py b/tests/test_wave.py index 656dbc81..037f0199 100644 --- a/tests/test_wave.py +++ b/tests/test_wave.py @@ -8,19 +8,28 @@ class TWave(TestCase): def setUp(self): - fn_wav_pcm_2s_16000_08_ID3v23 = os.path.join(DATA_DIR, "silence-2s-PCM-16000-08-ID3v23.wav") - self.wav_pcm_2s_16000_08_ID3v23 = WAVE(fn_wav_pcm_2s_16000_08_ID3v23) - - self.tmp_fn_pcm_2s_16000_08_ID3v23 = get_temp_copy(fn_wav_pcm_2s_16000_08_ID3v23) - self.tmp_wav_pcm_2s_16000_08_ID3v23 = WAVE(self.tmp_fn_pcm_2s_16000_08_ID3v23) - - fn_wav_pcm_2s_16000_08_notags = os.path.join(DATA_DIR, "silence-2s-PCM-16000-08-notags.wav") - self.wav_pcm_2s_16000_08_notags = WAVE(fn_wav_pcm_2s_16000_08_notags) - - self.tmp_fn_pcm_2s_16000_08_notag = get_temp_copy(fn_wav_pcm_2s_16000_08_notags) - self.tmp_wav_pcm_2s_16000_08_notag = WAVE(self.tmp_fn_pcm_2s_16000_08_notag) - - fn_wav_pcm_2s_44100_16_ID3v23 = os.path.join(DATA_DIR, "silence-2s-PCM-44100-16-ID3v23.wav") + fn_wav_pcm_2s_16000_08_ID3v23 = \ + os.path.join(DATA_DIR, "silence-2s-PCM-16000-08-ID3v23.wav") + self.wav_pcm_2s_16000_08_ID3v23 = \ + WAVE(fn_wav_pcm_2s_16000_08_ID3v23) + + self.tmp_fn_pcm_2s_16000_08_ID3v23 = \ + get_temp_copy(fn_wav_pcm_2s_16000_08_ID3v23) + self.tmp_wav_pcm_2s_16000_08_ID3v23 = \ + WAVE(self.tmp_fn_pcm_2s_16000_08_ID3v23) + + fn_wav_pcm_2s_16000_08_notags = \ + os.path.join(DATA_DIR, "silence-2s-PCM-16000-08-notags.wav") + self.wav_pcm_2s_16000_08_notags = \ + WAVE(fn_wav_pcm_2s_16000_08_notags) + + self.tmp_fn_pcm_2s_16000_08_notag = \ + get_temp_copy(fn_wav_pcm_2s_16000_08_notags) + self.tmp_wav_pcm_2s_16000_08_notag = \ + WAVE(self.tmp_fn_pcm_2s_16000_08_notag) + + fn_wav_pcm_2s_44100_16_ID3v23 = \ + os.path.join(DATA_DIR, "silence-2s-PCM-44100-16-ID3v23.wav") self.wav_pcm_2s_44100_16_ID3v23 = WAVE(fn_wav_pcm_2s_44100_16_ID3v23) def test_channels(self): @@ -28,16 +37,22 @@ def test_channels(self): self.failUnlessEqual(self.wav_pcm_2s_44100_16_ID3v23.info.channels, 2) def test_sample_rate(self): - self.failUnlessEqual(self.wav_pcm_2s_16000_08_ID3v23.info.sample_rate, 16000) - self.failUnlessEqual(self.wav_pcm_2s_44100_16_ID3v23.info.sample_rate, 44100) + self.failUnlessEqual(self.wav_pcm_2s_16000_08_ID3v23.info.sample_rate, + 16000) + self.failUnlessEqual(self.wav_pcm_2s_44100_16_ID3v23.info.sample_rate, + 44100) def test_number_of_samples(self): - self.failUnlessEqual(self.wav_pcm_2s_16000_08_ID3v23.info.number_of_samples, 32000) - self.failUnlessEqual(self.wav_pcm_2s_44100_16_ID3v23.info.number_of_samples, 88200) + self.failUnlessEqual(self.wav_pcm_2s_16000_08_ID3v23.info.number_of_samples, + 32000) + self.failUnlessEqual(self.wav_pcm_2s_44100_16_ID3v23.info.number_of_samples, + 88200) def test_length(self): - self.failUnlessAlmostEqual(self.wav_pcm_2s_16000_08_ID3v23.info.length, 2.0, 2) - self.failUnlessAlmostEqual(self.wav_pcm_2s_44100_16_ID3v23.info.length, 2.0, 2) + self.failUnlessAlmostEqual(self.wav_pcm_2s_16000_08_ID3v23.info.length, + 2.0, 2) + self.failUnlessAlmostEqual(self.wav_pcm_2s_44100_16_ID3v23.info.length, + 2.0, 2) def test_not_my_file(self): self.failUnlessRaises( @@ -70,10 +85,12 @@ def test_save_no_tags(self): def test_add_tags_already_there(self): self.failUnless(self.tmp_wav_pcm_2s_16000_08_ID3v23.tags) - self.failUnlessRaises(Exception, self.tmp_wav_pcm_2s_16000_08_ID3v23.add_tags) + self.failUnlessRaises(Exception, + self.tmp_wav_pcm_2s_16000_08_ID3v23.add_tags) def test_roundtrip(self): - self.failUnlessEqual(self.tmp_wav_pcm_2s_16000_08_ID3v23["TIT2"], ["Silence"]) + self.failUnlessEqual(self.tmp_wav_pcm_2s_16000_08_ID3v23["TIT2"], + ["Silence"]) self.tmp_wav_pcm_2s_16000_08_ID3v23.save() new = WAVE(self.tmp_wav_pcm_2s_16000_08_ID3v23.filename) self.failUnlessEqual(new["TIT2"], ["Silence"]) @@ -89,6 +106,8 @@ def test_save_tags(self): def test_save_without_ID3_chunk(self): from mutagen.id3 import TIT1 - self.tmp_wav_pcm_2s_16000_08_notag["TIT1"] = TIT1(encoding=3, text="foobar") + self.tmp_wav_pcm_2s_16000_08_notag["TIT1"] = TIT1(encoding=3, + text="foobar") self.tmp_wav_pcm_2s_16000_08_notag.save() - self.failUnless(WAVE(self.tmp_fn_pcm_2s_16000_08_notag)["TIT1"] == "foobar") + self.failUnless(WAVE(self.tmp_fn_pcm_2s_16000_08_notag)["TIT1"] + == "foobar")