def test_missing_format_keys(self): values = [{}, {"format_name": ""}, {"format_version": ""}] for attrs in values: self.write_file(attrs, self.path) with self.assertRaises(exceptions.FileFormatError): tszip.decompress(self.path) with self.assertRaises(exceptions.FileFormatError): tszip.print_summary(self.path)
def test_format_too_new(self): self.write_file({ "format_name": "tszip", "format_version": [2, 0] }, self.path) with self.assertRaises(exceptions.FileFormatError): tszip.decompress(self.path) with self.assertRaises(exceptions.FileFormatError): tszip.print_summary(self.path)
def test_bad_format_name(self): for bad_name in ["", "xyz", [1234]]: self.write_file( {"format_name": bad_name, "format_version": [1, 0]}, self.path ) with self.assertRaises(exceptions.FileFormatError): tszip.decompress(self.path) with self.assertRaises(exceptions.FileFormatError): tszip.print_summary(self.path)
def run_list(args): for file_arg in args.files: with check_load_errors(file_arg): tszip.print_summary(file_arg, args.verbosity)