replace cdrdao.py with much simpler version (#52)

* replace cdrdao.py with much simpler version
* more pythonic syntax for cdrdao.read_toc(fast_toc=) switching
* fix silly typo
This commit is contained in:
Samantha Baldwin
2016-10-22 04:32:18 -04:00
committed by JoeLametta
parent 8721ba1caf
commit d7f8557426
5 changed files with 60 additions and 566 deletions

View File

@@ -7,38 +7,9 @@ from morituri.program import cdrdao
from morituri.test import common
class FakeTask:
def setProgress(self, value):
pass
class ParseTestCase(common.TestCase):
def setUp(self):
path = os.path.join(os.path.dirname(__file__),
'cdrdao.readtoc.progress')
self._parser = cdrdao.OutputParser(FakeTask())
self._handle = open(path)
def testParse(self):
# FIXME: we should be testing splitting in byte blocks, not lines
for line in self._handle.readlines():
self._parser.read(line)
for i, offset in enumerate(
[0, 13864, 31921, 48332, 61733, 80961,
100219, 116291, 136188, 157504, 175275]):
track = self._parser.table.tracks[i]
self.assertEquals(track.getIndex(1).absolute, offset)
self.assertEquals(self._parser.version, '1.2.2')
# TODO: Current test architecture makes testing cdrdao difficult. Revisit.
class VersionTestCase(common.TestCase):
def testGetVersion(self):
v = cdrdao.getCDRDAOVersion()
self.failUnless(v)