From 87b19970517e0024e99b1709dde9744829e5c7c1 Mon Sep 17 00:00:00 2001 From: Alan Orth Date: Sun, 28 Jul 2019 17:47:28 +0300 Subject: [PATCH] Fix whitespace errors found by flake8 --- csv_metadata_quality/check.py | 2 +- csv_metadata_quality/fix.py | 2 +- tests/test_check.py | 3 ++- tests/test_fix.py | 3 +++ 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/csv_metadata_quality/check.py b/csv_metadata_quality/check.py index 0527153..82e771e 100755 --- a/csv_metadata_quality/check.py +++ b/csv_metadata_quality/check.py @@ -1,5 +1,6 @@ import pandas as pd + def issn(field): """Check if an ISSN is valid. @@ -71,7 +72,6 @@ def separators(field): if len(match) > 0: print(f'Invalid multi-value separator: {field}') - return field diff --git a/csv_metadata_quality/fix.py b/csv_metadata_quality/fix.py index 9a6fcc8..8144f4e 100755 --- a/csv_metadata_quality/fix.py +++ b/csv_metadata_quality/fix.py @@ -1,6 +1,7 @@ import pandas as pd import re + def whitespace(field): """Fix whitespace issues. @@ -34,4 +35,3 @@ def whitespace(field): new_field = '||'.join(values) return new_field - diff --git a/tests/test_check.py b/tests/test_check.py index 7f0cdf3..dad28d0 100644 --- a/tests/test_check.py +++ b/tests/test_check.py @@ -1,12 +1,13 @@ import csv_metadata_quality.check as check + def test_check_invalid_issn(capsys): '''Test checking invalid ISSN.''' value = '2321-2302' check.issn(value) - + captured = capsys.readouterr() assert captured.out == f'Invalid ISSN: {value}\n' diff --git a/tests/test_fix.py b/tests/test_fix.py index d3a0c8b..1241819 100644 --- a/tests/test_fix.py +++ b/tests/test_fix.py @@ -1,5 +1,6 @@ import csv_metadata_quality.fix as fix + def test_fix_leading_whitespace(): '''Test fixing leading whitespace.''' @@ -7,6 +8,7 @@ def test_fix_leading_whitespace(): assert fix.whitespace(value) == 'Alan' + def test_fix_trailing_whitespace(): '''Test fixing trailing whitespace.''' @@ -14,6 +16,7 @@ def test_fix_trailing_whitespace(): assert fix.whitespace(value) == 'Alan' + def test_fix_excessive_whitespace(): '''Test fixing excessive whitespace.'''