• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env vpython3
2
3# Copyright 2024 The Chromium Authors
4# Use of this source code is governed by a BSD-style license that can be
5# found in the LICENSE file.
6"""File for testing metric.py."""
7
8import unittest
9from average import Average
10from count import Count
11from metric import Metric
12
13
14class MetricTest(unittest.TestCase):
15  """Test metric.py."""
16
17  def test_no_metric(self) -> None:
18    m = Metric()
19    self.assertFalse(m.dump().metrics)
20
21  def test_multiple_metrics(self) -> None:
22    m = Metric()
23    m.register(Average("a"))
24    m.register(Average("b"))
25    m.register(Count("c"))
26    self.assertEqual(len(m.dump().metrics), 3)
27
28
29if __name__ == '__main__':
30  unittest.main()
31