forked from wkentaro/gdown
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace md5 with hash in cached_download function for any hash algorithm
- Loading branch information
Showing
3 changed files
with
100 additions
and
10 deletions.
There are no files selected for viewing
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,24 @@ | ||
import tempfile | ||
|
||
import gdown | ||
|
||
|
||
def _cached_download(**kwargs): | ||
url = "https://drive.google.com/uc?id=0B9P1L--7Wd2vU3VUVlFnbTgtS2c" | ||
with tempfile.NamedTemporaryFile() as f: | ||
for _ in range(2): | ||
gdown.cached_download(url=url, path=f.name, **kwargs) | ||
|
||
|
||
def test_cached_download_md5(): | ||
_cached_download(hash="md5:cb31a703b96c1ab2f80d164e9676fe7d") | ||
|
||
|
||
def test_cached_download_sha1(): | ||
_cached_download(hash="sha1:69a5a1000f98237efea9231c8a39d05edf013494") | ||
|
||
|
||
def test_cached_download_sha256(): | ||
_cached_download( | ||
hash="sha256:284e3029cce3ae5ee0b05866100e300046359f53ae4c77fe6b34c05aa7a72cee" | ||
) |