-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
555 additions
and
22 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
import pytest | ||
|
||
import metsrw | ||
|
||
|
||
GOOD_PATHS_SLASH_URLS = ( | ||
'30_CFLQ_271_13-3-13_1524[1].pdf', | ||
'30/CFLQ_271_13-3-13_1524[1].pdf', | ||
r'30\ CFLQ_271_13-3-13_1524[1].pdf', | ||
'/foo/bar[baz/hello', # urllib.urlparse will accept this because it's a URL with just a path. | ||
'http://foobar.com/hello[1].pdf', | ||
) | ||
|
||
# urllib.urlparse will choke on these and raise ValueError because of the | ||
# unbalanced bracket in the netloc part. | ||
BAD_URLS = ( | ||
'http://foo[bar.com/hello[1].pdf', | ||
) | ||
|
||
|
||
def test_url_encoding(): | ||
for url in GOOD_PATHS_SLASH_URLS: | ||
assert url == metsrw.urldecode(metsrw.urlencode(url)) | ||
for url in BAD_URLS: | ||
with pytest.raises(ValueError): | ||
metsrw.urlencode(url) |