def test_it_returns_none_if_invalid(self, doi): assert doi_uri_from_string(doi) is None
def test_it_strips_whitespace(self, doi): assert doi_uri_from_string(doi) == re.sub('\\s+', '', doi)
def test_it_allows_doi_urls(self, url): # Many sites store DOI URLs rather than just identifiers in DOI fields. # We should ideally normalize the different forms, but for now we just # continue to accept them. assert doi_uri_from_string(url) == 'doi:{}'.format(url)
def test_it_prepends_doi_prefix(self, doi): assert doi_uri_from_string(doi) == 'doi:{}'.format( strip_prefix('doi:', doi))
def test_it_strips_whitespace(self, doi): assert doi_uri_from_string(doi) == re.sub("\\s+", "", doi)
def test_it_prepends_doi_prefix(self, doi): assert doi_uri_from_string(doi) == "doi:{}".format( strip_prefix("doi:", doi))
def test_it_prepends_doi_prefix(self, doi): assert doi_uri_from_string(doi) == f"doi:{strip_prefix('doi:', doi)}"