Created
September 4, 2017 18:33
-
-
Save sileht/4386d96415f5076a37f83b02fc33dd68 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/gnocchi/tests/test_carbonara.py b/gnocchi/tests/test_carbonara.py | |
index 51cbfc22..3b2c4743 100644 | |
--- a/gnocchi/tests/test_carbonara.py | |
+++ b/gnocchi/tests/test_carbonara.py | |
@@ -276,6 +276,46 @@ class TestAggregatedTimeSerie(base.BaseTestCase): | |
self.assertEqual(5.9000000000000004, | |
ts[datetime64(2014, 1, 1, 12, 0, 0)][1]) | |
+ def test_mean_bug_percentile(self): | |
+ for i in range(0, 1000000): | |
+ print("# %d #" % i) | |
+ self._do_test_mean_bug_percentile() | |
+ | |
+ def _do_test_mean_bug_percentile(self): | |
+ ts = carbonara.TimeSerie.from_tuples([ | |
+ (datetime64(2015, 3, 6, 14, 33, 0), 10), | |
+ (datetime64(2015, 3, 6, 14, 34, 10), 13), | |
+ (datetime64(2015, 3, 6, 14, 34, 20), 13), | |
+ (datetime64(2015, 3, 6, 14, 34, 30), 15), | |
+ (datetime64(2015, 3, 6, 14, 34, 40), 18), | |
+ (datetime64(2015, 3, 6, 14, 34, 50), 20), | |
+ (datetime64(2015, 3, 6, 14, 35, 0), 22), | |
+ (datetime64(2015, 3, 6, 14, 35, 10), 26), | |
+ (datetime64(2015, 3, 6, 14, 35, 20), 30), | |
+ (datetime64(2015, 3, 6, 14, 35, 30), 31), | |
+ (datetime64(2015, 3, 6, 14, 35, 40), 37), | |
+ (datetime64(2015, 3, 6, 14, 35, 50), 55), | |
+ (datetime64(2015, 3, 6, 14, 36, 0), 62), | |
+ (datetime64(2015, 3, 6, 14, 36, 10), 100), | |
+ (datetime64(2015, 3, 6, 14, 36, 20), 102), | |
+ (datetime64(2015, 3, 6, 14, 36, 30), 103), | |
+ (datetime64(2015, 3, 6, 14, 36, 40), 104), | |
+ (datetime64(2015, 3, 6, 14, 36, 50), 110), | |
+ ]) | |
+ | |
+ ts = self._resample(ts, numpy.timedelta64(60, 's'), | |
+ 'mean', derived=True) | |
+ | |
+ self.assertEqual(3, len(ts)) | |
+ self.assertEqual( | |
+ [(datetime64(2015, 3, 6, 14, 34, 0), numpy.timedelta64(60, 's'), | |
+ 2), | |
+ (datetime64(2015, 3, 6, 14, 35, 0), numpy.timedelta64(60, 's'), | |
+ 5.833333333333333), | |
+ (datetime64(2015, 3, 6, 14, 36, 0), numpy.timedelta64(60, 's'), | |
+ 9.166666666666666)], | |
+ list(ts.fetch())) | |
+ | |
def test_transform(self): | |
ts = carbonara.TimeSerie.from_tuples( | |
[(datetime64(2014, 1, 1, 12, 0, 0), -3), | |
▄ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment