Ejemplo n.º 1
0
    def test_append(self):
        metric_a = ToyConversationMetric(self.conv, metric_name='a')
        metrics = ConversationMetricSet(self.conv, [metric_a])
        self.assertEqual(metrics.values(), [metric_a])

        metric_b = ToyConversationMetric(self.conv, metric_name='b')
        metrics.append(metric_b)
        self.assertEqual(metrics.values(), [metric_a, metric_b])
        self.assertEqual(metrics['b'], metric_b)
Ejemplo n.º 2
0
    def test_extend(self):
        metric_a = ToyConversationMetric(self.conv, metric_name='a')
        metrics = ConversationMetricSet(self.conv, [metric_a])
        self.assertEqual(metrics.values(), [metric_a])

        metric_b = ToyConversationMetric(self.conv, metric_name='b')
        metric_c = ToyConversationMetric(self.conv, metric_name='c')
        metrics.extend([metric_b, metric_c])
        self.assertEqual(metrics.values(), [metric_a, metric_b, metric_c])
        self.assertEqual(metrics['b'], metric_b)
        self.assertEqual(metrics['c'], metric_c)
Ejemplo n.º 3
0
    def test_append(self):
        metric_a = ToyConversationMetric(self.conv, metric_name='a')
        metrics = ConversationMetricSet(self.conv, [metric_a])
        self.assertEqual(metrics.values(), [metric_a])

        metric_b = ToyConversationMetric(self.conv, metric_name='b')
        metrics.append(metric_b)
        self.assertEqual(metrics.values(), [metric_a, metric_b])
        self.assertEqual(metrics['b'], metric_b)
Ejemplo n.º 4
0
    def test_extend(self):
        metric_a = ToyConversationMetric(self.conv, metric_name='a')
        metrics = ConversationMetricSet(self.conv, [metric_a])
        self.assertEqual(metrics.values(), [metric_a])

        metric_b = ToyConversationMetric(self.conv, metric_name='b')
        metric_c = ToyConversationMetric(self.conv, metric_name='c')
        metrics.extend([metric_b, metric_c])
        self.assertEqual(metrics.values(), [metric_a, metric_b, metric_c])
        self.assertEqual(metrics['b'], metric_b)
        self.assertEqual(metrics['c'], metric_c)
Ejemplo n.º 5
0
 def test_iteration(self):
     metric_a = ToyConversationMetric(self.conv, metric_name='a')
     metric_b = ToyConversationMetric(self.conv, metric_name='b')
     metrics = ConversationMetricSet(self.conv, [metric_a, metric_b])
     self.assertEqual(list(iter(metrics.values())), [metric_a, metric_b])
Ejemplo n.º 6
0
 def test_item_getting(self):
     metric_a = ToyConversationMetric(self.conv, metric_name='a')
     metrics = ConversationMetricSet(self.conv, [metric_a])
     self.assertEqual(metric_a, metrics['a'])
Ejemplo n.º 7
0
 def test_get(self):
     metric_a = ToyConversationMetric(self.conv, metric_name='a')
     metrics = ConversationMetricSet(self.conv, [metric_a])
     self.assertEqual(metric_a, metrics.get('a'))
Ejemplo n.º 8
0
 def test_iteration(self):
     metric_a = ToyConversationMetric(self.conv, metric_name='a')
     metric_b = ToyConversationMetric(self.conv, metric_name='b')
     metrics = ConversationMetricSet(self.conv, [metric_a, metric_b])
     self.assertEqual(list(iter(metrics.values())), [metric_a, metric_b])
Ejemplo n.º 9
0
 def test_get(self):
     metric_a = ToyConversationMetric(self.conv, metric_name='a')
     metrics = ConversationMetricSet(self.conv, [metric_a])
     self.assertEqual(metric_a, metrics.get('a'))
Ejemplo n.º 10
0
 def get_metrics(self):
     return ConversationMetricSet(
         self.conv,
         [metric(self.conv) for metric in self.metrics])