[SCM] morituri/master: * morituri/image/table.py: * morituri/test/test_image_table.py: * morituri/test/test_image_toc.py: Increase coverage.
js at users.alioth.debian.org
js at users.alioth.debian.org
Sun Oct 19 20:09:44 UTC 2014
The following commit has been merged in the master branch:
commit 76d587185d3cd1c9c1e8688126f924cafd5228eb
Author: Thomas Vander Stichele <thomas (at) apestaart (dot) org>
Date: Sun Nov 18 16:20:21 2012 +0000
* morituri/image/table.py:
* morituri/test/test_image_table.py:
* morituri/test/test_image_toc.py:
Increase coverage.
diff --git a/ChangeLog b/ChangeLog
index cd3e5b5..734c92e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2012-11-18 Thomas Vander Stichele <thomas at apestaart dot org>
+ * morituri/image/table.py:
+ * morituri/test/test_image_table.py:
+ * morituri/test/test_image_toc.py:
+ Increase coverage.
+
+2012-11-18 Thomas Vander Stichele <thomas at apestaart dot org>
+
* Makefile.am:
* doc/Makefile.am:
Adapt to changing over to git module for python-command
diff --git a/morituri/image/table.py b/morituri/image/table.py
index ee8caa5..2046ce2 100644
--- a/morituri/image/table.py
+++ b/morituri/image/table.py
@@ -242,52 +242,6 @@ class Table(object, log.Loggable):
return ret
- def _getCDDBValues(self):
- """
- Get all CDDB values needed to calculate disc id and lookup URL.
-
- This includes:
- - CDDB disc id
- - number of audio tracks
- - offset of index 1 of each track
- - length of disc in seconds
-
- @rtype: list of int
- """
- result = []
-
- # number of first track
- result.append(1)
-
- # number of last audio track
- result.append(self.getAudioTracks())
-
- leadout = self.leadout
- # if the disc is multi-session, last track is the data track,
- # and we should subtract 11250 + 150 from the last track's offset
- # for the leadout
- if self.hasDataTracks():
- assert not self.tracks[-1].audio
- leadout = self.tracks[-1].getIndex(1).absolute - 11250 - 150
-
- # treat leadout offset as track 0 offset
- result.append(150 + leadout)
-
- # offsets of tracks
- for i in range(1, 100):
- try:
- track = self.tracks[i - 1]
- if not track.audio:
- continue
- offset = track.getIndex(1).absolute + 150
- result.append(offset)
- except IndexError:
- pass
-
-
- self.debug('CDDB values: %r', result)
- return result
-
def getCDDBValues(self):
"""
Get all CDDB values needed to calculate disc id and lookup URL.
diff --git a/morituri/test/test_image_table.py b/morituri/test/test_image_table.py
index 68bc18b..de01407 100644
--- a/morituri/test/test_image_table.py
+++ b/morituri/test/test_image_table.py
@@ -9,6 +9,13 @@ 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>")
+
+ track.index(1, 100)
+ self.failUnless(repr(track.indexes[1]).startswith('<Index 01 '))
class LadyhawkeTestCase(tcommon.TestCase):
# Ladyhawke - Ladyhawke - 0602517818866
@@ -36,6 +43,7 @@ class LadyhawkeTestCase(tcommon.TestCase):
self.table.leadout = 210385
self.failUnless(self.table.hasTOC())
+ self.assertEquals(self.table.tracks[0].getPregap(), 0)
def testCDDB(self):
self.assertEquals(self.table.getCDDBDiscId(), "c60af50d")
@@ -82,3 +90,23 @@ class MusicBrainzTestCase(tcommon.TestCase):
def testMusicBrainz(self):
self.assertEquals(self.table.getMusicBrainzDiscId(),
'49HHV7Eb8UKF3aQiNmu1GR8vKTY-')
+
+class PregapTestCase(tcommon.TestCase):
+
+ def setUp(self):
+ self.table = table.Table()
+
+ for i in range(2):
+ self.table.tracks.append(table.Track(i + 1, audio=True))
+
+ offsets = [0, 15537]
+ t = self.table.tracks
+ for i, offset in enumerate(offsets):
+ t[i].index(1, absolute=offset)
+ t[1].index(0, offsets[1] - 200)
+
+ def testPreGap(self):
+ self.assertEquals(self.table.tracks[0].getPregap(), 0)
+ self.assertEquals(self.table.tracks[1].getPregap(), 200)
+
+
diff --git a/morituri/test/test_image_toc.py b/morituri/test/test_image_toc.py
index fab995d..67362ba 100644
--- a/morituri/test/test_image_toc.py
+++ b/morituri/test/test_image_toc.py
@@ -193,15 +193,24 @@ class LadyhawkeTestCase(common.TestCase):
# 149997 161710 177832 207256 2807
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-
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-")
# 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)
+ def testGetFrameLength(self):
+ self.assertEquals(self.toc.table.getFrameLength(data=True), 210385)
+
+ def testCue(self):
+ self.failUnless(self.toc.table.canCue())
+ data = self.toc.table.cue()
+ lines = data.split("\n")
+ self.assertEquals(lines[0], "REM DISCID C60AF50D")
class CapitalMergeTestCase(common.TestCase):
--
morituri packaging
More information about the pkg-multimedia-commits
mailing list