pep8 fixes

This commit is contained in:
Thomas Vander Stichele
2012-11-29 19:54:46 +00:00
parent f0cb567a0d
commit cba7dbe41a
14 changed files with 68 additions and 32 deletions

View File

@@ -11,18 +11,28 @@ from morituri.test import common as tcommon
class ShrinkTestCase(tcommon.TestCase):
def testSufjan(self):
path = u'morituri/Sufjan Stevens - Illinois/02. Sufjan Stevens - The Black Hawk War, or, How to Demolish an Entire Civilization and Still Feel Good About Yourself in the Morning, or, We Apologize for the Inconvenience but You\'re Going to Have to Leave Now, or, "I Have Fought the Big Knives and Will Continue to Fight Them Until They Are Off Our Lands!".flac'
path = (u'morituri/Sufjan Stevens - Illinois/02. Sufjan Stevens - '
'The Black Hawk War, or, How to Demolish an Entire '
'Civilization and Still Feel Good About Yourself in the '
'Morning, or, We Apologize for the Inconvenience but '
'You\'re Going to Have to Leave Now, or, "I Have Fought '
'the Big Knives and Will Continue to Fight Them Until They '
'Are Off Our Lands!".flac')
shorter = common.shrinkPath(path)
self.failUnless(os.path.splitext(path)[0].startswith(
os.path.splitext(shorter)[0]))
self.failIfEquals(path, shorter)
class FramesTestCase(tcommon.TestCase):
def testFrames(self):
self.assertEquals(common.framesToHMSF(123456), '00:27:26.06')
class FormatTimeTestCase(tcommon.TestCase):
def testFormatTime(self):
self.assertEquals(common.formatTime(7202), '02:00:02.000')

View File

@@ -9,7 +9,9 @@ from morituri.test import common as tcommon
def h(i):
return "0x%08x" % i
class TrackTestCase(tcommon.TestCase):
def testRepr(self):
track = table.Track(1)
self.assertEquals(repr(track), "<Track 01>")
@@ -17,6 +19,7 @@ class TrackTestCase(tcommon.TestCase):
track.index(1, 100)
self.failUnless(repr(track.indexes[1]).startswith('<Index 01 '))
class LadyhawkeTestCase(tcommon.TestCase):
# Ladyhawke - Ladyhawke - 0602517818866
# contains 12 audio tracks and one data track
@@ -50,7 +53,9 @@ class LadyhawkeTestCase(tcommon.TestCase):
def testMusicBrainz(self):
# output from mb-submit-disc:
# http://mm.musicbrainz.org/bare/cdlookup.html?toc=1+12+195856+150+15687+31841+51016+66616+81352+99559+116070+133243+149997+161710+177832&tracks=12&id=KnpGsLhvH.lPrNc1PBL21lb9Bg4-
# http://mm.musicbrainz.org/bare/cdlookup.html?toc=1+12+195856+150+
# 15687+31841+51016+66616+81352+99559+116070+133243+149997+161710+
# 177832&tracks=12&id=KnpGsLhvH.lPrNc1PBL21lb9Bg4-
# however, not (yet) in musicbrainz database
self.assertEquals(self.table.getMusicBrainzDiscId(),
@@ -60,7 +65,8 @@ class LadyhawkeTestCase(tcommon.TestCase):
self.assertEquals(self.table.getAccurateRipIds(), (
"0013bd5a", "00b8d489"))
self.assertEquals(self.table.getAccurateRipURL(),
"http://www.accuraterip.com/accuraterip/a/5/d/dBAR-012-0013bd5a-00b8d489-c60af50d.bin")
"http://www.accuraterip.com/accuraterip/a/5/d/"
"dBAR-012-0013bd5a-00b8d489-c60af50d.bin")
def testDuration(self):
self.assertEquals(self.table.duration(), 2761413)
@@ -91,6 +97,7 @@ class MusicBrainzTestCase(tcommon.TestCase):
self.assertEquals(self.table.getMusicBrainzDiscId(),
'49HHV7Eb8UKF3aQiNmu1GR8vKTY-')
class PregapTestCase(tcommon.TestCase):
def setUp(self):
@@ -108,5 +115,3 @@ class PregapTestCase(tcommon.TestCase):
def testPreGap(self):
self.assertEquals(self.table.tracks[0].getPregap(), 0)
self.assertEquals(self.table.tracks[1].getPregap(), 200)

View File

@@ -93,7 +93,6 @@ class CureTestCase(common.TestCase):
'http://www.accuraterip.com/accuraterip/'
'3/c/4/dBAR-013-0019d4c3-00fe8924-b90c650d.bin')
def testGetRealPath(self):
self.assertRaises(KeyError, self.toc.getRealPath, u'track01.wav')
(fd, path) = tempfile.mkstemp(suffix=u'.morituri.test.wav')
@@ -211,7 +210,10 @@ class LadyhawkeTestCase(common.TestCase):
self.assertEquals(self.toc.table.getMusicBrainzDiscId(),
"KnpGsLhvH.lPrNc1PBL21lb9Bg4-")
self.assertEquals(self.toc.table.getMusicBrainzSubmitURL(),
"http://mm.musicbrainz.org/bare/cdlookup.html?toc=1+12+195856+150+15687+31841+51016+66616+81352+99559+116070+133243+149997+161710+177832&tracks=12&id=KnpGsLhvH.lPrNc1PBL21lb9Bg4-")
"http://mm.musicbrainz.org/bare/cdlookup.html?toc="
"1+12+195856+150+15687+31841+51016+66616+81352+99559+"
"116070+133243+149997+161710+177832&"
"tracks=12&id=KnpGsLhvH.lPrNc1PBL21lb9Bg4-")
# FIXME: I don't trust this toc, but I can't find the CD anymore
@@ -227,6 +229,7 @@ class LadyhawkeTestCase(common.TestCase):
lines = data.split("\n")
self.assertEquals(lines[0], "REM DISCID C60AF50D")
class CapitalMergeTestCase(common.TestCase):
def setUp(self):
@@ -249,15 +252,19 @@ class CapitalMergeTestCase(common.TestCase):
self.table.absolutize()
self.assertEquals(self.table.getCDDBDiscId(), 'b910140c')
# output from cd-discid:
# b910140c 12 24320 44855 64090 77885 88095 104020 118245 129255 141765 164487 181780 209250 4440
# b910140c 12 24320 44855 64090 77885 88095 104020 118245 129255 141765
# 164487 181780 209250 4440
def testMusicBrainz(self):
# URL to submit: http://mm.musicbrainz.org/bare/cdlookup.html?toc=1+11+197850+24320+44855+64090+77885+88095+104020+118245+129255+141765+164487+181780&tracks=11&id=MAj3xXf6QMy7G.BIFOyHyq4MySE-
# URL to submit: http://mm.musicbrainz.org/bare/cdlookup.html?toc=1+11+
# 197850+24320+44855+64090+77885+88095+104020+118245+129255+141765+
# 164487+181780&tracks=11&id=MAj3xXf6QMy7G.BIFOyHyq4MySE-
self.assertEquals(self.table.getMusicBrainzDiscId(),
"MAj3xXf6QMy7G.BIFOyHyq4MySE-")
def testDuration(self):
# this matches track 11 end sector - track 1 start sector on musicbrainz
# this matches track 11 end sector - track 1 start sector on
# musicbrainz
# compare to 3rd and 4th value in URL above
self.assertEquals(self.table.getFrameLength(), 173530)
self.assertEquals(self.table.duration(), 2313733)