Example #1
0
    def test_start_time_set(self):
        d = DistributionCell()
        d.update(3.1)

        name = MetricName('namespace', 'name1')
        mi = d.to_runner_api_monitoring_info(name, 'transform_id')
        self.assertGreater(mi.start_time.seconds, 0)
Example #2
0
 def test_integer_only(self):
   d = DistributionCell()
   d.update(3.1)
   d.update(3.2)
   d.update(3.3)
   self.assertEqual(d.get_cumulative(),
                    DistributionData(9, 3, 3, 3))
Example #3
0
    def test_basic_operations(self):
        d = DistributionCell()
        d.update(10)
        self.assertEqual(d.get_cumulative(), DistributionData(10, 1, 10, 10))

        d.update(2)
        self.assertEqual(d.get_cumulative(), DistributionData(12, 2, 2, 10))

        d.update(900)
        self.assertEqual(d.get_cumulative(), DistributionData(912, 3, 2, 900))
Example #4
0
  def test_basic_operations(self):
    d = DistributionCell()
    d.update(10)
    self.assertEqual(d.get_cumulative(),
                     DistributionData(10, 1, 10, 10))

    d.update(2)
    self.assertEqual(d.get_cumulative(),
                     DistributionData(12, 2, 2, 10))

    d.update(900)
    self.assertEqual(d.get_cumulative(),
                     DistributionData(912, 3, 2, 900))
Example #5
0
 def test_integer_only(self):
     d = DistributionCell()
     d.update(3.1)
     d.update(3.2)
     d.update(3.3)
     self.assertEqual(d.get_cumulative(), DistributionData(9, 3, 3, 3))