def test_midi_to_aiff(self): fd = open(output_file_path("DonaldBlue1.mid"), "rb") mid = fd.read() Aiff = open(output_file_path("DonaldBlue1.aiff"), "rb") aiff = Aiff.read() Aiff.close() got = self.pt.convertTo("audio/x-aiff", mid, filemane="DonaldBlue") got_meta = got.getMetadata() print "metadata returned : " + str(got_meta) self.assertEqual(got.getData(), aiff) self.assertEqual(got_meta["mimetype"], "audio/x-aiff") """
def test_aiff_to_mp3(self): fdAiff = open(output_file_path('DonaldBlue1.aiff'), "rb") aiff = fdAiff.read() fdMP3 = open(output_file_path('DonaldBlue1.mp3'), "rb") mp3 = fdMP3.read() fdMP3.close() got = self.pt.convertTo('audio/mpeg', aiff) got_meta = got.getMetadata() print 'metadata returned : ' + str(got_meta) self.assertEqual(got.getData(), mp3) self.assertEqual(got_meta['mimetype'], 'audio/mpeg') """
def test_abc_to_mp3(self): fd = open(input_file_path('DonaldBlue.abc'), "r") abc = fd.read() # print self.mtr.classify(abc) fdmp3 = open(output_file_path('DonaldBlue1.mp3'), "rb") mp3 = fdmp3.read() fdmp3.close() got = self.pt.convertTo('audio/mpeg', abc) got_meta = got.getMetadata() print 'metadata returned : ' + str(got_meta) self.assertEqual(mp3, got.getData()) self.assertEqual(got_meta['mimetype'], 'audio/mpeg') """
def test_ps_to_pdf(self): """ .. note: Because creation date, command line, filenames, etc... are part of postscript file, it isn't possible to compare files !!! ;-( """ fdps = open(output_file_path('DonaldBlue.ps'), "rb") ps = fdps.read() fdps.close() got = self.pt.convertTo('application/pdf', ps) got_meta = got.getMetadata() print 'metadata returned : ' + str(got_meta) # self.assertEqual(ps, got.getData()) self.assertEqual(got_meta['mimetype'], 'application/pdf')
def test_abc_to_png(self): fabc = open(input_file_path('DonaldBlue.abc'), "rb") abc = fabc.read() fabc.close() got = self.pt.convertTo('image/png', abc, mimetype='text/vnd.abc') got_meta = got.getMetadata() print 'metadata returned : ' + str(got_meta) # self.assertEqual(ps, got.getData()) """ """ self.assertEqual(got_meta['mimetype'], 'image/png') fdgot = open(output_file_path('got.png'), "wb") fdgot.write(got.getData()) fdgot.close() """ """
class TransformTestSubclass(TransformTest): input = input_file_path(tr_input) output = output_file_path(tr_output) transform = _transform normalize = lambda x, y: _normalize(y) subobjects = _subobjects