aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBrendan Jackman <brendan.jackman@arm.com>2016-11-02 14:30:18 +0000
committerJavi Merino <merino.jav@gmail.com>2016-11-03 18:33:50 -0600
commit085a0264afaea1a03695d3950c5772bca7ba846e (patch)
tree857833c7df9ed3ed7e899618d1cd2b0920dfc21f /tests
parentbbb88c96fe142480a586330bd7bbc7f90e59927a (diff)
downloadtrappy-085a0264afaea1a03695d3950c5772bca7ba846e.tar.gz
Constraint: Fix __str__ for non-string column keys
Pandas DataFrame columns may be named with any hashable object.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_constraint.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/test_constraint.py b/tests/test_constraint.py
index 438fa97..f75b61a 100644
--- a/tests/test_constraint.py
+++ b/tests/test_constraint.py
@@ -18,7 +18,7 @@ import pandas as pd
import unittest
from trappy.plotter import AttrConf
-from trappy.plotter.Constraint import ConstraintManager
+from trappy.plotter.Constraint import Constraint, ConstraintManager
class TestConstraintManager(unittest.TestCase):
"""Test trappy.plotter.ConstraintManager"""
@@ -184,3 +184,13 @@ class TestConstraintManager(unittest.TestCase):
constraint = iter(c_mgr).next()
series = constraint.result[AttrConf.PIVOT_VAL]
self.assertEquals(len(series), 3)
+
+class TestConstraint(unittest.TestCase):
+ def test_str_constraint(self):
+ """str(constraint) doesn't fail when the column is not a string"""
+ dfr = pd.DataFrame({12: [1, 2, 3], 13: [3, 4, 5]})
+
+ constraint = Constraint(dfr, AttrConf.PIVOT, 12, template=None,
+ trace_index=0, filters={}, window=None)
+
+ self.assertEqual(str(constraint), "DataFrame 0:12")