def test_against_dmtx(self): """Compare the output of this library with that of dmtxwrite""" for string in MatrixTest.test_strings: encoder = DataMatrixEncoder(string) mine = encoder.get_ascii() if not os.path.exists(dmtxwrite_path): print "%r does not exist, skipping encoding tests" % dmtxwrite_path else: fin = os.popen("%s '%s'" % (dmtxwrite_path, string)) output = "" while True: line = fin.readline() if not line: break if line[0] == 'X': output += line self.assertEqual(output, mine)