aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKapileshwar Singh <kapileshwarsingh@gmail.com>2016-07-07 13:03:00 +0200
committerGitHub <noreply@github.com>2016-07-07 13:03:00 +0200
commit539612bdf03cd19a72cac521d4400ddf7421b70b (patch)
tree8c59e35b064c3084673b942c6494f9b2db79effb /tests
parent68e30d3539a282ef484c6caf2c89cacc905b1956 (diff)
parentce5efc8fa44055d08aa33eb0982ebca6fd49a070 (diff)
downloadtrappy-539612bdf03cd19a72cac521d4400ddf7421b70b.tar.gz
Merge pull request #206 from JaviMerino/ilineplot_xlim/v1
ILinePlot: only pass the necessary data when xlim is passed
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)