summaryrefslogtreecommitdiff
path: root/src/python/test/test_remote_datasets.py
diff options
context:
space:
mode:
authorHind-M <hind.montassif@gmail.com>2021-06-02 16:00:40 +0200
committerHind-M <hind.montassif@gmail.com>2021-06-02 16:00:40 +0200
commitbaa2e67036dae8ec63321a4d9ff4e913780a8757 (patch)
treef0d3e27d369dedeb3ce391dd2825fbebff3f3b45 /src/python/test/test_remote_datasets.py
parentc2f0cf79af04ea3586a70c0a121a200353e989ac (diff)
Modify test to consider both slash and backslash in the returned file path
Diffstat (limited to 'src/python/test/test_remote_datasets.py')
-rw-r--r--src/python/test/test_remote_datasets.py29
1 files changed, 24 insertions, 5 deletions
diff --git a/src/python/test/test_remote_datasets.py b/src/python/test/test_remote_datasets.py
index dc854e25..a822ebaa 100644
--- a/src/python/test/test_remote_datasets.py
+++ b/src/python/test/test_remote_datasets.py
@@ -9,17 +9,36 @@
from gudhi.datasets import remote
+import re
def test_fetch_remote_datasets():
# Test files download from given urls
- assert 'remote_datasets/spiral_2d.csv' == remote.fetch("https://raw.githubusercontent.com/Hind-M/gudhi-data/main/spiral_2d.csv", "spiral_2d.csv")
- assert 'remote_datasets/sphere3D_pts_on_grid.off' == remote.fetch("https://raw.githubusercontent.com/Hind-M/gudhi-data/main/sphere3D_pts_on_grid.off", "sphere3D_pts_on_grid.off")
+ path_file_dw = remote.fetch("https://raw.githubusercontent.com/Hind-M/gudhi-data/main/spiral_2d.csv", "spiral_2d.csv")
+ names_dw = re.split(r' |/|\\', path_file_dw)
+ assert 'remote_datasets' == names_dw[0]
+ assert 'spiral_2d.csv' == names_dw[1]
+
+ path_file_dw = remote.fetch("https://raw.githubusercontent.com/Hind-M/gudhi-data/main/sphere3D_pts_on_grid.off", "sphere3D_pts_on_grid.off")
+ names_dw = re.split(r' |/|\\', path_file_dw)
+ assert 'remote_datasets' == names_dw[0]
+ assert 'sphere3D_pts_on_grid.off' == names_dw[1]
+
# Test files download with checksums provided
- assert 'remote_datasets/spiral_2d.csv' == remote.fetch("https://raw.githubusercontent.com/Hind-M/gudhi-data/main/spiral_2d.csv", "spiral_2d.csv", checksum_flag = True,
+ path_file_dw = remote.fetch("https://raw.githubusercontent.com/Hind-M/gudhi-data/main/spiral_2d.csv", "spiral_2d.csv", checksum_flag = True,
file_checksum = '37530355d980d957c4ec06b18c775f90a91e446107d06c6201c9b4000b077f38')
- assert 'remote_datasets/sphere3D_pts_on_grid.off' == remote.fetch("https://raw.githubusercontent.com/Hind-M/gudhi-data/main/sphere3D_pts_on_grid.off", "sphere3D_pts_on_grid.off",
+ names_dw = re.split(r' |/|\\', path_file_dw)
+ assert 'remote_datasets' == names_dw[0]
+ assert 'spiral_2d.csv' == names_dw[1]
+
+ path_file_dw = remote.fetch("https://raw.githubusercontent.com/Hind-M/gudhi-data/main/sphere3D_pts_on_grid.off", "sphere3D_pts_on_grid.off",
checksum_flag = True, file_checksum = '32f96d2cafb1177f0dd5e0a019b6ff5658e14a619a7815ae55ad0fc5e8bd3f88')
+ names_dw = re.split(r' |/|\\', path_file_dw)
+ assert 'remote_datasets' == names_dw[0]
+ assert 'sphere3D_pts_on_grid.off' == names_dw[1]
# Test spiral_2d.csv wrapping function
- assert 'remote_datasets/spiral_2d.csv' == remote.fetch_spiral_2d()
+ path_file_dw = remote.fetch_spiral_2d()
+ names_dw = re.split(r' |/|\\', path_file_dw)
+ assert 'remote_datasets' == names_dw[0]
+ assert 'spiral_2d.csv' == names_dw[1]