forked from aopy/neural-activity-visualizer
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix broken download of auxilliary files
- Loading branch information
Showing
3 changed files
with
201 additions
and
120 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
""" | ||
""" | ||
|
||
import os.path | ||
from neo.io import BrainVisionIO | ||
from ..data_handler import get_base_url_and_path, get_cache_path, list_files_to_download | ||
|
||
|
||
def test_get_base_url_and_path(): | ||
url = "https://gin.g-node.org/NeuralEnsemble/ephy_testing_data/raw/master/brainvision/File_brainvision_1.vhdr" | ||
base_url, base_path = get_base_url_and_path(url) | ||
assert ( | ||
base_url | ||
== "https://gin.g-node.org/NeuralEnsemble/ephy_testing_data/raw/master/brainvision" | ||
) | ||
assert base_path == "File_brainvision_1.vhdr" | ||
|
||
url = "https://gin.g-node.org/NeuralEnsemble/ephy_testing_data/src/master/maxwell/MaxOne_data/Record/000011/data.raw.h5" | ||
base_url, base_path = get_base_url_and_path(url) | ||
assert ( | ||
base_url | ||
== "https://gin.g-node.org/NeuralEnsemble/ephy_testing_data/src/master/maxwell/MaxOne_data/Record/000011" | ||
) | ||
assert base_path == "data.raw.h5" | ||
|
||
|
||
def test_get_cache_path(): | ||
url = "https://gin.g-node.org/NeuralEnsemble/ephy_testing_data/raw/master/brainvision/File_brainvision_1.vhdr" | ||
cache_path, filename = get_cache_path(url) | ||
assert cache_path == os.path.realpath( | ||
os.path.join( | ||
os.path.dirname(__file__), | ||
"..", | ||
"download_cache/603fed2393f75a3f294fceac99640f7d4a42f74d", | ||
) | ||
) | ||
assert filename == "File_brainvision_1.vhdr" | ||
|
||
def test_list_files_to_download(): | ||
url = "https://gin.g-node.org/NeuralEnsemble/ephy_testing_data/raw/master/brainvision/File_brainvision_1.vhdr" | ||
files_to_download = list_files_to_download(url, "the_cache_dir", BrainVisionIO) | ||
expected = [ | ||
(url, "the_cache_dir/File_brainvision_1.vhdr", True), | ||
(url.replace(".vhdr", ".eeg"), "the_cache_dir/File_brainvision_1.eeg", True), | ||
(url.replace(".vhdr", ".vmrk"), "the_cache_dir/File_brainvision_1.vmrk", True) | ||
] | ||
assert files_to_download == expected |
Oops, something went wrong.