From baa2e67036dae8ec63321a4d9ff4e913780a8757 Mon Sep 17 00:00:00 2001 From: Hind-M Date: Wed, 2 Jun 2021 16:00:40 +0200 Subject: Modify test to consider both slash and backslash in the returned file path --- src/python/test/test_remote_datasets.py | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) (limited to 'src/python/test') 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] -- cgit v1.2.3