コード例 #1
0
    def testMetricDecodeFailure(self):
        metric = get_branin_metric()
        sqa_metric = self.encoder.metric_to_sqa(metric)
        sqa_metric.metric_type = "foobar"
        with self.assertRaises(SQADecodeError):
            self.decoder.metric_from_sqa(sqa_metric)

        sqa_metric.metric_type = METRIC_REGISTRY[BraninMetric]
        sqa_metric.intent = "foobar"
        with self.assertRaises(SQADecodeError):
            self.decoder.metric_from_sqa(sqa_metric)

        sqa_metric.intent = MetricIntent.TRACKING
        sqa_metric.properties = {}
        with self.assertRaises(SQADecodeError):
            self.decoder.metric_from_sqa(sqa_metric)
コード例 #2
0
 def testMetricEncodeFailure(self):
     metric = get_branin_metric()
     del metric.__dict__["param_names"]
     with self.assertRaises(AttributeError):
         self.encoder.metric_to_sqa(metric)