mirror of
https://github.com/ilri/csv-metadata-quality.git
synced 2024-11-26 07:38:18 +01:00
tests/test_check.py: Add test for duplicate items
This commit is contained in:
parent
9f2dc0a0f5
commit
e8422bfa74
@ -316,3 +316,26 @@ def test_check_invalid_spdx_license_identifier(capsys):
|
|||||||
captured.out
|
captured.out
|
||||||
== f"{Fore.YELLOW}Non-SPDX license identifier: {Fore.RESET}{license}\n"
|
== 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"
|
||||||
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user