summaryrefslogtreecommitdiff
path: root/src/python/test
diff options
context:
space:
mode:
authorHind-M <hind.montassif@gmail.com>2022-02-02 10:38:15 +0100
committerHind-M <hind.montassif@gmail.com>2022-02-02 10:38:15 +0100
commit741f4f182479d1e5e78e9eb9180adce0a72e99b6 (patch)
tree57da5879900da16e2080dccc98403141231b1af1 /src/python/test
parentad7a50fb87ed4237b9a02165eac39ae355dd5440 (diff)
Modify remote fetching test to increase its coverage
Diffstat (limited to 'src/python/test')
-rw-r--r--src/python/test/test_remote_datasets.py21
1 files changed, 7 insertions, 14 deletions
diff --git a/src/python/test/test_remote_datasets.py b/src/python/test/test_remote_datasets.py
index 2057c63b..dac9ee80 100644
--- a/src/python/test/test_remote_datasets.py
+++ b/src/python/test/test_remote_datasets.py
@@ -40,8 +40,6 @@ def _get_bunny_license_print(accept_license = False):
# Redirect stdout
sys.stdout = capturedOutput
- if not exists("remote_datasets/bunny"):
- makedirs("remote_datasets/bunny")
remote._fetch_remote("https://raw.githubusercontent.com/GUDHI/gudhi-data/main/points/bunny/bunny.npy", "bunny.npy", "remote_datasets/bunny",
'13f7842ebb4b45370e50641ff28c88685703efa5faab14edf0bb7d113a965e1b', accept_license)
# Reset redirect
@@ -65,22 +63,17 @@ def test_fetch_remote_datasets():
_check_fetch_output("https://raw.githubusercontent.com/GUDHI/gudhi-data/main/points/sphere3D_pts_on_grid.off", "sphere3D_pts_on_grid.off")
- # Test fetch_spiral_2d wrapping function
- spiral_2d_arr = remote.fetch_spiral_2d()
- assert spiral_2d_arr.shape == (114562, 2)
+ # Test fetch_spiral_2d and fetch_bunny wrapping functions (twice, to test case of already fetched files)
+ for i in range(2):
+ spiral_2d_arr = remote.fetch_spiral_2d()
+ assert spiral_2d_arr.shape == (114562, 2)
+
+ bunny_arr = remote.fetch_bunny()
+ assert bunny_arr.shape == (35947, 3)
# Test printing existing LICENSE file when fetching bunny.npy with accept_license = False (default)
- # Fetch LICENSE file
- if not exists("remote_datasets/bunny"):
- makedirs("remote_datasets/bunny")
- remote._fetch_remote("https://raw.githubusercontent.com/GUDHI/gudhi-data/main/points/bunny/LICENSE", "LICENSE", "remote_datasets/bunny",
- 'b763dbe1b2fc6015d05cbf7bcc686412a2eb100a1f2220296e3b4a644c69633a')
with open("remote_datasets/bunny/LICENSE") as f:
assert f.read().rstrip("\n") == _get_bunny_license_print().getvalue().rstrip("\n")
# Test not printing bunny.npy LICENSE when accept_license = True
assert "" == _get_bunny_license_print(accept_license = True).getvalue()
-
- # Test fetch_bunny wrapping function
- bunny_arr = remote.fetch_bunny()
- assert bunny_arr.shape == (35947, 3)