pep8 fixes

This commit is contained in:
Thomas Vander Stichele
2012-11-10 22:36:14 +00:00
parent b9d6807065
commit dc01274dd0
5 changed files with 29 additions and 4 deletions

View File

@@ -35,7 +35,7 @@ class RenameInFileTestcase(unittest.TestCase):
output = open(self._path).read()
self.assertEquals(output, 'That was some test\nThat was somenother\n')
os.unlink(self._path)
class RenameFileTestcase(unittest.TestCase):
def setUp(self):
(fd, self._source) = tempfile.mkstemp(suffix='.morituri.renamer.file')

View File

@@ -7,7 +7,9 @@ import unittest
from morituri.image import table, cue
class KingsSingleTestCase(unittest.TestCase):
def setUp(self):
self.cue = cue.CueFile(os.path.join(os.path.dirname(__file__),
u'kings-single.cue'))
@@ -21,7 +23,9 @@ class KingsSingleTestCase(unittest.TestCase):
t = self.cue.table.tracks[-1]
self.assertEquals(self.cue.getTrackLength(t), -1)
class KingsSeparateTestCase(unittest.TestCase):
def setUp(self):
self.cue = cue.CueFile(os.path.join(os.path.dirname(__file__),
u'kings-separate.cue'))
@@ -35,7 +39,9 @@ class KingsSeparateTestCase(unittest.TestCase):
t = self.cue.table.tracks[-1]
self.assertEquals(self.cue.getTrackLength(t), -1)
class KanyeMixedTestCase(unittest.TestCase):
def setUp(self):
self.cue = cue.CueFile(os.path.join(os.path.dirname(__file__),
u'kanye.cue'))
@@ -48,6 +54,7 @@ class KanyeMixedTestCase(unittest.TestCase):
class WriteCueFileTestCase(unittest.TestCase):
def testWrite(self):
fd, path = tempfile.mkstemp(suffix=u'.morituri.test.cue')
os.close(fd)

View File

@@ -18,10 +18,13 @@ from morituri.test import common as tcommon
log.init()
def h(i):
return "0x%08x" % i
class TrackSingleTestCase(tcommon.TestCase):
def setUp(self):
self.image = image.Image(os.path.join(os.path.dirname(__file__),
u'track-single.cue'))
@@ -29,7 +32,7 @@ class TrackSingleTestCase(tcommon.TestCase):
self.image.setup(self.runner)
def testAccurateRipChecksum(self):
checksumtask = image.AccurateRipChecksumTask(self.image)
checksumtask = image.AccurateRipChecksumTask(self.image)
self.runner.run(checksumtask, verbose=False)
self.assertEquals(len(checksumtask.checksums), 4)
@@ -51,7 +54,9 @@ class TrackSingleTestCase(tcommon.TestCase):
self.assertEquals(self.image.table.getAccurateRipIds(), (
"00000016", "0000005b"))
class TrackSeparateTestCase(tcommon.TestCase):
def setUp(self):
self.image = image.Image(os.path.join(os.path.dirname(__file__),
u'track-separate.cue'))
@@ -59,7 +64,7 @@ class TrackSeparateTestCase(tcommon.TestCase):
self.image.setup(self.runner)
def testAccurateRipChecksum(self):
checksumtask = image.AccurateRipChecksumTask(self.image)
checksumtask = image.AccurateRipChecksumTask(self.image)
self.runner.run(checksumtask, verbose=False)
self.assertEquals(len(checksumtask.checksums), 4)
@@ -81,7 +86,9 @@ class TrackSeparateTestCase(tcommon.TestCase):
self.assertEquals(self.image.table.getAccurateRipIds(), (
"00000064", "00000191"))
class AudioLengthTestCase(tcommon.TestCase):
def testLength(self):
path = os.path.join(os.path.dirname(__file__), u'track.flac')
t = image.AudioLengthTask(path)
@@ -89,7 +96,9 @@ class AudioLengthTestCase(tcommon.TestCase):
runner.run(t, verbose=False)
self.assertEquals(t.length, 10 * common.SAMPLES_PER_FRAME)
class AudioLengthPathTestCase(tcommon.TestCase):
def _testSuffix(self, suffix):
self.runner = task.SyncRunner(verbose=False)
fd, path = tempfile.mkstemp(suffix=suffix)
@@ -104,7 +113,9 @@ class AudioLengthPathTestCase(tcommon.TestCase):
gst.STREAM_ERROR_TYPE_NOT_FOUND)
os.unlink(path)
class NormalAudioLengthPathTestCase(AudioLengthPathTestCase):
def testSingleQuote(self):
self._testSuffix(u"morituri.test.Guns 'N Roses")
@@ -113,7 +124,10 @@ class NormalAudioLengthPathTestCase(AudioLengthPathTestCase):
# their name
self._testSuffix(u'morituri.test.12" edit')
class UnicodeAudioLengthPathTestCase(AudioLengthPathTestCase, tcommon.UnicodeTestMixin):
class UnicodeAudioLengthPathTestCase(AudioLengthPathTestCase,
tcommon.UnicodeTestMixin):
def testUnicodePath(self):
# this test makes sure we can checksum a unicode path
self._testSuffix(u'morituri.test.B\xeate Noire.empty')

View File

@@ -5,9 +5,11 @@ from morituri.image import table
from morituri.test import common as tcommon
def h(i):
return "0x%08x" % i
class LadyhawkeTestCase(tcommon.TestCase):
# Ladyhawke - Ladyhawke - 0602517818866
# contains 12 audio tracks and one data track
@@ -55,6 +57,7 @@ class LadyhawkeTestCase(tcommon.TestCase):
def testDuration(self):
self.assertEquals(self.table.duration(), 2761413)
class MusicBrainzTestCase(tcommon.TestCase):
# example taken from http://musicbrainz.org/doc/DiscIDCalculation
# disc is Ettella Diamant

View File

@@ -198,6 +198,7 @@ class LadyhawkeTestCase(common.TestCase):
"KnpGsLhvH.lPrNc1PBL21lb9Bg4-")
# FIXME: I don't trust this toc, but I can't find the CD anymore
def testDuration(self):
self.assertEquals(self.toc.table.duration(), 2761413)