diff options
author | Hind-M <hind.montassif@gmail.com> | 2021-10-08 11:18:46 +0200 |
---|---|---|
committer | Hind-M <hind.montassif@gmail.com> | 2021-10-08 11:18:46 +0200 |
commit | f461f050ee8bad509814b4851ab7ae8f43502962 (patch) | |
tree | c806b23606d006e898b025cb8821efdc1f16d897 /src/python/test/test_dtm.py | |
parent | dbdc62a494e54c3dd409a2e80fa169560355ce19 (diff) |
Add warnings in dtm.py for DistanceToMeasure and DTMDensity
Add DTMDensity warning test
Diffstat (limited to 'src/python/test/test_dtm.py')
-rwxr-xr-x | src/python/test/test_dtm.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/python/test/test_dtm.py b/src/python/test/test_dtm.py index c29471cf..52468d0f 100755 --- a/src/python/test/test_dtm.py +++ b/src/python/test/test_dtm.py @@ -97,7 +97,15 @@ def test_dtm_overflow_warnings(): for impl in impl_warn: dtm = DistanceToMeasure(2, q=10000, implementation=impl) r = dtm.fit_transform(pts) - assert len(w) == 2 + assert len(w) == 3 for i in range(len(w)): assert issubclass(w[i].category, RuntimeWarning) assert "Overflow" in str(w[i].message) + +def test_density_overflow_warning(): + distances = numpy.array([[10., 100.], [10000000000000., 10.]]) + with warnings.catch_warnings(record=True) as w: + density = DTMDensity(k=2, q=100000, implementation="keops", dim=1).fit_transform(distances) + assert len(w) == 1 + assert issubclass(w[0].category, RuntimeWarning) + assert "Overflow" in str(w[0].message) |