def is_doi_str(self, string): cleaned_doi = doi_utils.clean_doi(string).lower().strip() if cleaned_doi != string: return True elif cleaned_doi.startswith('doi:'): return True else: return False
def test_clean_doi(): https_doi = "https://doi.org/10.1007/s10530-018-1696-1" http_doi = "http://dx.doi.org/10.1007/s10530-018-1696-1" doi_doi = "doi.org/10.1007/s10530-018-1696-1" just_doi = "10.1007/s10530-018-1696-1" assert doi_utils.clean_doi(https_doi) == doi_utils.clean_doi(just_doi) assert doi_utils.clean_doi(http_doi) == doi_utils.clean_doi(just_doi) assert doi_utils.clean_doi(doi_doi) == doi_utils.clean_doi(just_doi)
def is_doi_str(self, string): if string.startswith("https://doi.org"): return True if string.startswith("doi.org"): return True if string.startswith("http://dx.doi.org"): return True if string.startswith("doi:"): return True cleaned_doi = doi_utils.clean_doi(string).lower().strip() if cleaned_doi.startswith("doi:"): return True return False