Ejemplo n.º 1
0
    def test_datacite_get_pub_date(self):
        # Do not use support files, only APIs
        df_1 = DataCiteResourceFinder()
        self.assertIn("2019-05-27", df_1.get_pub_date("10.6092/issn.2532-8816/8555"))
        self.assertNotEqual("2019", df_1.get_pub_date("10.6092/issn.2532-8816/8555"))

        # Do use support files, but avoid using APIs
        df_2 = DataCiteResourceFinder(date=CSVManager(self.date_path),
                                      doi=CSVManager(self.doi_path), use_api_service=False)
        self.assertIn("2019-05-27", df_2.get_pub_date("10.6092/issn.2532-8816/8555"))
        self.assertNotEqual("2018-01-02", df_2.get_pub_date("10.6092/issn.2532-8816/8555"))

        # Do not use support files neither APIs
        df_3 = DataCiteResourceFinder(use_api_service=False)
        self.assertIsNone(df_3.get_pub_date("10.6092/issn.2532-8816/8555"))
Ejemplo n.º 2
0
def execute_workflow(idbaseurl, baseurl, python, pclass, input, doi_file,
                     date_file, orcid_file, issn_file, orcid, lookup, data,
                     prefix, agent, source, service, verbose, no_api):
    # Create the support file for handling information about bibliographic resources
    valid_doi, id_date, id_orcid, id_issn = create_csv(doi_file, date_file,
                                                       orcid_file, issn_file)

    doi_manager = DOIManager(valid_doi, use_api_service=not no_api)
    crossref_rf = CrossrefResourceFinder(date=id_date,
                                         orcid=id_orcid,
                                         issn=id_issn,
                                         doi=valid_doi,
                                         use_api_service=not no_api)
    datacite_rf = DataCiteResourceFinder(date=id_date,
                                         orcid=id_orcid,
                                         issn=id_issn,
                                         doi=valid_doi,
                                         use_api_service=not no_api)
    orcid_rf = ORCIDResourceFinder(
        date=id_date,
        orcid=id_orcid,
        issn=id_issn,
        doi=valid_doi,
        use_api_service=True if orcid is not None and not no_api else False,
        key=orcid)

    rf_handler = ResourceFinderHandler([crossref_rf, datacite_rf, orcid_rf])
    return extract_citations(idbaseurl, baseurl, python, pclass, input, lookup,
                             data, prefix, agent, source, service, verbose,
                             doi_manager, rf_handler)
Ejemplo n.º 3
0
 def test_handler_get_date(self):
     handler = ResourceFinderHandler([
         CrossrefResourceFinder(),
         DataCiteResourceFinder(),
         ORCIDResourceFinder()
     ])
     self.assertEqual("2019-05-27",
                      handler.get_date("10.6092/issn.2532-8816/8555"))
     self.assertNotEqual("2019-05-27",
                         handler.get_date("10.1108/jd-12-2013-0166"))
Ejemplo n.º 4
0
 def test_handler_share_orcid(self):
     handler = ResourceFinderHandler([
         CrossrefResourceFinder(),
         DataCiteResourceFinder(),
         ORCIDResourceFinder()
     ])
     self.assertTrue(
         handler.share_orcid("10.1007/s11192-018-2988-z",
                             "10.5281/zenodo.3344898"))
     self.assertFalse(
         handler.share_issn("10.1007/s11192-018-2988-z",
                            "10.1007/s11192-015-1565-y5"))
Ejemplo n.º 5
0
 def test_handler_share_issn(self):
     handler = ResourceFinderHandler([
         CrossrefResourceFinder(),
         DataCiteResourceFinder(),
         ORCIDResourceFinder()
     ])
     self.assertTrue(
         handler.share_issn("10.1007/s11192-018-2988-z",
                            "10.1007/s11192-015-1565-y"))
     self.assertFalse(
         handler.share_issn("10.1007/s11192-018-2988-z",
                            "10.6092/issn.2532-8816/8555"))
Ejemplo n.º 6
0
    def test_datacite_get_issn(self):
        # Do not use support files, only APIs
        df_1 = DataCiteResourceFinder()
        self.assertIn("2197-6775", df_1.get_container_issn("10.14763/2019.1.1389"))
        self.assertNotIn("1588-2861", df_1.get_container_issn("10.14763/2019.1.1389"))

        # Do use support files, but avoid using APIs
        df_2 = DataCiteResourceFinder(issn=CSVManager(self.issn_path),
                                      doi=CSVManager(self.doi_path), use_api_service=False)
        self.assertIn("2197-6775", df_2.get_container_issn("10.14763/2019.1.1389"))
        self.assertNotIn("1588-2861", df_2.get_container_issn("10.14763/2019.1.1389"))

        # Do not use support files neither APIs
        df_3 = DataCiteResourceFinder(use_api_service=False)
        self.assertIsNone(df_3.get_container_issn("10.14763/2019.1.1389"))
Ejemplo n.º 7
0
    def test_datacite_get_orcid(self):
        # Do not use support files, only APIs
        df_1 = DataCiteResourceFinder()
        self.assertIn("0000-0001-7734-8388", df_1.get_orcid("10.5065/d6b8565d"))
        self.assertNotIn("0000-0001-5506-523X", df_1.get_orcid("10.5065/d6b8565d"))

        # Do use support files, but avoid using APIs
        df_2 = DataCiteResourceFinder(orcid=CSVManager(self.orcid_path),
                                      doi=CSVManager(self.doi_path), use_api_service=False)
        self.assertIn("0000-0001-7734-8388", df_2.get_orcid("10.5065/d6b8565d"))
        self.assertNotIn("0000-0001-5506-523X", df_2.get_orcid("10.5065/d6b8565d"))

        # Do not use support files neither APIs
        df_3 = DataCiteResourceFinder(use_api_service=False)
        self.assertIsNone(df_3.get_orcid("10.5065/d6b8565d"))