We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cd4b809 commit 475967aCopy full SHA for 475967a
libpysal/weights/tests/test_weights.py
@@ -1,3 +1,6 @@
1
+import os
2
+import tempfile
3
+
4
import unittest
5
from ..weights import W, WSP
6
from .. import util
@@ -346,8 +349,10 @@ def test_connected_components(self):
346
349
assert disco.n_components == 2
347
350
348
351
def test_roundtrip_write(self):
- self.w.to_file("./tmp.gal")
- new = W.from_file("./tmp.gal")
352
+ with tempfile.TemporaryDirectory() as tmpdir:
353
+ path = os.path.join(str(tmpdir), "tmp.gal")
354
+ self.w.to_file(path)
355
+ new = W.from_file(path)
356
np.testing.assert_array_equal(self.w.sparse.toarray(), new.sparse.toarray())
357
358
0 commit comments