def test_02_record(self): r = Record() r.upload_id = "1234" r.upload_pos = "234" r.set_source_data(university="my uni", pmcid="PMC12345678", pmid="98765432", doi="10.whatever", publisher="wiley", journal_title="Journal of things", article_title="A study of sorts", apc=100, wellcome_apc=200, vat=20, total_cost=300, grant_code="WELL01", licence_info="CC BY", notes="this is a note") r.pmcid = "PMC12345678" r.pmid = "98765432" r.doi = "10.whatever" r.title = "A study of sorts" r.has_ft_xml = True r.aam_from_xml = False r.aam_from_epmc = True r.issn = "1234-5678" r.in_oag = True r.oag_pmcid = "not_sent" r.oag_doi = "sent" r.oag_pmid = "fto" r.in_epmc = True r.is_oa = False r.aam = True r.licence_type = "CC BY" r.licence_source = "epmc" r.journal_type = "hybrid" r.confidence = "0.8" r.standard_compliance = True r.deluxe_compliance = False r.add_provenance("richard", "provenance 1") r.add_provenance("wellcome", "provenance 2") assert r.upload_id == "1234" assert r.upload_pos == 234 assert r.pmcid == "PMC12345678" assert r.pmid == "98765432" assert r.doi == "10.whatever" assert r.title == "A study of sorts" assert r.has_ft_xml assert not r.aam_from_xml assert r.aam_from_epmc assert len(r.issn) == 1 assert "1234-5678" in r.issn assert r.in_epmc assert not r.is_oa assert r.aam assert r.licence_type == "CC BY" assert r.licence_source == "epmc" assert r.journal_type == "hybrid" assert r.confidence == 0.8 assert r.standard_compliance assert not r.deluxe_compliance p = r.provenance assert len(p) == 2 for by, when, note in p: assert by in ["richard", "wellcome"] assert note in ["provenance 1", "provenance 2"]
def test_05_compliance(self): record = Record() # Truth table for standard and deluxe compliance # # Note: CC-BY column means CC-BY or CC0 # # in EPMC | AAM | CC BY | Licence in EPMC | is OA | S | D # 0 0 0 0 0 0 0 # 0 0 1 0 0 0 0 # 1 0 0 0 0 0 0 # 1 0 0 0 1 0 0 # 1 0 0 1 1 0 0 # 1 0 1 0 0 1 0 # 1 0 1 1 1 1 1 # 1 1 0 0 0 1 1 # 1 1 1 0 0 1 1 # 1 1 1 1 1 1 1 # check the default values, before we've done anything to the record assert record.deluxe_compliance is False assert record.standard_compliance is False # set the various switches, and then check the results # in EPMC | AAM | CC BY | Licence in EPMC | is OA | S | D # 0 0 0 0 0 0 0 record.in_epmc = False record.aam = False record.licence_type = "Other" record.licence_source = "publisher" record.is_oa = False assert record.deluxe_compliance is False assert record.standard_compliance is False # in EPMC | AAM | CC BY | Licence in EPMC | is OA | S | D # 0 0 1 0 0 0 0 record.licence_type = "cc-by" assert record.deluxe_compliance is False assert record.standard_compliance is False # in EPMC | AAM | CC BY | Licence in EPMC | is OA | S | D # 1 0 0 0 0 0 0 record.in_epmc = True record.licence_type = "Other" assert record.deluxe_compliance is False assert record.standard_compliance is False # in EPMC | AAM | CC BY | Licence in EPMC | is OA | S | D # 1 0 0 0 1 0 0 record.is_oa = True assert record.deluxe_compliance is False assert record.standard_compliance is False # in EPMC | AAM | CC BY | Licence in EPMC | is OA | S | D # 1 0 0 1 1 0 0 record.licence_source = "epmc_xml" assert record.deluxe_compliance is False assert record.standard_compliance is False # in EPMC | AAM | CC BY | Licence in EPMC | is OA | S | D # 1 0 1 0 0 1 0 record.licence_type = "CC0" record.licence_source = "publisher" record.is_oa = False assert record.deluxe_compliance is False assert record.standard_compliance is True # in EPMC | AAM | CC BY | Licence in EPMC | is OA | S | D # 1 0 1 1 1 1 1 record.licence_type = "cc-by" record.licence_source = "epmc" record.is_oa = True assert record.deluxe_compliance is True assert record.standard_compliance is True # in EPMC | AAM | CC BY | Licence in EPMC | is OA | S | D # 1 1 0 0 0 1 1 record.aam = True record.licence_type = "Other" record.licence_source = "publisher" assert record.deluxe_compliance is True assert record.standard_compliance is True # in EPMC | AAM | CC BY | Licence in EPMC | is OA | S | D # 1 1 1 0 0 1 1 record.licence_type = "CC-BY" assert record.deluxe_compliance is True assert record.standard_compliance is True # in EPMC | AAM | CC BY | Licence in EPMC | is OA | S | D # 1 1 1 1 1 1 1 record.licence_source = "epmc_xml" record.is_oa = True assert record.deluxe_compliance is True assert record.standard_compliance is True
def test_02_record(self): r = Record() r.upload_id = "1234" r.upload_pos = "234" r.set_source_data( pmcid="PMC12345678", pmid="98765432", doi="10.whatever", article_title="A study of sorts", ) r.pmcid = "PMC12345678" r.pmid = "98765432" r.doi = "10.whatever" r.title = "A study of sorts" r.has_ft_xml = True r.aam_from_xml = False r.aam_from_epmc = True r.issn = "1234-5678" r.in_oag = True r.oag_pmcid = "not_sent" r.oag_doi = "sent" r.oag_pmid = "fto" r.in_epmc = True r.is_oa = False r.aam = True r.licence_type = "CC BY" r.licence_source = "epmc" r.journal_type = "hybrid" r.confidence = "0.8" r.add_provenance("richard", "provenance 1") r.add_provenance("wellcome", "provenance 2") r.publisher = "The Publisher" r.preprint_self_archive = "can" r.journal_preprint_embargo = "12 months" r.postprint_self_archive = "may" r.journal_postprint_embargo = "6 months" r.publisher_self_archive = "cannot" r.journal_publisher_embargo = "100 years" r.in_core = True assert r.upload_id == "1234" assert r.upload_pos == 234 assert r.pmcid == "PMC12345678" assert r.pmid == "98765432" assert r.doi == "10.whatever" assert r.title == "A study of sorts" assert r.has_ft_xml assert not r.aam_from_xml assert r.aam_from_epmc assert len(r.issn) == 1 assert "1234-5678" in r.issn assert r.in_epmc assert not r.is_oa assert r.aam assert r.licence_type == "CC BY" assert r.licence_source == "epmc" assert r.journal_type == "hybrid" assert r.confidence == 0.8 assert r.preprint_self_archive == "can" assert r.journal_preprint_embargo == "12 months" assert r.postprint_self_archive == "may" assert r.journal_postprint_embargo == "6 months" assert r.publisher_self_archive == "cannot" assert r.journal_publisher_embargo == "100 years" assert r.in_core p = r.provenance assert len(p) == 2 for by, when, note in p: assert by in ["richard", "wellcome"] assert note in ["provenance 1", "provenance 2"]