Пример #1
0
    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"]