1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
|
From: Josenilson Ferreira da Silva <nilsonfsilva@hotmail.com>
Date: Thu, 1 May 2025 19:23:40 -0300
Subject: Fixed file path for tests
Forwarded: not-needed
Last-Update: 2024-07-07
===================================================================
---
spopt/tests/test_azp.py | 5 +++--
spopt/tests/test_maxp.py | 3 ++-
spopt/tests/test_random_regions.py | 3 ++-
spopt/tests/test_region_util.py | 3 ++-
spopt/tests/test_skater.py | 6 ++++--
spopt/tests/test_spenc.py | 3 ++-
spopt/tests/test_ward.py | 3 ++-
7 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/spopt/tests/test_azp.py b/spopt/tests/test_azp.py
index e3718a1..e4e36e8 100644
--- a/spopt/tests/test_azp.py
+++ b/spopt/tests/test_azp.py
@@ -9,11 +9,12 @@ from spopt.region import AZP
LIBPYSAL_GE_48 = Version(libpysal.__version__) >= Version("4.8.0")
w_kwargs = {"use_index": True} if LIBPYSAL_GE_48 else {}
-
RANDOM_STATE = 123456
# Mexican states
-pth = libpysal.examples.get_path("mexicojoin.shp")
+from pathlib import Path
+pth = Path("/usr/share/doc/python3-libpysal/examples/mexico/mexicojoin.shp")
+
MEXICO = geopandas.read_file(pth)
diff --git a/spopt/tests/test_maxp.py b/spopt/tests/test_maxp.py
index 62ce571..4499eaf 100644
--- a/spopt/tests/test_maxp.py
+++ b/spopt/tests/test_maxp.py
@@ -19,7 +19,8 @@ w_kwargs = {"use_index": True} if LIBPYSAL_GE_48 else {}
# Mexican states
-pth = libpysal.examples.get_path("mexicojoin.shp")
+from pathlib import Path
+pth = Path("/usr/share/doc/python3-libpysal/examples/mexico/mexicojoin.shp")
MEXICO = geopandas.read_file(pth)
diff --git a/spopt/tests/test_random_regions.py b/spopt/tests/test_random_regions.py
index 001addc..b967c52 100644
--- a/spopt/tests/test_random_regions.py
+++ b/spopt/tests/test_random_regions.py
@@ -13,7 +13,8 @@ w_kwargs = {"use_index": True} if LIBPYSAL_GE_48 else {}
# Empirical tests -- Mexican states
RANDOM_STATE = 12345
-pth = libpysal.examples.get_path("mexicojoin.shp")
+from pathlib import Path
+pth = Path("/usr/share/doc/python3-libpysal/examples/mexico/mexicojoin.shp")
MEXICO = geopandas.read_file(pth)
# Synthetic tests
diff --git a/spopt/tests/test_region_util.py b/spopt/tests/test_region_util.py
index 4dfa0b1..f1e8304 100644
--- a/spopt/tests/test_region_util.py
+++ b/spopt/tests/test_region_util.py
@@ -9,7 +9,8 @@ import spopt.region.util as util
RANDOM_STATE = 123456
# Mexican states
-pth = libpysal.examples.get_path("mexicojoin.shp")
+from pathlib import Path
+pth = Path("/usr/share/doc/python3-libpysal/examples/mexico/mexicojoin.shp")
MEXICO = geopandas.read_file(pth)
diff --git a/spopt/tests/test_skater.py b/spopt/tests/test_skater.py
index c9b5a84..c8ad4fb 100644
--- a/spopt/tests/test_skater.py
+++ b/spopt/tests/test_skater.py
@@ -16,10 +16,12 @@ w_kwargs = {"use_index": True} if LIBPYSAL_GE_48 else {}
# Empirical tests
RANDOM_STATE = 12345
# -- Mexican states
-pth = libpysal.examples.get_path("mexicojoin.shp")
+from pathlib import Path
+pth = Path("/usr/share/doc/python3-libpysal/examples/mexico/mexicojoin.shp")
+
MEXICO = geopandas.read_file(pth)
# -- Columbus
-pth = libpysal.examples.get_path("columbus.shp")
+pth = Path("/usr/share/doc/python3-libpysal/examples/columbus/columbus.shp")
COLUMBUS = geopandas.read_file(pth)
diff --git a/spopt/tests/test_spenc.py b/spopt/tests/test_spenc.py
index 9bf02e1..07267dd 100644
--- a/spopt/tests/test_spenc.py
+++ b/spopt/tests/test_spenc.py
@@ -12,7 +12,8 @@ w_kwargs = {"use_index": True} if LIBPYSAL_GE_48 else {}
# Empirical tests
RANDOM_STATE = 123456
# -- Mexican states
-pth = libpysal.examples.get_path("mexicojoin.shp")
+from pathlib import Path
+pth = Path("/usr/share/doc/python3-libpysal/examples/mexico/mexicojoin.shp")
MEXICO = geopandas.read_file(pth)
diff --git a/spopt/tests/test_ward.py b/spopt/tests/test_ward.py
index ba5622f..d54e638 100644
--- a/spopt/tests/test_ward.py
+++ b/spopt/tests/test_ward.py
@@ -12,7 +12,8 @@ w_kwargs = {"use_index": True} if LIBPYSAL_GE_48 else {}
# Empirical tests -- Mexican states
RANDOM_STATE = 12345
-pth = libpysal.examples.get_path("mexicojoin.shp")
+from pathlib import Path
+pth = Path("/usr/share/doc/python3-libpysal/examples/mexico/mexicojoin.shp")
MEXICO = geopandas.read_file(pth)
|