mirror of
https://github.com/ilri/csv-metadata-quality.git
synced 2024-11-22 05:45:02 +01:00
Fix whitespace errors found by flake8
This commit is contained in:
parent
c6e7d6d9b5
commit
87b1997051
@ -1,5 +1,6 @@
|
|||||||
import pandas as pd
|
import pandas as pd
|
||||||
|
|
||||||
|
|
||||||
def issn(field):
|
def issn(field):
|
||||||
"""Check if an ISSN is valid.
|
"""Check if an ISSN is valid.
|
||||||
|
|
||||||
@ -71,7 +72,6 @@ def separators(field):
|
|||||||
if len(match) > 0:
|
if len(match) > 0:
|
||||||
print(f'Invalid multi-value separator: {field}')
|
print(f'Invalid multi-value separator: {field}')
|
||||||
|
|
||||||
|
|
||||||
return field
|
return field
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import pandas as pd
|
import pandas as pd
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
|
||||||
def whitespace(field):
|
def whitespace(field):
|
||||||
"""Fix whitespace issues.
|
"""Fix whitespace issues.
|
||||||
|
|
||||||
@ -34,4 +35,3 @@ def whitespace(field):
|
|||||||
new_field = '||'.join(values)
|
new_field = '||'.join(values)
|
||||||
|
|
||||||
return new_field
|
return new_field
|
||||||
|
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
import csv_metadata_quality.check as check
|
import csv_metadata_quality.check as check
|
||||||
|
|
||||||
|
|
||||||
def test_check_invalid_issn(capsys):
|
def test_check_invalid_issn(capsys):
|
||||||
'''Test checking invalid ISSN.'''
|
'''Test checking invalid ISSN.'''
|
||||||
|
|
||||||
value = '2321-2302'
|
value = '2321-2302'
|
||||||
|
|
||||||
check.issn(value)
|
check.issn(value)
|
||||||
|
|
||||||
captured = capsys.readouterr()
|
captured = capsys.readouterr()
|
||||||
assert captured.out == f'Invalid ISSN: {value}\n'
|
assert captured.out == f'Invalid ISSN: {value}\n'
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import csv_metadata_quality.fix as fix
|
import csv_metadata_quality.fix as fix
|
||||||
|
|
||||||
|
|
||||||
def test_fix_leading_whitespace():
|
def test_fix_leading_whitespace():
|
||||||
'''Test fixing leading whitespace.'''
|
'''Test fixing leading whitespace.'''
|
||||||
|
|
||||||
@ -7,6 +8,7 @@ def test_fix_leading_whitespace():
|
|||||||
|
|
||||||
assert fix.whitespace(value) == 'Alan'
|
assert fix.whitespace(value) == 'Alan'
|
||||||
|
|
||||||
|
|
||||||
def test_fix_trailing_whitespace():
|
def test_fix_trailing_whitespace():
|
||||||
'''Test fixing trailing whitespace.'''
|
'''Test fixing trailing whitespace.'''
|
||||||
|
|
||||||
@ -14,6 +16,7 @@ def test_fix_trailing_whitespace():
|
|||||||
|
|
||||||
assert fix.whitespace(value) == 'Alan'
|
assert fix.whitespace(value) == 'Alan'
|
||||||
|
|
||||||
|
|
||||||
def test_fix_excessive_whitespace():
|
def test_fix_excessive_whitespace():
|
||||||
'''Test fixing excessive whitespace.'''
|
'''Test fixing excessive whitespace.'''
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user