aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMichele Di Giorgio <michele.digiorgio@arm.com>2016-04-19 18:16:08 +0100
committerMichele Di Giorgio <michele.digiorgio@arm.com>2016-04-19 18:20:43 +0100
commit1af636b16f3797bebcc56d8fcfc56183c21ec377 (patch)
tree0cffc334567086a524975cd0afd6b177569366b9 /tests
parent120b29c449da7f2f8bb11755a5ba51e4a761c1df (diff)
downloadtrappy-1af636b16f3797bebcc56d8fcfc56183c21ec377.tar.gz
ILinePlot: test independent series merging
This tests checks the following: - given two data series with different indexes - ILinePlot will merge them using _fix_indexes - the set of indexes of the merged series must be the union of the set of indexes of the initial series
Diffstat (limited to 'tests')
-rw-r--r--tests/test_plotter.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/test_plotter.py b/tests/test_plotter.py
index b374783..8a83a09 100644
--- a/tests/test_plotter.py
+++ b/tests/test_plotter.py
@@ -260,6 +260,24 @@ class TestILinePlotter(unittest.TestCase):
trappy.ILinePlot([dfr1, dfr2], column=["a", "a"]).view(test=True)
+ def test_independent_series_merging(self):
+ """ILinePlot fixes indexes of independent series"""
+ index1 = [0., 1., 2., 3.]
+ s1 = pd.Series([1, 2, 3, 4], index=index1)
+ index2 = [0.5, 1.5, 2.5, 3.5]
+ s2 = pd.Series([2, 3, 4, 5], index=index2)
+
+ dfr = pd.DataFrame([0, 1, 2, 3], columns=["a"])
+ iplot = trappy.ILinePlot(dfr, column=["a"])
+ s = pd.Series()
+ s["s1"] = s1
+ s["s2"] = s2
+ merged = iplot._fix_indexes(s)
+
+ expected_index = index1 + index2
+ expected_index.sort()
+ self.assertEquals(expected_index, merged.index.tolist())
+
class TestBarPlot(unittest.TestCase):
def setUp(self):
self.dfr = pd.DataFrame({"foo": [1, 2, 3],