Ejemplo n.º 1
0
 def testReadBadCount(self):
     handle = StringIO("""BEAT_START
     COUNT |^e+d|
     BEAT_END""")
     iterator = fileUtils.dbFileIterator(handle)
     self.assertRaises(DBErrors.BadCount,
                       dbfsv0.BeatStructureV0().read, iterator)
Ejemplo n.º 2
0
 def testWriteFullBeat(self):
     beat = Beat.Beat(Counter.Counter("e+a"))
     handle = StringIO()
     indenter = fileUtils.Indenter(handle)
     dbfsv0.BeatStructureV0().write(beat, indenter)
     output = handle.getvalue().splitlines()
     self.assertEqual(output, ["BEAT_START", "  COUNT |^e+a|", "BEAT_END"])
Ejemplo n.º 3
0
 def testReadFull(self):
     handle = StringIO("""BEAT_START
     COUNT |^e+a|
     BEAT_END""")
     iterator = fileUtils.dbFileIterator(handle)
     beat = dbfsv0.BeatStructureV0().read(iterator)
     self.assertEqual("".join(beat.count(1)), "1e+a")
Ejemplo n.º 4
0
 def testReadBadTicks(self):
     handle = StringIO("""BEAT_START
     NUM_TICKS x
     COUNT |^e+a|
     BEAT_END""")
     iterator = fileUtils.dbFileIterator(handle)
     self.assertRaises(DBErrors.InvalidInteger,
                       dbfsv0.BeatStructureV0().read, iterator)
Ejemplo n.º 5
0
 def testReadBadLine(self):
     handle = StringIO("""BEAT_START
     COUNT |^e+a|
     BAD_LINE xxx
     BEAT_END""")
     iterator = fileUtils.dbFileIterator(handle)
     self.assertRaises(DBErrors.UnrecognisedLine,
                       dbfsv0.BeatStructureV0().read, iterator)