OLD | NEW |
1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import unittest | 5 import unittest |
6 | 6 |
7 from infra_libs.ts_mon import distribution | 7 from infra_libs.ts_mon.gae import distribution |
8 | 8 |
9 | 9 |
10 class BucketerTestBase(unittest.TestCase): | 10 class BucketerTestBase(unittest.TestCase): |
11 def assertBucketCounts(self, b, expected_total): | 11 def assertBucketCounts(self, b, expected_total): |
12 self.assertEquals(expected_total - 2, b.num_finite_buckets) | 12 self.assertEquals(expected_total - 2, b.num_finite_buckets) |
13 self.assertEquals(expected_total, b.total_buckets) | 13 self.assertEquals(expected_total, b.total_buckets) |
14 self.assertEquals(0, b.underflow_bucket) | 14 self.assertEquals(0, b.underflow_bucket) |
15 self.assertEquals(expected_total - 1, b.overflow_bucket) | 15 self.assertEquals(expected_total - 1, b.overflow_bucket) |
16 | 16 |
17 def assertBoundaries(self, b, expected_finite_upper_boundaries): | 17 def assertBoundaries(self, b, expected_finite_upper_boundaries): |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 | 155 |
156 self.assertEqual(100, d.sum) | 156 self.assertEqual(100, d.sum) |
157 self.assertEqual(1, d.count) | 157 self.assertEqual(1, d.count) |
158 self.assertEqual({11: 1}, d.buckets) | 158 self.assertEqual({11: 1}, d.buckets) |
159 | 159 |
160 d.add(1000000) | 160 d.add(1000000) |
161 | 161 |
162 self.assertEqual(1000100, d.sum) | 162 self.assertEqual(1000100, d.sum) |
163 self.assertEqual(2, d.count) | 163 self.assertEqual(2, d.count) |
164 self.assertEqual({11: 2}, d.buckets) | 164 self.assertEqual({11: 2}, d.buckets) |
OLD | NEW |