* morituri/common/accurip.py:

* morituri/image/image.py:
	* morituri/test/Makefile.am:
	* morituri/test/test_image_image.py:
	* morituri/test/test_common_accurip.py (added):
	  Move accuraterip stuff to the accurip module.
	  Move/create new test file.
This commit is contained in:
Thomas Vander Stichele
2009-05-23 18:14:11 +00:00
parent 5f872bdaf8
commit 7dfc1fbc6c
6 changed files with 85 additions and 69 deletions

View File

@@ -3,6 +3,7 @@ CLEANFILES = *.py{c,o}
EXTRA_DIST = \
__init__.py \
common.py \
test_common_accurip.py \
test_common_renamer.py \
test_image_cue.py \
test_image_image.py \

View File

@@ -0,0 +1,29 @@
# -*- Mode: Python; test-case-name: morituri.test.test_common_accurip -*-
# vi:si:et:sw=4:sts=4:ts=4
import os
import unittest
from morituri.common import accurip, common
class AccurateRipResponseTestCase(unittest.TestCase):
def testResponse(self):
path = os.path.join(os.path.dirname(__file__),
'dBAR-011-0010e284-009228a3-9809ff0b.bin')
data = open(path, "rb").read()
responses = accurip.getAccurateRipResponses(data)
self.assertEquals(len(responses), 3)
response = responses[0]
self.assertEquals(response.trackCount, 11)
self.assertEquals(response.discId1, "0010e284")
self.assertEquals(response.discId2, "009228a3")
self.assertEquals(response.cddbDiscId, "9809ff0b")
for i in range(11):
self.assertEquals(response.confidences[i], 35)
self.assertEquals(response.checksums[0], "beea32c8")
self.assertEquals(response.checksums[10], "acee98ca")

View File

@@ -1,4 +1,4 @@
# -*- Mode: Python; test-case-name: morituri.test.test_image_cue -*-
# -*- Mode: Python; test-case-name: morituri.test.test_image_image -*-
# vi:si:et:sw=4:sts=4:ts=4
import os
@@ -80,25 +80,3 @@ class AudioLengthTestCase(unittest.TestCase):
runner = task.SyncRunner()
runner.run(t, verbose=False)
self.assertEquals(t.length, 10 * common.SAMPLES_PER_FRAME)
class AccurateRipResponseTestCase(unittest.TestCase):
def testResponse(self):
path = os.path.join(os.path.dirname(__file__),
'dBAR-011-0010e284-009228a3-9809ff0b.bin')
data = open(path, "rb").read()
responses = image.getAccurateRipResponses(data)
self.assertEquals(len(responses), 3)
response = responses[0]
self.assertEquals(response.trackCount, 11)
self.assertEquals(response.discId1, "0010e284")
self.assertEquals(response.discId2, "009228a3")
self.assertEquals(response.cddbDiscId, "9809ff0b")
for i in range(11):
self.assertEquals(response.confidences[i], 35)
self.assertEquals(response.checksums[0], "beea32c8")
self.assertEquals(response.checksums[10], "acee98ca")