1
0
mirror of https://github.com/ilri/csv-metadata-quality.git synced 2024-12-10 14:32:18 +01:00

tests/test_check.py: Add test for duplicate items

This commit is contained in:
Alan Orth 2021-03-17 09:54:02 +02:00
parent 9f2dc0a0f5
commit e8422bfa74
Signed by: alanorth
GPG Key ID: 0FB860CC9C45B1B9

View File

@ -316,3 +316,26 @@ def test_check_invalid_spdx_license_identifier(capsys):
captured.out
== f"{Fore.YELLOW}Non-SPDX license identifier: {Fore.RESET}{license}\n"
)
def test_check_duplicate_item(capsys):
"""Test item with duplicate title, type, and date."""
item_title = "Title"
item_type = "Report"
item_date = "2021-03-17"
d = {
"dc.title": [item_title, item_title],
"dcterms.type": [item_type, item_type],
"dcterms.issued": [item_date, item_date],
}
df = pd.DataFrame(data=d)
result = check.duplicate_items(df)
captured = capsys.readouterr()
assert (
captured.out
== f"{Fore.YELLOW}Possible duplicate (dc.title): {Fore.RESET}{item_title}\n"
)