def nbviewer_url(url): """Return the nbviewer url for the given url.""" link = utils.get_notebook_path(url) return resources.NBVIEWER_URL_TEMPLATE.format(link)
def test_params(self): url = "https://github.com/username/repo/test.ipynb?param=on" expected = "github.com/username/repo/test.ipynb" assert utils.get_notebook_path(url) == expected assert utils.get_notebook_path(urlparse(url)) == expected
def test_hash(self): url = "https://github.com/username/repo/test.ipynb#section1" expected = "github.com/username/repo/test.ipynb" assert utils.get_notebook_path(url) == expected assert utils.get_notebook_path(urlparse(url)) == expected
def test_www(self): url = "http://www.github.com/username/repo/test.ipynb" expected = "github.com/username/repo/test.ipynb" assert utils.get_notebook_path(url) == expected assert utils.get_notebook_path(urlparse(url)) == expected