def test_extract_uris(self): identifiers = ['doi:10.whateverwhatever', 'http://alloutofbubblegum.com', 'http://viewcontent.cgi/iamacoolpdf', 'http://GETTHETABLES.com'] uri_dict = helpers.oai_process_uris(identifiers) assert uri_dict == { 'canonicalUri': 'http://alloutofbubblegum.com', 'objectUris': ['http://dx.doi.org/10.whateverwhatever', 'http://viewcontent.cgi/iamacoolpdf'], 'providerUris': ['http://alloutofbubblegum.com', 'http://GETTHETABLES.com'] }
def format_uris_pubmedcentral(*args): uris = helpers.oai_process_uris(*args) for arg in args: try: if "oai:pubmedcentral.nih.gov:" in arg[0]: PMC_ID = arg[0].replace("oai:pubmedcentral.nih.gov:", "") uris["canonicalUri"] = "http://www.ncbi.nlm.nih.gov/pmc/articles/PMC" + PMC_ID except IndexError: pass return uris
def test_extract_uris_use_doi(self): identifiers = ['doi:10.whateverwhatever', 'http://alloutofbubblegum.com', 'http://viewcontent.cgi/iamacoolpdf', 'http://GETTHETABLES.com', 'Vahedifard, F. et al. (2013). G??otechnique 63, No. 6, 451???462 [http://dx.doi.org/10.1680/geot.11.P.130] ', 'I am a bunch of text but I also have a doi:10.10.thisisarealdoi'] uri_dict = helpers.oai_process_uris(identifiers, use_doi=True) assert uri_dict == { 'canonicalUri': 'http://dx.doi.org/10.10.thisisarealdoi', 'objectUris': ['http://dx.doi.org/10.whateverwhatever', 'http://dx.doi.org/10.1680/geot.11.P.130', 'http://dx.doi.org/10.10.thisisarealdoi', 'http://viewcontent.cgi/iamacoolpdf'], 'providerUris': ['http://alloutofbubblegum.com', 'http://GETTHETABLES.com'] }
def test_extract_uris_use_doi(self): identifiers = [ 'doi:10.whateverwhatever', 'http://alloutofbubblegum.com', 'http://viewcontent.cgi/iamacoolpdf', 'http://GETTHETABLES.com', 'Vahedifard, F. et al. (2013). G??otechnique 63, No. 6, 451???462 [http://dx.doi.org/10.1680/geot.11.P.130] ', 'I am a bunch of text but I also have a doi:10.10.thisisarealdoi' ] uri_dict = helpers.oai_process_uris(identifiers, use_doi=True) assert uri_dict == { 'canonicalUri': 'http://dx.doi.org/10.10.thisisarealdoi', 'objectUris': [ 'http://dx.doi.org/10.whateverwhatever', 'http://dx.doi.org/10.1680/geot.11.P.130', 'http://dx.doi.org/10.10.thisisarealdoi', 'http://viewcontent.cgi/iamacoolpdf' ], 'providerUris': ['http://alloutofbubblegum.com', 'http://GETTHETABLES.com'] }