Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion to fix: Validation warning handling None values #51

Open
llikaj17 opened this issue Jan 25, 2021 · 0 comments
Open

Suggestion to fix: Validation warning handling None values #51

llikaj17 opened this issue Jan 25, 2021 · 0 comments

Comments

@llikaj17
Copy link

llikaj17 commented Jan 25, 2021

Validation error doesn't print row, column and value if value is None.

For instance, for DateType checks which should handle null values, the error printed is as follows:

0,This field should be date type
instead of
0,"{row: 1, column: ""Date_column""}: ""None"" This field should be date type"

This issue is due to ValidationWarning class (in validation_warning.py) which is ignoring None for the value and prints the generic message. Instead of ignoring None for the value, we could change the value to string in order to print the row and column as it should.

Before:

# line 19: ValidationWarning at validation_warning.py
if self.row is not None and self.column is not None and self.value is not None:
        return '{{row: {}, column: "{}"}}: "{}" {}'.format(self.row, self.column, self.value, self.message)
else:
        return self.message

After:

# line 19: ValidationWarning at validation_warning.py
if self.row is not None and self.column is not None:
        value = self.value if self.value is not None else "None"
        return '{{row: {}, column: "{}"}}: "{}" {}'.format(self.row, self.column, value, self.message)
else:
        return self.message
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant