kopia lustrzana https://github.com/jupyterhub/repo2docker
add support for Figshare versions > 9
rodzic
698b8a1d7e
commit
f1ec646d2e
|
@ -39,7 +39,7 @@ class Figshare(DoiProvider):
|
|||
}
|
||||
]
|
||||
|
||||
url_regex = re.compile(r"(.*)/articles/([^/]+)/(\d+)(/)?(\d)?")
|
||||
url_regex = re.compile(r"(.*)/articles/([^/]+)/(\d+)(/)?(\d+)?")
|
||||
|
||||
def detect(self, doi, ref=None, extra_args=None):
|
||||
"""Trigger this provider for things that resolve to a Figshare article"""
|
||||
|
|
|
@ -21,6 +21,17 @@ def test_content_id():
|
|||
fig.detect("10.6084/m9.figshare.9782777")
|
||||
assert fig.content_id == "9782777"
|
||||
|
||||
fig.detect("10.6084/m9.figshare.9782777.v123")
|
||||
assert fig.content_id == "9782777"
|
||||
|
||||
|
||||
def test_content_version():
|
||||
with patch.object(Figshare, "urlopen") as fake_urlopen:
|
||||
fake_urlopen.return_value.url = "https://figshare.com/articles/title/9782777/2"
|
||||
fig = Figshare()
|
||||
fig.detect("10.6084/m9.figshare.9782777.v2")
|
||||
assert fig.content_version == "2"
|
||||
|
||||
|
||||
test_fig = Figshare()
|
||||
test_fig.article_id = "123456"
|
||||
|
|
Ładowanie…
Reference in New Issue