ARM-software / trappy

This repository has moved to https://gitlab.arm.com/tooling/trappy
Apache License 2.0
60 stars 39 forks source link

Constraint: Fix __str__ for non-string column keys #230

Closed bjackman closed 7 years ago

bjackman commented 7 years ago

Pandas DataFrame columns may be named with any hashable object.

I haven't changed the code for when the data comes from a Trappy trace. I don't think it's necessary (because self.column is always a string - right?) and I haven't figured out how to test it.

JaviMerino commented 7 years ago

A simple test to catch the failure is:

        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")

In general I'm happy with testing internal APIs. If at some point they fail because that particular API is no longer used we can get rid of the test.

I have added the test to your commit and merged it as 085a026. Thanks!