def __init__(self, schema, attribute, row=None): pretty_schema = json.dumps(json.loads(str(schema)), indent=2) if row: self.message = "Attribute {} from row {} is not expected in schema {}"\ .format(attribute, str(row), pretty_schema) else: self.message = "Attribute {} is not expected in schema {}".format(attribute, pretty_schema)
def __init__(self, schema, field_type, types_list): pretty_schema = json.dumps(json.loads(str(schema)), indent=2) self.message = "Field type {} from {} list not expected. Schema dump: {}"\ .format(field_type, types_list, pretty_schema)