Skip to content

Commit 5859fc8

Browse files
committed
tests: distmatrix returns numpy datatypes
1 parent 6f67db7 commit 5859fc8

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Orange/tests/test_distances.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,17 @@ def test_save(self):
186186
["danny", "eve", "frank"])
187187
self.assertEqual(m.axis, 0)
188188

189+
def test_numpy_type(self):
190+
"""
191+
Test if for DistMatrix function returning a single element if they
192+
are numpy datatype. This is needed for other numpy function to work.
193+
"""
194+
data = np.random.randint(3, 5, (3, 5))
195+
dm1, dm2 = DistMatrix(data), DistMatrix(data)
196+
197+
self.assertEqual(np.int, type(dm1.max()))
198+
np.testing.assert_array_equal(dm1, dm2)
199+
189200

190201
# noinspection PyTypeChecker
191202
class TestEuclidean(TestCase):

0 commit comments

Comments
 (0)