def test_ReadPredictionsCorruptedEmptyKey(self):
        t = temp_file_with_contents([
            ',N\n',
        ])
        with self.assertRaises(SystemExit) as context:
            evaluator.read_predictions(t)
        os.remove(t)

        self.assertEqual(context.exception.code, evaluator.EXIT_STATUS_PREDICTIONS_MALFORMED)
    def test_ReadPredictionsMissingColumn(self):
        t = temp_file_with_contents([
            'P1,E\n',
            '"P2"\n',
        ])
        with self.assertRaises(SystemExit) as context:
            evaluator.read_predictions(t)
        os.remove(t)

        self.assertEqual(context.exception.code, evaluator.EXIT_STATUS_PREDICTIONS_MALFORMED)
    def test_ReadPredictions(self):
        t = temp_file_with_contents([
            'P1,E\n',
            '"P2",N\n',
        ])
        predictions = evaluator.read_predictions(t)
        os.remove(t)

        self.assertEqual(predictions, {
            "P1": "E",
            "P2": "N",
        })
Пример #4
0
    def test_ReadPredictions(self):
        t = temp_file_with_contents([
            'Q1,A\n',
            '"Q2",A;B\n',
            'Q3,"A;B;C"\n',
        ])
        predictions = evaluator.read_predictions(t)
        os.remove(t)

        self.assertEqual(predictions, {
            "Q1": ["A"],
            "Q2": ["A", "B"],
            "Q3": ["A", "B", "C"],
        })