def test_classify_arrays_invalid_descriptor_dimensions(self):
        c = IndexLabelClassifier(self.FILEPATH_TEST_LABELS)

        # One less
        a = numpy.array([1, 2, 3, 4, 5])
        with pytest.raises(RuntimeError):
            list(c._classify_arrays([a]))

        # One more
        a = numpy.array([1, 2, 3, 4, 5, 6, 7])
        with pytest.raises(RuntimeError):
            list(c._classify_arrays([a]))
예제 #2
0
    def test_classify_arrays(self):
        c = IndexLabelClassifier(self.FILEPATH_TEST_LABELS)
        c_expected = {
            six.b('label_1'): 1,
            six.b('label_2'): 2,
            six.b('negative'): 3,
            six.b('label_3'): 4,
            six.b('Kitware'): 5,
            six.b('label_4'): 6,
        }

        a = numpy.array([1, 2, 3, 4, 5, 6])
        c = list(c._classify_arrays([a]))[0]
        self.assertEqual(c, c_expected)