Skip to content

Commit 3466f7b

Browse files
committed
more
1 parent 87f0b1d commit 3466f7b

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

.devel/pytest/test_paths.py

+9-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
# more tests in sphinx/weave!
88

99
def test_paths():
10-
path = "~/Projects/clustering-data-v1/"
10+
path = "~/Projects/clustering-data-v1"
11+
path = os.path.expanduser(path)
12+
1113
if os.path.exists(path):
1214
assert "wut" in clustbench.get_battery_names(path)
1315
assert "x1" in clustbench.get_dataset_names("wut", path)
@@ -16,12 +18,14 @@ def test_paths():
1618
assert "wut" in clustbench.get_battery_names()
1719
assert "x1" in clustbench.get_dataset_names("wut")
1820

19-
assert "wut" in clustbench.get_battery_names("../clustering-data-v1/")
20-
assert "x1" in clustbench.get_dataset_names("wut", "../clustering-data-v1/")
21+
assert "wut" in clustbench.get_battery_names(path)
22+
assert "x1" in clustbench.get_dataset_names("wut", path)
23+
24+
assert clustbench.load_dataset("wut", "x2").data.flags["C_CONTIGUOUS"]
2125

22-
assert len(clustbench.load_dataset("wut", "x2", "../clustering-data-v1/")["labels"]) == 2
26+
assert len(clustbench.load_dataset("wut", "x2").labels) == 2
2327

24-
assert len(clustbench.assertload_dataset("wut", "x2", url="https://github.com/gagolews/clustering-data-v1/raw/v1.1.0")["labels"]) == 2
28+
assert len(clustbench.load_dataset("wut", "x2", url="https://github.com/gagolews/clustering-data-v1/raw/v1.1.0").labels) == 2
2529

2630

2731
if __name__ == "__main__":

clustbench/load_dataset.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -127,14 +127,15 @@ def load_dataset(
127127

128128
data_file = base_name + ".data.gz"
129129
data = np.loadtxt(data_file, ndmin=2)
130-
data = np.ascontiguousarray(data)
131130

132131
if data.ndim != 2:
133132
raise ValueError("Not a matrix.")
134133

135134
if preprocess:
136135
data = preprocess_data(data, random_state=random_state)
137136

137+
data = np.ascontiguousarray(data)
138+
138139
labels = []
139140
i = 0
140141
while True:

0 commit comments

Comments
 (0)