Add initial tests

For now only test fixes because they return changed data. I'm not
sure how to test the checks, because they don't return data and I
can't modify them to return boolean values without breaking the app.
This commit is contained in:
Alan Orth 2019-07-27 00:36:40 +03:00
parent 103e630f6e
commit 41a30f1b07
Signed by: alanorth
GPG Key ID: 0FB860CC9C45B1B9
2 changed files with 23 additions and 0 deletions

0
tests/__init__.py Normal file
View File

23
tests/test_fix.py Normal file
View File

@ -0,0 +1,23 @@
import csv_metadata_quality.fix as fix
import pytest
def test_fix_leading_whitespace():
'''Test fixing leading whitespace.'''
value = ' Alan'
assert fix.whitespace(value) == 'Alan'
def test_fix_trailing_whitespace():
'''Test fixing trailing whitespace.'''
value = 'Alan '
assert fix.whitespace(value) == 'Alan'
def test_fix_excessive_whitespace():
'''Test fixing excessive whitespace.'''
value = 'Alan Orth'
assert fix.whitespace(value) == 'Alan Orth'