mirror of
https://github.com/ilri/csv-metadata-quality.git
synced 2024-11-22 22:05:03 +01:00
tests/test_check.py: Update date tests
This commit is contained in:
parent
ed5612fbcf
commit
e7cb8920db
@ -69,10 +69,12 @@ def test_check_missing_date(capsys):
|
|||||||
|
|
||||||
value = None
|
value = None
|
||||||
|
|
||||||
check.date(value)
|
field_name = 'dc.date.issued'
|
||||||
|
|
||||||
|
check.date(value, field_name)
|
||||||
|
|
||||||
captured = capsys.readouterr()
|
captured = capsys.readouterr()
|
||||||
assert captured.out == f'Missing date.\n'
|
assert captured.out == f'Missing date ({field_name}).\n'
|
||||||
|
|
||||||
|
|
||||||
def test_check_multiple_dates(capsys):
|
def test_check_multiple_dates(capsys):
|
||||||
@ -80,10 +82,12 @@ def test_check_multiple_dates(capsys):
|
|||||||
|
|
||||||
value = '1990||1991'
|
value = '1990||1991'
|
||||||
|
|
||||||
check.date(value)
|
field_name = 'dc.date.issued'
|
||||||
|
|
||||||
|
check.date(value, field_name)
|
||||||
|
|
||||||
captured = capsys.readouterr()
|
captured = capsys.readouterr()
|
||||||
assert captured.out == f'Multiple dates not allowed: {value}\n'
|
assert captured.out == f'Multiple dates not allowed ({field_name}): {value}\n'
|
||||||
|
|
||||||
|
|
||||||
def test_check_invalid_date(capsys):
|
def test_check_invalid_date(capsys):
|
||||||
@ -91,10 +95,12 @@ def test_check_invalid_date(capsys):
|
|||||||
|
|
||||||
value = '1990-0'
|
value = '1990-0'
|
||||||
|
|
||||||
check.date(value)
|
field_name = 'dc.date.issued'
|
||||||
|
|
||||||
|
check.date(value, field_name)
|
||||||
|
|
||||||
captured = capsys.readouterr()
|
captured = capsys.readouterr()
|
||||||
assert captured.out == f'Invalid date: {value}\n'
|
assert captured.out == f'Invalid date ({field_name}): {value}\n'
|
||||||
|
|
||||||
|
|
||||||
def test_check_valid_date():
|
def test_check_valid_date():
|
||||||
@ -102,7 +108,9 @@ def test_check_valid_date():
|
|||||||
|
|
||||||
value = '1990'
|
value = '1990'
|
||||||
|
|
||||||
result = check.date(value)
|
field_name = 'dc.date.issued'
|
||||||
|
|
||||||
|
result = check.date(value, field_name)
|
||||||
|
|
||||||
assert result == value
|
assert result == value
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user