1
0
mirror of https://github.com/ilri/csv-metadata-quality.git synced 2024-11-22 13:55:03 +01:00

Add tests for unnecessary multi-value separators

This commit is contained in:
Alan Orth 2021-01-03 15:37:18 +02:00
parent 32cea2055f
commit 29e67a0887
Signed by: alanorth
GPG Key ID: 0FB860CC9C45B1B9
2 changed files with 23 additions and 0 deletions

View File

@ -59,6 +59,19 @@ def test_check_invalid_separators(capsys):
assert captured.out == f"Invalid multi-value separator ({field_name}): {value}\n" assert captured.out == f"Invalid multi-value separator ({field_name}): {value}\n"
def test_check_unnecessary_separators(capsys):
"""Test checking unnecessary multi-value separators."""
field = "Alan||Orth||"
field_name = "dc.contributor.author"
check.separators(field, field_name)
captured = capsys.readouterr()
assert captured.out == f"Unnecessary multi-value separator ({field_name}): {field}\n"
def test_check_valid_separators(): def test_check_valid_separators():
"""Test checking valid multi-value separators.""" """Test checking valid multi-value separators."""

View File

@ -41,6 +41,16 @@ def test_fix_invalid_separators():
assert fix.separators(value, field_name) == "Alan||Orth" assert fix.separators(value, field_name) == "Alan||Orth"
def test_fix_unnecessary_separators():
"""Test fixing unnecessary multi-value separators."""
field = "Alan||Orth||"
field_name = "dc.contributor.author"
assert fix.separators(field, field_name) == "Alan||Orth"
def test_fix_unnecessary_unicode(): def test_fix_unnecessary_unicode():
"""Test fixing unnecessary Unicode.""" """Test fixing unnecessary Unicode."""