def test_with_ascii_file(self): # convert to ebcdic args = self.parser.parse_args( ["-s", "ascii", TEST_ASCII_MPE_PARAM_FILENAME]) _main(args) # convert back to ascii args = self.parser.parse_args([TEST_ASCII_MPE_PARAM_FILENAME + ".out"]) _main(args) # check that double converted file == original file with open(TEST_ASCII_MPE_PARAM_FILENAME + ".out.out", 'rb') as outfile: output_data = outfile.read() self.assertEqual(output_data, create_test_mpe_parameter_extract())
def test_with_ascii_file(self): # convert to ebcdic args = self.parser.parse_args(["-s", "ascii", TEST_ASCII_MPE_PARAM_FILENAME]) _main(args) # convert back to ascii args = self.parser.parse_args([TEST_ASCII_MPE_PARAM_FILENAME + ".out"]) _main(args) # check that double converted file == original file with open(TEST_ASCII_MPE_PARAM_FILENAME + ".out.out", 'rb') as outfile: output_data = outfile.read() self.assertEqual(output_data, create_test_mpe_parameter_extract())
def test_with_bad_filename(self): test_file = 'abc.txt' args = self.parser.parse_args([test_file]) # with self.assertRaises(SystemExit) as stat: # _main(args) # self.assertEquals(stat.exception.code, 8) self.assertRaises(SystemExit, lambda: _main(args))