aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJavi Merino <javi.merino@arm.com>2016-07-04 18:46:52 +0100
committerJavi Merino <javi.merino@arm.com>2016-07-06 19:16:08 +0100
commite6274bd2296229dae5303df8b4226601cc4abdb6 (patch)
treeb6624684f854dd2538df549d29b56219cf89c017 /tests
parent324d21ac8e40f03897da64a2cd2eda8ff1447e51 (diff)
downloadtrappy-e6274bd2296229dae5303df8b4226601cc4abdb6.tar.gz
ILinePlot: only pass the necessary data when xlim is passed
xlim limits the x axis to a given range, but for ILinePlot we pass all the data to dygraph and then let dygraph apply the window. That means that we include a lot of useless data in the notebook and we lose performance parsing data that will never be plotted. Improve xlim for ILinePlot so that it only embeds the data relevant for the plot.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_constraint.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/test_constraint.py b/tests/test_constraint.py
index c92d0b3..438fa97 100644
--- a/tests/test_constraint.py
+++ b/tests/test_constraint.py
@@ -159,3 +159,28 @@ class TestConstraintManager(unittest.TestCase):
self.assertEquals(result[0].iloc[0], 3)
self.assertEquals(result[1].iloc[0], 3)
+
+ def test_constraint_with_window(self):
+ """Test that the constraint manager can constraint to a window of time"""
+ c_mgr = ConstraintManager(self.dfrs[0], "freq", None, AttrConf.PIVOT, {},
+ window=(1, 3))
+
+ constraint = iter(c_mgr).next()
+ series = constraint.result[AttrConf.PIVOT_VAL]
+ self.assertEquals(len(series), 3)
+
+ # For the graph to plot a value at 0.75, the resulting series
+ # must contain the value before 0.75. Same for the upper limit.
+ c_mgr = ConstraintManager(self.dfrs[0], "freq", None, AttrConf.PIVOT, {},
+ window=(0.75, 1.5))
+
+ constraint = iter(c_mgr).next()
+ series = constraint.result[AttrConf.PIVOT_VAL]
+ self.assertEquals(series.index.tolist(), [0, 1, 2])
+
+ c_mgr = ConstraintManager(self.dfrs[0], "freq", None, AttrConf.PIVOT, {},
+ window=(0, 2))
+
+ constraint = iter(c_mgr).next()
+ series = constraint.result[AttrConf.PIVOT_VAL]
+ self.assertEquals(len(series), 3)