diff options
author | Hind-M <hind.montassif@gmail.com> | 2022-08-02 14:56:51 +0200 |
---|---|---|
committer | Hind-M <hind.montassif@gmail.com> | 2022-08-02 14:56:51 +0200 |
commit | 1c5c80fb53075706ba74751468d748960fae9dd9 (patch) | |
tree | f36ee3387f7ebbe4df15f07b41888fc45409c0d2 /src | |
parent | eb0ab20bdbf624e6b20896fb2cca1af71af7d4a5 (diff) |
Pull out the for loop in test
Diffstat (limited to 'src')
-rwxr-xr-x | src/python/test/test_dtm.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/python/test/test_dtm.py b/src/python/test/test_dtm.py index 21cff055..b276f041 100755 --- a/src/python/test/test_dtm.py +++ b/src/python/test/test_dtm.py @@ -92,11 +92,10 @@ def test_density(): def test_dtm_overflow_warnings(): pts = numpy.array([[10., 100000000000000000000000000000.], [1000., 100000000000000000000000000.]]) impl_warn = ["keops", "hnsw"] - with warnings.catch_warnings(record=True) as w: - for impl in impl_warn: + for impl in impl_warn: + with warnings.catch_warnings(record=True) as w: dtm = DistanceToMeasure(2, implementation=impl) r = dtm.fit_transform(pts) - assert len(w) == 2 - for i in range(len(w)): - assert issubclass(w[i].category, RuntimeWarning) - assert "Overflow" in str(w[i].message) + assert len(w) == 1 + assert issubclass(w[0].category, RuntimeWarning) + assert "Overflow" in str(w[0].message) |