From 0d2428737223fd79857457f7986da9c199d9d4fa Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 14 Apr 2025 08:56:57 -0500 Subject: Rename test module. --- tests/uploader/phenotypes/test_edit_bulk_upload.py | 67 ---------------------- tests/uploader/phenotypes/test_misc.py | 67 ++++++++++++++++++++++ 2 files changed, 67 insertions(+), 67 deletions(-) delete mode 100644 tests/uploader/phenotypes/test_edit_bulk_upload.py create mode 100644 tests/uploader/phenotypes/test_misc.py (limited to 'tests') diff --git a/tests/uploader/phenotypes/test_edit_bulk_upload.py b/tests/uploader/phenotypes/test_edit_bulk_upload.py deleted file mode 100644 index 7a52941..0000000 --- a/tests/uploader/phenotypes/test_edit_bulk_upload.py +++ /dev/null @@ -1,67 +0,0 @@ -"""Tests for functions used for bulk editing.""" -import pytest - -from uploader.publications.misc import publications_differences - - -@pytest.mark.unit_test -@pytest.mark.parametrize( - "filedata,dbdata,pubmed2pubidmap,expected", - (((), (), {}, tuple()), # no data - - # Same Data - (({"phenotype_id": 1, "xref_id": 10001, "PubMed_ID": 9999999999999}, - {"phenotype_id": 1, "xref_id": 10002, "PubMed_ID": 9999999999999}, - {"phenotype_id": 1, "xref_id": 10003, "PubMed_ID": 9999999999999}, - {"phenotype_id": 1, "xref_id": 10005, "PubMed_ID": 9999999999999}), - ({"PhenotypeId": 1, "xref_id": 10001, "PublicationId": 15, - "PubMed_ID": 9999999999999}, - {"PhenotypeId": 1, "xref_id": 10002, "PublicationId": 15, - "PubMed_ID": 9999999999999}, - {"PhenotypeId": 1, "xref_id": 10003, "PublicationId": 15, - "PubMed_ID": 9999999999999}, - {"PhenotypeId": 1, "xref_id": 10004, "PublicationId": 15, - "PubMed_ID": 9999999999999}), - {9999999999999: 15}, - tuple()), - - # Differences: no new pubmeds (all pubmeds in db) - (({"phenotype_id": 1, "xref_id": 10001, "PubMed_ID": 9999999999999}, - {"phenotype_id": 1, "xref_id": 10002, "PubMed_ID": 9999999999998}, - {"phenotype_id": 1, "xref_id": 10003, "PubMed_ID": 9999999999999}, - {"phenotype_id": 1, "xref_id": 10004, "PubMed_ID": 9999999999997}), - ({"PhenotypeId": 1, "xref_id": 10001, "PublicationId": 15, - "PubMed_ID": 9999999999999}, - {"PhenotypeId": 1, "xref_id": 10002, "PublicationId": 15, - "PubMed_ID": 9999999999999}, - {"PhenotypeId": 1, "xref_id": 10003, "PublicationId": 15, - "PubMed_ID": 9999999999999}, - {"PhenotypeId": 1, "xref_id": 10004, "PublicationId": 15, - "PubMed_ID": None}), - {9999999999999: 15, 9999999999998: 18, 9999999999997: 12}, - ({"PhenotypeId": 1, "xref_id": 10002, "PublicationId": 18, - "PubMed_ID": 9999999999998}, - {"PhenotypeId": 1, "xref_id": 10004, "PublicationId": 12, - "PubMed_ID": 9999999999997})), - - # Differences: Deletions of pubmeds - (({"phenotype_id": 1, "xref_id": 10001, "PubMed_ID": 9999999999999}, - {"phenotype_id": 1, "xref_id": 10002, "PubMed_ID": None}, - {"phenotype_id": 1, "xref_id": 10003, "PubMed_ID": 9999999999999}, - {"phenotype_id": 1, "xref_id": 10004, "PubMed_ID": None}), - ({"PhenotypeId": 1, "xref_id": 10001, "PublicationId": 15, - "PubMed_ID": 9999999999999}, - {"PhenotypeId": 1, "xref_id": 10002, "PublicationId": 15, - "PubMed_ID": 9999999999999}, - {"PhenotypeId": 1, "xref_id": 10003, "PublicationId": 15, - "PubMed_ID": 9999999999999}, - {"PhenotypeId": 1, "xref_id": 10004, "PublicationId": 15, - "PubMed_ID": 9999999999999}), - {9999999999999: 15, 9999999999998: 18, 9999999999997: 12}, - ({"PhenotypeId": 1, "xref_id": 10002, "PublicationId": None, - "PubMed_ID": None}, - {"PhenotypeId": 1, "xref_id": 10004, "PublicationId": None, - "PubMed_ID": None})))) -def test_publications_differences(filedata, dbdata, pubmed2pubidmap, expected): - assert publications_differences( - filedata, dbdata, pubmed2pubidmap) == expected diff --git a/tests/uploader/phenotypes/test_misc.py b/tests/uploader/phenotypes/test_misc.py new file mode 100644 index 0000000..7a52941 --- /dev/null +++ b/tests/uploader/phenotypes/test_misc.py @@ -0,0 +1,67 @@ +"""Tests for functions used for bulk editing.""" +import pytest + +from uploader.publications.misc import publications_differences + + +@pytest.mark.unit_test +@pytest.mark.parametrize( + "filedata,dbdata,pubmed2pubidmap,expected", + (((), (), {}, tuple()), # no data + + # Same Data + (({"phenotype_id": 1, "xref_id": 10001, "PubMed_ID": 9999999999999}, + {"phenotype_id": 1, "xref_id": 10002, "PubMed_ID": 9999999999999}, + {"phenotype_id": 1, "xref_id": 10003, "PubMed_ID": 9999999999999}, + {"phenotype_id": 1, "xref_id": 10005, "PubMed_ID": 9999999999999}), + ({"PhenotypeId": 1, "xref_id": 10001, "PublicationId": 15, + "PubMed_ID": 9999999999999}, + {"PhenotypeId": 1, "xref_id": 10002, "PublicationId": 15, + "PubMed_ID": 9999999999999}, + {"PhenotypeId": 1, "xref_id": 10003, "PublicationId": 15, + "PubMed_ID": 9999999999999}, + {"PhenotypeId": 1, "xref_id": 10004, "PublicationId": 15, + "PubMed_ID": 9999999999999}), + {9999999999999: 15}, + tuple()), + + # Differences: no new pubmeds (all pubmeds in db) + (({"phenotype_id": 1, "xref_id": 10001, "PubMed_ID": 9999999999999}, + {"phenotype_id": 1, "xref_id": 10002, "PubMed_ID": 9999999999998}, + {"phenotype_id": 1, "xref_id": 10003, "PubMed_ID": 9999999999999}, + {"phenotype_id": 1, "xref_id": 10004, "PubMed_ID": 9999999999997}), + ({"PhenotypeId": 1, "xref_id": 10001, "PublicationId": 15, + "PubMed_ID": 9999999999999}, + {"PhenotypeId": 1, "xref_id": 10002, "PublicationId": 15, + "PubMed_ID": 9999999999999}, + {"PhenotypeId": 1, "xref_id": 10003, "PublicationId": 15, + "PubMed_ID": 9999999999999}, + {"PhenotypeId": 1, "xref_id": 10004, "PublicationId": 15, + "PubMed_ID": None}), + {9999999999999: 15, 9999999999998: 18, 9999999999997: 12}, + ({"PhenotypeId": 1, "xref_id": 10002, "PublicationId": 18, + "PubMed_ID": 9999999999998}, + {"PhenotypeId": 1, "xref_id": 10004, "PublicationId": 12, + "PubMed_ID": 9999999999997})), + + # Differences: Deletions of pubmeds + (({"phenotype_id": 1, "xref_id": 10001, "PubMed_ID": 9999999999999}, + {"phenotype_id": 1, "xref_id": 10002, "PubMed_ID": None}, + {"phenotype_id": 1, "xref_id": 10003, "PubMed_ID": 9999999999999}, + {"phenotype_id": 1, "xref_id": 10004, "PubMed_ID": None}), + ({"PhenotypeId": 1, "xref_id": 10001, "PublicationId": 15, + "PubMed_ID": 9999999999999}, + {"PhenotypeId": 1, "xref_id": 10002, "PublicationId": 15, + "PubMed_ID": 9999999999999}, + {"PhenotypeId": 1, "xref_id": 10003, "PublicationId": 15, + "PubMed_ID": 9999999999999}, + {"PhenotypeId": 1, "xref_id": 10004, "PublicationId": 15, + "PubMed_ID": 9999999999999}), + {9999999999999: 15, 9999999999998: 18, 9999999999997: 12}, + ({"PhenotypeId": 1, "xref_id": 10002, "PublicationId": None, + "PubMed_ID": None}, + {"PhenotypeId": 1, "xref_id": 10004, "PublicationId": None, + "PubMed_ID": None})))) +def test_publications_differences(filedata, dbdata, pubmed2pubidmap, expected): + assert publications_differences( + filedata, dbdata, pubmed2pubidmap) == expected -- cgit v1.2.3