예제 #1
0
    def test_invalid_one_duplicate(self):
        known_labels = ["A", "B", "C"]
        passed_labels = ["A", "B", "B"]
        arg_name = "true_labels"

        with self.assertRaises(ValueError) as context:
            skplt.validate_labels(known_labels, passed_labels, arg_name)

        msg = "The following duplicate labels were passed into true_labels: B"
        self.assertEqual(msg, str(context.exception))
예제 #2
0
    def test_invalid_missing_numerical_labels(self):
        known_labels = [0, 1, 2]
        passed_labels = [0, 2, 3]
        arg_name = "true_labels"

        with self.assertRaises(ValueError) as context:
            skplt.validate_labels(known_labels, passed_labels, arg_name)

        msg = "The following labels were passed into true_labels, but were not found in labels: 3"
        self.assertEqual(msg, str(context.exception))
예제 #3
0
    def test_invalid_two_missing(self):
        known_labels = ["A", "B", "C"]
        passed_labels = ["A", "E", "B", "D"]
        arg_name = "true_labels"

        with self.assertRaises(ValueError) as context:
            skplt.validate_labels(known_labels, passed_labels, arg_name)

        msg = "The following labels were passed into true_labels, but were not found in labels: E, D"
        self.assertEqual(msg, str(context.exception))
예제 #4
0
    def test_valid_subset(self):
        known_labels = ["A", "B", "C"]
        passed_labels = ["A", "B"]
        arg_name = "true_labels"

        actual = skplt.validate_labels(known_labels, passed_labels, arg_name)
        self.assertEqual(actual, None)
예제 #5
0
    def test_numerical_labels(self):
        known_labels = [0, 1, 2]
        passed_labels = [0, 2]
        arg_name = "true_labels"

        actual = skplt.validate_labels(known_labels, passed_labels, arg_name)
        self.assertEqual(actual, None)