2019-07-26 23:36:40 +02:00
|
|
|
import csv_metadata_quality.fix as fix
|
|
|
|
|
2019-07-28 16:47:28 +02:00
|
|
|
|
2019-07-26 23:36:40 +02:00
|
|
|
def test_fix_leading_whitespace():
|
|
|
|
'''Test fixing leading whitespace.'''
|
|
|
|
|
|
|
|
value = ' Alan'
|
|
|
|
|
|
|
|
assert fix.whitespace(value) == 'Alan'
|
|
|
|
|
2019-07-28 16:47:28 +02:00
|
|
|
|
2019-07-26 23:36:40 +02:00
|
|
|
def test_fix_trailing_whitespace():
|
|
|
|
'''Test fixing trailing whitespace.'''
|
|
|
|
|
|
|
|
value = 'Alan '
|
|
|
|
|
|
|
|
assert fix.whitespace(value) == 'Alan'
|
|
|
|
|
2019-07-28 16:47:28 +02:00
|
|
|
|
2019-07-26 23:36:40 +02:00
|
|
|
def test_fix_excessive_whitespace():
|
|
|
|
'''Test fixing excessive whitespace.'''
|
|
|
|
|
|
|
|
value = 'Alan Orth'
|
|
|
|
|
|
|
|
assert fix.whitespace(value) == 'Alan Orth'
|
2019-07-28 21:53:39 +02:00
|
|
|
|
|
|
|
|
|
|
|
def test_fix_invalid_separators():
|
|
|
|
'''Test fixing invalid multi-value separators.'''
|
|
|
|
|
|
|
|
value = 'Alan|Orth'
|
|
|
|
|
|
|
|
assert fix.separators(value) == 'Alan||Orth'
|